Exemplo n.º 1
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 /// <param name="type">Type of the chart series</param>
 /// <param name="unit">Unit of the serier</param>
 public Series(string name, SeriesType type = SeriesType.Line, string unit = "$")
 {
     Name       = name;
     Values     = new List <ChartPoint>();
     SeriesType = type;
     Unit       = unit;
 }
Exemplo n.º 2
0
        internal static string GetXmlRepresentation(this SeriesType seriesType)
        {
            switch (seriesType)
            {
            case SeriesType.Int32:
            {
                return("Int32");
            }

            case SeriesType.Int64:
            {
                return("Int64");
            }

            case SeriesType.Float32:
            {
                return("Float32");
            }

            case SeriesType.Float64:
            {
                return("Float64");
            }

            case SeriesType.String:
            {
                return("String");
            }

            case SeriesType.Boolean:
            {
                return("Boolean");
            }

            case SeriesType.DateTime:
            {
                return("DateTime");
            }

            case SeriesType.EmbeddedXML:
            {
                return("EmbeddedXML");
            }

            case SeriesType.PNG:
            {
                return("PNG");
            }

            case SeriesType.SVG:
            {
                return("SVG");
            }

            default:
            {
                throw new ArgumentException("Specified SeriesType value is not valid.");
            }
            }
        }
        /// <summary>
        /// Returns a market series specific data series based on provided series type
        /// </summary>
        /// <param name="marketSeries">The market series</param>
        /// <param name="seriesType">Series type</param>
        /// <returns>DataSeries</returns>
        public static DataSeries GetSeries(this MarketSeries marketSeries, SeriesType seriesType)
        {
            switch (seriesType)
            {
            case SeriesType.Open:
                return(marketSeries.Open);

            case SeriesType.High:
                return(marketSeries.High);

            case SeriesType.Low:
                return(marketSeries.Low);

            case SeriesType.Close:
                return(marketSeries.Close);

            case SeriesType.Median:
                return(marketSeries.Median);

            case SeriesType.TickVolume:
                return(marketSeries.TickVolume);

            case SeriesType.Typical:
                return(marketSeries.Typical);

            case SeriesType.WeightedClose:
                return(marketSeries.WeightedClose);

            default:
                return(null);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Add a sample to the chart specified by the chartName, and seriesName.
        /// </summary>
        /// <param name="chartName">String chart name to place the sample.</param>
        /// <param name="seriesIndex">Type of chart we should create if it doesn't already exist.</param>
        /// <param name="seriesName">Series name for the chart.</param>
        /// <param name="seriesType">Series type for the chart.</param>
        /// <param name="time">Time for the sample</param>
        /// <param name="value">Value for the chart sample.</param>
        /// <param name="unit">Unit for the sample axis</param>
        /// <remarks>Sample can be used to create new charts or sample equity - daily performance.</remarks>
        public void Sample(string chartName, string seriesName, int seriesIndex, SeriesType seriesType, DateTime time, decimal value, string unit = "$")
        {
            // Sampling during warming up period skews statistics
            if (Algorithm.IsWarmingUp)
            {
                return;
            }

            lock (_chartLock)
            {
                //Add a copy locally:
                if (!Charts.ContainsKey(chartName))
                {
                    Charts.AddOrUpdate(chartName, new Chart(chartName));
                }

                //Add the sample to our chart:
                if (!Charts[chartName].Series.ContainsKey(seriesName))
                {
                    Charts[chartName].Series.Add(seriesName, new Series(seriesName, seriesType, seriesIndex, unit));
                }

                //Add our value:
                Charts[chartName].Series[seriesName].Values.Add(new ChartPoint(time, value));
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add a sample to the chart specified by the chartName, and seriesName.
        /// </summary>
        /// <param name="chartName">String chart name to place the sample.</param>
        /// <param name="chartType">Type of chart we should create if it doesn't already exist.</param>
        /// <param name="seriesName">Series name for the chart.</param>
        /// <param name="seriesType">Series type for the chart.</param>
        /// <param name="time">Time for the sample</param>
        /// <param name="value">Value for the chart sample.</param>
        /// <param name="unit">Unit for the sample axis</param>
        /// <remarks>Sample can be used to create new charts or sample equity - daily performance.</remarks>
        public void Sample(string chartName, ChartType chartType, string seriesName, SeriesType seriesType, DateTime time, decimal value, string unit = "$")
        {
            var chartFilename = Path.Combine(_chartDirectory, chartName + "-" + seriesName + ".csv");

            lock (_chartLock)
            {
                // Add line to list in dictionary, will be written to file at the end
                List <string> rows;
                if (!_equityResults.TryGetValue(chartFilename, out rows))
                {
                    rows = new List <string>();
                    _equityResults[chartFilename] = rows;
                }
                rows.Add(time + "," + value.ToString("F2", CultureInfo.InvariantCulture));

                //Add a copy locally:
                if (!Charts.ContainsKey(chartName))
                {
                    Charts.AddOrUpdate <string, Chart>(chartName, new Chart(chartName, chartType));
                }

                //Add the sample to our chart:
                if (!Charts[chartName].Series.ContainsKey(seriesName))
                {
                    Charts[chartName].Series.Add(seriesName, new Series(seriesName, seriesType));
                }

                //Add our value:
                Charts[chartName].Series[seriesName].Values.Add(new ChartPoint(time, value));
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Add a sample to the chart specified by the chartName, and seriesName.
 /// </summary>
 /// <param name="chartName">String chart name to place the sample.</param>
 /// <param name="seriesName">Series name for the chart.</param>
 /// <param name="seriesIndex">Series chart index - which chart should this series belong</param>
 /// <param name="seriesType">Series type for the chart.</param>
 /// <param name="time">Time for the sample</param>
 /// <param name="value">Value for the chart sample.</param>
 /// <param name="unit">Unit for the chart axis</param>
 /// <remarks>Sample can be used to create new charts or sample equity - daily performance.</remarks>
 protected abstract void Sample(string chartName,
                                string seriesName,
                                int seriesIndex,
                                SeriesType seriesType,
                                DateTime time,
                                decimal value,
                                string unit = "$");
Exemplo n.º 7
0
        public void TrendChart()

        {
            //DashboardInitialize();

            AddWidget("Trend Chart");

            Options("Metric").Clicks();

            CustomMetric();

            Options("Axis").Clicks();

            AxisType.SelectDropdown("Month");

            SeriesSelection.SelectDropdown("Resources");

            SeriesType.SelectDropdown("Departments");

            Characterlimit.ClearText(); Characterlimit.EnterText("10");

            Options("Base").Clicks();

            BasenGoal(.5, 1.5);

            Filter("Trend Chart");

            Apply(); WaitforIt(Properties.InactivePhase);
        }
Exemplo n.º 8
0
        public void HeatMap()

        {
            //DashboardInitialize();

            AddWidget("HeatMap");

            Options("Metric").Clicks();

            RatioMetric();

            Options("Axis").Clicks();

            AxisType.SelectDropdown("Day");

            SeriesSelection.SelectDropdown("Resources");

            SeriesType.SelectDropdown("Departments");

            Characterlimit.ClearText(); Characterlimit.EnterText("10");

            Options("Formatting").Clicks();

            Formatting();

            Filter("Heatmap");

            Apply();
        }
        public virtual void MouseUp(MouseControllerEventArgs e)
        {
            Internalmovdir = MoveDir;
            BackUpCellValues.Clear();
            CellData = new GridCellData();

            for (int Row = Gridmodel.SelectedCells.Top; Row <= Gridmodel.SelectedCells.Bottom; Row++)
            {
                for (int Column = this.SelectedRange.Left; Column <= this.SelectedRange.Right; Column++)
                {
                    var CellRowColumnIndex            = new RowColumnIndex(Row, Column);
                    GridStyleInfoStore styleinfostore = (GridStyleInfoStore)this.grid.Model[Row, Column].Store.Clone();
                    //this.CellData[this.grid.Model[Row, Column].CellRowColumnIndex] = styleinfostore;
                    BackUpCellValues.Add(CellRowColumnIndex, styleinfostore);//this.CellData[this.grid.Model[Row, Column].CellRowColumnIndex]);
                }
            }
            this.InnerFillType = SeriesType.FillSeries;
            this.FillData();

            MoveDir     = MovingDirection.None;
            IsMouseDown = false;

#if !SILVERLIGHT
            if (Buttonside == MouseButton.Left)
#else
            if (Buttonside == MouseButtons.Left)
#endif
            {
                OpenFilterDropDown();
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Add a sample to the chart specified by the chartName, and seriesName.
        /// </summary>
        /// <param name="chartName">String chart name to place the sample.</param>
        /// <param name="seriesIndex">Type of chart we should create if it doesn't already exist.</param>
        /// <param name="seriesName">Series name for the chart.</param>
        /// <param name="seriesType">Series type for the chart.</param>
        /// <param name="time">Time for the sample</param>
        /// <param name="unit">Unit of the sample</param>
        /// <param name="value">Value for the chart sample.</param>
        public void Sample(string chartName, string seriesName, int seriesIndex, SeriesType seriesType, DateTime time, decimal value, string unit = "$")
        {
            // Sampling during warming up period skews statistics
            if (Algorithm.IsWarmingUp)
            {
                return;
            }

            lock (_chartLock)
            {
                //Add a copy locally:
                Chart chart;
                if (!Charts.TryGetValue(chartName, out chart))
                {
                    chart = new Chart(chartName);
                    Charts.AddOrUpdate(chartName, chart);
                }

                //Add the sample to our chart:
                Series series;
                if (!chart.Series.TryGetValue(seriesName, out series))
                {
                    series = new Series(seriesName, seriesType, seriesIndex, unit);
                    chart.Series.Add(seriesName, series);
                }

                //Add our value:
                if (series.Values.Count == 0 || time > Time.UnixTimeStampToDateTime(series.Values[series.Values.Count - 1].x))
                {
                    series.Values.Add(new ChartPoint(time, value));
                }
            }
        }
Exemplo n.º 11
0
 public SeriesModel(string name, SeriesType type, List <double> x, List <double> y, string color)
 {
     Name  = name;
     Type  = type;
     X     = x;
     Y     = y;
     Color = color;
 }
Exemplo n.º 12
0
 public SeriesModel(string name, SeriesType type, double x, double y, string color)
 {
     Name  = name;
     Type  = type;
     X     = new List <double>(new double[] { x });
     Y     = new List <double>(new double[] { y });
     Color = color;
 }
Exemplo n.º 13
0
 private static T ChooseValue <T>(SeriesType seriesType, T expectedValue, T actualValue, T failValue)
 {
     if (seriesType == SeriesType.Actual)
     {
         return(actualValue);
     }
     return(seriesType == SeriesType.Expected ? expectedValue : failValue);
 }
        public double GetSeriesMovingAverageValue(
            Bars bars, SeriesType seriesType, int periods, MovingAverageType type, int index)
        {
            var series = bars.GetSeries(seriesType);

            var ma = _algo.Indicators.MovingAverage(series, periods, type);

            return(ma.Result[index]);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 public Series(string name, SeriesType type)
 {
     Name                = name;
     SeriesType          = type;
     Index               = 0;
     Unit                = "$";
     Color               = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.None;
 }
Exemplo n.º 16
0
        /// <summary>
        /// Gets the drawing class for this series or indicator.
        /// </summary>
        /// <param name="seriesType"></param>
        /// <param name="indicatorType"></param>
        /// <returns></returns>
        public static IChartDrawing GetChartDrawing(SeriesType seriesType, IndicatorType? indicatorType)
        {
            switch (seriesType)
            {
                case SeriesType.LineChart: return new LineChart();
            }

            throw new ArgumentException("No IChartDrawing found for this SeriesType and IndicatorType combination.");
        }
Exemplo n.º 17
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 public Series(string name)
 {
     Name                = name;
     SeriesType          = SeriesType.Line;
     Unit                = "$";
     Index               = 0;
     Color               = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.None;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 /// <param name="index">Index position on the chart of the series</param>
 /// <param name="unit">Unit for the series axis</param>
 public Series(string name, SeriesType type, int index, string unit)
 {
     Name                = name;
     SeriesType          = type;
     Index               = index;
     Unit                = unit;
     Color               = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.None;
 }
Exemplo n.º 19
0
        /// <summary>
        /// Gets the drawing class for this series or indicator.
        /// </summary>
        /// <param name="seriesType"></param>
        /// <param name="indicatorType"></param>
        /// <returns></returns>
        public static IChartDrawing GetChartDrawing(SeriesType seriesType, IndicatorType?indicatorType)
        {
            switch (seriesType)
            {
            case SeriesType.LineChart: return(new LineChart());
            }

            throw new ArgumentException("No IChartDrawing found for this SeriesType and IndicatorType combination.");
        }
Exemplo n.º 20
0
        /// <summary>Series type has been changed by the user.</summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments</param>
        void OnSeriesTypeChanged(object sender, EventArgs e)
        {
            SeriesType seriesType = (SeriesType)Enum.Parse(typeof(SeriesType), this.seriesView.SeriesType.SelectedValue);

            this.SetModelProperty("Type", seriesType);
            /// This doesn't quite work yet. If the previous series was a scatter plot, there is no x2, y2 to work with
            /// and things go a bit awry.
            /// this.seriesView.ShowX2Y2(series.Type == SeriesType.Area);
        }
Exemplo n.º 21
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 /// <param name="index">Index position on the chart of the series</param>
 public Series(string name, SeriesType type, int index)
 {
     Name                = name;
     SeriesType          = type;
     Index               = index;
     Unit                = "$";
     Color               = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.Circle;
 }
Exemplo n.º 22
0
        public double GetSeriesMovingAverageValue(
            MarketSeries marketSeries, SeriesType seriesType, int periods, MovingAverageType type, int index)
        {
            DataSeries series = marketSeries.GetSeries(seriesType);

            MovingAverage ma = _algo.Indicators.MovingAverage(series, periods, type);

            return(ma.Result[index]);
        }
Exemplo n.º 23
0
        public SeriesBuilder WithIndividualValueSet(SeriesType seriesType, IEnumerable <dynamic> values, int startIndex, int endIndex)
        {
            this.series.ValueSets.Add(
                new IndividualValueSetBuilder(seriesType, values)
                .WithStartIndex(startIndex)
                .WithEndIndex(endIndex)
                .Build());

            return(this);
        }
Exemplo n.º 24
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 /// <param name="type">Type of the chart series</param>
 /// <param name="unit">Unit of the serier</param>
 /// <param name="color">Color of the series</param>
 /// <param name="symbol">Symbol for the marker in a scatter plot series</param>
 public Series(string name, SeriesType type, string unit, Color color, ScatterMarkerSymbol symbol = ScatterMarkerSymbol.None)
 {
     Name                = name;
     Values              = new List <ChartPoint>();
     SeriesType          = type;
     Unit                = unit;
     Index               = 0;
     Color               = color;
     ScatterMarkerSymbol = symbol;
 }
Exemplo n.º 25
0
        public void AddDataSeries(string name, Color color, SeriesType type, int width, bool updateYRange)
        {
            DataSeries dataSeries = new DataSeries();

            dataSeries.color        = color;
            dataSeries.type         = type;
            dataSeries.width        = width;
            dataSeries.updateYRange = updateYRange;
            seriesTable.Add(name, dataSeries);
        }
Exemplo n.º 26
0
 protected override void Sample(string chartName,
                                string seriesName,
                                int seriesIndex,
                                SeriesType seriesType,
                                DateTime time,
                                decimal value,
                                string unit = "$")
 {
     throw new NotImplementedException();
 }
Exemplo n.º 27
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 /// <param name="type">Type of the chart series</param>
 /// <param name="unit">Unit of the serier</param>
 public Series(string name, SeriesType type = SeriesType.Line, string unit = "$")
 {
     Name                = name;
     Values              = new List <ChartPoint>();
     SeriesType          = type;
     Unit                = unit;
     Index               = 0;
     Color               = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.None;
 }
        public static void DefineChartMeasureType(this Measure m, SeriesType type)
        {
            var ch2 = m.Grid as OlapChart;

            if (ch2 != null)
            {
                ch2.chartDefinitions.MeasureTypes.Remove(m);
                ch2.chartDefinitions.MeasureTypes.Add(m, type);
            }
        }
        public static void DefineChartMeasureType(this Measure m, SeriesType type, bool showPointOnLines)
        {
            DefineChartMeasureType(m, type);
            var ch2 = m.Grid as OlapChart;

            if (ch2 != null)
            {
                ch2.chartDefinitions.ShowPointsOnLines = showPointOnLines;
            }
        }
 public SeriesViewModel(string name, SeriesType type, string argumentName, string valueName, LegendViewModel legend, PaneViewModel pane, YAxisViewModel yAxis)
 {
     this.Name         = name;
     this.Type         = type;
     this.ArgumentName = argumentName;
     this.ValueName    = valueName;
     this.Legend       = legend;
     this.Pane         = pane;
     this.YAxis        = yAxis;
 }
Exemplo n.º 31
0
        protected virtual void ProcessLiveFeedDataAsync(LiveFeedData liveFeedData)
        {
            try
            {
                if (_verbose)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append($"Elapsed:{liveFeedData.Elapsed} ");
                    sb.Append($"SeriesId:{liveFeedData.SeriesType} ");
                    sb.Append($"RaceId:{liveFeedData.RaceId} ");
                    sb.AppendLine($"RunId:{liveFeedData.RunId}");
                    sb.Append($"LapNumber:{liveFeedData.LapNumber} ");
                    sb.AppendLine($"FlagState:{liveFeedData.FlagState.ToString()}");

                    Console.WriteLine("------------------");
                    Console.WriteLine(sb);
                }

                if (liveFeedData.RaceId != _lastRaceId ||
                    liveFeedData.SeriesType != _lastSeriesId ||
                    liveFeedData.RunId != _lastRunId)
                {
                    if (_verbose)
                    {
                        Console.WriteLine("Resetting lap times");
                    }

                    ResetLapTimes();

                    _lapTimes.RaceId    = liveFeedData.RaceId;
                    _lapTimes.SeriesId  = (int)liveFeedData.SeriesType;
                    _lapTimes.RunId     = liveFeedData.RunId;
                    _lapTimes.Elapsed   = liveFeedData.Elapsed;
                    _lapTimes.TrackName = liveFeedData.TrackName;
                    _lapTimes.RunName   = liveFeedData.RunName;
                }

                _lapTimes = ReadLapTimes(liveFeedData);

                if (liveFeedData.Elapsed != _lastElapsed)
                {
                    OnLapTimesUpdated(_lapTimes);

                    _lastElapsed  = liveFeedData.Elapsed;
                    _lastRaceId   = liveFeedData.RaceId;
                    _lastSeriesId = liveFeedData.SeriesType;
                    _lastRunId    = liveFeedData.RunId;
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error pumping lap times", ex);
            }
        }
Exemplo n.º 32
0
        public ChartPanel(ChartOptions options)
        {
            this.SeriesType = options.SeriesType;
            this.IndicatorType = options.IndicatorType;
            this.ChartDrawing = ChartDrawingHelper.GetChartDrawing(SeriesType, IndicatorType);
            this.ChartData = options.ChartData;
            this.ChartStyle = options.ChartStyle;

            if (this.ChartStyle == null)
                this.ChartStyle = new DefaultChartStyle();

            SizeChanged += ChartPanel_SizeChanged;
        }
		public override void LoadView ()
		{
			// Create a chart view that will display the chart.
			m_view = new NChartView ();

			// Paste your license key here.
			m_view.Chart.LicenseKey = "";

			// Switch this field to view all types of series.
			type = SeriesType.Column2D;

			// Switch on antialiasing.
			m_view.Chart.ShouldAntialias = true;

			if (type >= SeriesType.Column3D) {
				// Switch 3D on.
				m_view.Chart.DrawIn3D = true;
				// Margin to ensure some free space for the iOS status bar and Y-Axis tick titles.
				m_view.Chart.CartesianSystem.Margin = new NChartMargin (50.0f, 50.0f, 10.0f, 20.0f);
				m_view.Chart.PolarSystem.Margin = new NChartMargin (50.0f, 50.0f, 10.0f, 20.0f);
			} else {
				// Margin to ensure some free space for the iOS status bar.
				m_view.Chart.CartesianSystem.Margin = new NChartMargin (10.0f, 10.0f, 10.0f, 20.0f);
				m_view.Chart.PolarSystem.Margin = new NChartMargin (10.0f, 10.0f, 10.0f, 20.0f);
			}

			// Set data source for the size axis to provide sizes for bubbles.
			m_view.Chart.SizeAxis.DataSource = this;

			// Create series that will be displayed on the chart.
			CreateSeries ();

			// Update data in the chart.
			m_view.Chart.UpdateData ();

			// Set chart view to the controller.
			this.View = m_view;
		}
Exemplo n.º 34
0
		public void AddChartPoint( SeriesType Type, double X, double Y )
		{
			NetworkChart.Series[ (int)Type ].Points.AddXY( X, Y );
		}
Exemplo n.º 35
0
 /// <summary>
 /// Add data series to the chart.
 /// </summary>
 /// 
 /// <param name="name">Data series name.</param>
 /// <param name="color">Data series color.</param>
 /// <param name="type">Data series type.</param>
 /// <param name="width">Width (depends on the data series type, see remarks).</param>
 /// <param name="updateYRange">Specifies if <see cref="RangeY"/> should be updated.</param>
 /// 
 /// <remarks><para>Adds new empty data series to the collection of data series.</para>
 /// 
 /// <para>The <b>updateYRange</b> parameter specifies if the data series may affect displayable
 /// Y range. If the value is set to false, then displayable Y range is not updated, but used the
 /// range, which was specified by user (see <see cref="RangeY"/> property). In the case if the
 /// value is set to true, the displayable Y range is recalculated to fully fit the new data
 /// series.</para>
 /// </remarks>
 /// 
 public void AddDataSeries( string name, Color color, SeriesType type, int width, bool updateYRange )
 {
     // create new series definition ...
     DataSeries	series = new DataSeries( );
     // ... add fill it
     series.color = color;
     series.type = type;
     series.width = width;
     series.updateYRange = updateYRange;
     // add to series table
     seriesTable.Add( name, series );
 }
Exemplo n.º 36
0
        /// <summary>
        /// Add a sample to the chart specified by the chartName, and seriesName.
        /// </summary>
        /// <param name="chartName">String chart name to place the sample.</param>
        /// <param name="chartType">Type of chart we should create if it doesn't already exist.</param>
        /// <param name="seriesName">Series name for the chart.</param>
        /// <param name="seriesType">Series type for the chart.</param>
        /// <param name="time">Time for the sample</param>
        /// <param name="unit">Unit of the sample</param>
        /// <param name="value">Value for the chart sample.</param>
        public void Sample(string chartName, ChartType chartType, string seriesName, SeriesType seriesType, DateTime time, decimal value, string unit = "$")
        {
            lock (_chartLock)
            {
                //Add a copy locally:
                if (!Charts.ContainsKey(chartName))
                {
                    Charts.AddOrUpdate(chartName, new Chart(chartName, chartType));
                }

                //Add the sample to our chart:
                if (!Charts[chartName].Series.ContainsKey(seriesName))
                {
                    Charts[chartName].Series.Add(seriesName, new Series(seriesName, seriesType, unit));
                }

                //Add our value:
                Charts[chartName].Series[seriesName].Values.Add(new ChartPoint(time, value));
            }
        }
Exemplo n.º 37
0
        /// <summary>
        /// Add a sample to the chart specified by the chartName, and seriesName.
        /// </summary>
        /// <param name="chartName">String chart name to place the sample.</param>
        /// <param name="seriesName">Series name for the chart.</param>
        /// <param name="seriesType">Series type for the chart.</param>
        /// <param name="time">Time for the sample</param>
        /// <param name="value">Value for the chart sample.</param>
        /// <param name="unit">Unit for the sample axis</param>
        /// <param name="seriesIndex">Index of the series we're sampling</param>
        /// <remarks>Sample can be used to create new charts or sample equity - daily performance.</remarks>
        public void Sample(string chartName, string seriesName, int seriesIndex, SeriesType seriesType, DateTime time, decimal value, string unit = "$")
        {
            var chartFilename = Path.Combine(_chartDirectory, chartName + "-" + seriesName + ".csv");

            lock (_chartLock)
            {
                // Add line to list in dictionary, will be written to file at the end
                List<string> rows;
                if (!_equityResults.TryGetValue(chartFilename, out rows))
                {
                    rows = new List<string>();
                    _equityResults[chartFilename] = rows;
                }
                rows.Add(time + "," + value.ToString("F2", CultureInfo.InvariantCulture));

                //Add a copy locally:
                if (!Charts.ContainsKey(chartName))
                {
                    Charts.AddOrUpdate(chartName, new Chart(chartName));
                }

                //Add the sample to our chart:
                if (!Charts[chartName].Series.ContainsKey(seriesName))
                {
                    Charts[chartName].Series.Add(seriesName, new Series(seriesName, seriesType, seriesIndex, unit));
                }

                //Add our value:
                Charts[chartName].Series[seriesName].Values.Add(new ChartPoint(time, value));
            }
        }
Exemplo n.º 38
0
 /// <summary>
 /// Agregado de una serie al grafico
 /// </summary>
 public void AddDataSeries(string name, Color color, SeriesType type, int width)
 {
     DataSeries series = new DataSeries();
     series.color = color;
     series.type = type;
     series.width = width;
     seriesTable.Add(name, series);
 }
Exemplo n.º 39
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 /// <param name="index">Index position on the chart of the series</param>
 public Series(string name, SeriesType type, int index)
 {
     Name = name;
     SeriesType = type;
     Index = index;
     Unit = "$";
     Color = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.None;
 }
Exemplo n.º 40
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 /// <param name="index">Index position on the chart of the series</param>
 /// <param name="unit">Unit for the series axis</param>
 public Series(string name, SeriesType type, int index, string unit)
 {
     Name = name;
     SeriesType = type;
     Index = index;
     Unit = unit;
 }
Exemplo n.º 41
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 /// <param name="type">Type of the chart series</param>
 public Series(string name, SeriesType type = SeriesType.Line)
 {
     this.Name = name;
     this.Values = new List<ChartPoint>();
     this.SeriesType = type;
 }
Exemplo n.º 42
0
        /// <summary>
        /// Add a sample to the chart specified by the chartName, and seriesName.
        /// </summary>
        /// <param name="chartName">String chart name to place the sample.</param>
        /// <param name="chartType">Type of chart we should create if it doesn't already exist.</param>
        /// <param name="seriesName">Series name for the chart.</param>
        /// <param name="seriesType">Series type for the chart.</param>
        /// <param name="time">Time for the sample</param>
        /// <param name="value">Value for the chart sample.</param>
        /// <param name="unit">Unit for the chart axis</param>
        /// <remarks>Sample can be used to create new charts or sample equity - daily performance.</remarks>
        public void Sample(string chartName, string seriesName, int seriesIndex, SeriesType seriesType, DateTime time, decimal value, string unit = "$")
        {
            Log.Debug("LiveTradingResultHandler.Sample(): Sampling " + chartName + "." + seriesName);
            lock (_chartLock)
            {
                //Add a copy locally:
                if (!Charts.ContainsKey(chartName))
                {
                    Charts.AddOrUpdate(chartName, new Chart(chartName));
                }

                //Add the sample to our chart:
                if (!Charts[chartName].Series.ContainsKey(seriesName))
                {
                    Charts[chartName].Series.Add(seriesName, new Series(seriesName, seriesType, seriesIndex, unit));
                }

                //Add our value:
                Charts[chartName].Series[seriesName].Values.Add(new ChartPoint(time, value));
            }
            Log.Debug("LiveTradingResultHandler.Sample(): Done sampling " + chartName + "." + seriesName);
        }
Exemplo n.º 43
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 /// <param name="type">Type of the chart series</param>
 /// <param name="unit">Unit of the serier</param>
 public Series(string name, SeriesType type = SeriesType.Line, string unit = "$")
 {
     Name = name;
     Values = new List<ChartPoint>();
     SeriesType = type;
     Unit = unit;
 }
Exemplo n.º 44
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 public Series(string name, SeriesType type)
 {
     Name = name;
     SeriesType = type;
     Index = 0;
     Unit = "$";
 }
Exemplo n.º 45
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 public Series(string name)
 {
     Name = name;
     SeriesType = SeriesType.Line;
     Unit = "$";
     Index = 0;
     Color = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.Circle;
 }
Exemplo n.º 46
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 public Series(string name)
 {
     Name = name;
     SeriesType = SeriesType.Line;
     Unit = "$";
     Index = 0;
 }
Exemplo n.º 47
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 public Series(string name, SeriesType type)
 {
     Name = name;
     SeriesType = type;
     Index = 0;
     Unit = "$";
     Color = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.Circle;
 }
Exemplo n.º 48
0
 private void SetInnerType(SeriesType ContentField) {
     this.ContentField = ((SeriesType)(XTypedServices.GetCloneIfRooted(ContentField)));
     XTypedServices.SetName(this, this.ContentField);
 }
Exemplo n.º 49
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 /// <param name="index">Index position on the chart of the series</param>
 /// <param name="unit">Unit for the series axis</param>
 public Series(string name, SeriesType type, int index, string unit)
 {
     Name = name;
     SeriesType = type;
     Index = index;
     Unit = unit;
     Color = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.Circle;
 }
Exemplo n.º 50
0
 /// <summary>
 /// Add data series to the chart.
 /// </summary>
 /// 
 /// <param name="name">Data series name.</param>
 /// <param name="color">Data series color.</param>
 /// <param name="type">Data series type.</param>
 /// <param name="width">Width (depends on the data series type, see remarks).</param>
 /// 
 /// <remarks><para>Adds new empty data series to the collection of data series. To update this
 /// series the <see cref="UpdateDataSeries"/> method should be used.</para>
 /// 
 /// <para>The meaning of the width parameter depends on the data series type:
 /// <list type="bullet">
 /// <item><b>Line</b> - width of the line;</item>
 /// <item><b>Dots</b> - size of dots (rectangular dots with specified width and the same height);</item>
 /// <item><b>Connected dots</b> - size of dots (dots are connected with one pixel width line).</item>
 /// </list>
 /// </para>
 /// </remarks>
 /// 
 public void AddDataSeries( string name, Color color, SeriesType type, int width )
 {
     AddDataSeries( name, color, type, width, true );
 }
Exemplo n.º 51
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 /// <param name="type">Type of the chart series</param>
 /// <param name="unit">Unit of the serier</param>
 public Series(string name, SeriesType type = SeriesType.Line, string unit = "$")
 {
     Name = name;
     Values = new List<ChartPoint>();
     SeriesType = type;
     Unit = unit;
     Index = 0;
     Color = Color.Empty;
     ScatterMarkerSymbol = ScatterMarkerSymbol.Circle;
 }
Exemplo n.º 52
0
 /// <summary>
 /// <para>
 /// SeriesType acts as a structural base, which is extended through the addition of attributes to reflect the particular needs of a specific key family using the xs:extends element.
 /// </para>
 /// </summary>
 public Series(SeriesType content) {
     SetInnerType(content);
 }
Exemplo n.º 53
0
		protected void RegisterChartSeries( SeriesType Type, string FriendlyName, bool bEnabled )
		{
			NetworkChart.Series.Add( new Series( Type.ToString() ) );

			Debug.Assert( NetworkChart.Series[( int )Type].Name == Type.ToString() );

			NetworkChart.Series[( int )Type].XValueType = ChartValueType.Int32;
			NetworkChart.Series[( int )Type].Font = new System.Drawing.Font( "Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ( ( byte )( 0 ) ) );
			NetworkChart.Series[( int )Type].Legend = "DefaultLegend";
			NetworkChart.Series[( int )Type].ChartArea = "DefaultChartArea";

			ChartListBox.Items.Add( FriendlyName );

			Debug.Assert( ChartListBox.Items.Count - 1 == ( int )Type );

			UpdateChartSeries( Type, SeriesChartType.FastLine, bEnabled );
		}
Exemplo n.º 54
0
 /// <summary>
 /// Constructor method for Chart Series
 /// </summary>
 /// <param name="name">Name of the chart series</param>
 /// <param name="type">Type of the chart series</param>
 /// <param name="unit">Unit of the serier</param>
 /// <param name="color">Color of the series</param>
 /// <param name="symbol">Symbol for the marker in a scatter plot series</param>
 public Series(string name, SeriesType type, string unit, Color color, ScatterMarkerSymbol symbol = ScatterMarkerSymbol.Circle)
 {
     Name = name;
     Values = new List<ChartPoint>();
     SeriesType = type;
     Unit = unit;
     Index = 0;
     Color = color;
     ScatterMarkerSymbol = symbol;
 }
Exemplo n.º 55
0
		protected void UpdateChartSeries( SeriesType Type, SeriesChartType ChartType, bool bEnabled )
		{
			NetworkChart.Series[( int )Type].ChartType = ChartType;
			NetworkChart.Series[( int )Type].Enabled = bEnabled;
			ChartListBox.SetItemChecked( ( int )Type, bEnabled );
		}
Exemplo n.º 56
0
 /// <summary>
 /// Foundational constructor on the series class
 /// </summary>
 /// <param name="name">Name of the series</param>
 /// <param name="type">Type of the series</param>
 /// <param name="index">Index position on the chart of the series</param>
 public Series(string name, SeriesType type, int index)
 {
     Name = name;
     SeriesType = type;
     Index = index;
     Unit = "$";
 }
Exemplo n.º 57
0
		private void LoadView ()
		{
			// Paste your license key here.
			mNChartView.Chart.LicenseKey = "";

			// Create brushes.
			brushes = new NChartBrush[3];
			brushes [0] = new NChartSolidColorBrush (Color.Argb (255, (int)(0.38 * 255), (int)(0.8 * 255), (int)(0.91 * 255)));
			brushes [1] = new NChartSolidColorBrush (Color.Argb (255, (int)(0.8 * 255), (int)(0.86 * 255), (int)(0.22 * 255)));
			brushes [2] = new NChartSolidColorBrush (Color.Argb (255, (int)(0.9 * 255), (int)(0.29 * 255), (int)(0.51 * 255)));

			// Switch this field to view all types of series.
			type = SeriesType.Column2D;

			// Switch on antialiasing.
			mNChartView.Chart.ShouldAntialias = true;

			if (type >= SeriesType.Column3D) {
				// Switch 3D on.
				mNChartView.Chart.DrawIn3D = true;
				mNChartView.Chart.CartesianSystem.Margin = new NChartTypes.Margin (50.0f, 50.0f, 10.0f, 20.0f);
				mNChartView.Chart.PolarSystem.Margin = new NChartTypes.Margin (50.0f, 50.0f, 10.0f, 20.0f);
			} else {
				mNChartView.Chart.CartesianSystem.Margin = new NChartTypes.Margin (10.0f, 10.0f, 10.0f, 20.0f);
				mNChartView.Chart.PolarSystem.Margin = new NChartTypes.Margin (10.0f, 10.0f, 10.0f, 20.0f);
			}

			// Set data source for the size axis to provide sizes for bubbles.
			mNChartView.Chart.SizeAxis.DataSource = this;

			// Create series that will be displayed on the chart.
			CreateSeries ();

			// Update data in the chart.
			mNChartView.Chart.UpdateData ();
		}