/// <summary> /// /// </summary> public bool AddReplaceDataSeries(string areaName, string seriesName, SeriesDataLineType lineType, double[][] valuesArrays) { if (GetSeriesDataByName(seriesName) != null) { this.RemoveDataSeries(seriesName); } return(AddDataSeries(areaName, seriesName, lineType, valuesArrays, false)); }
/// <summary> /// If no area with this name exists, a new one will be created. /// Keep in mind that all data series must have equal sizes, otherwise problems occur on having zoom. /// </summary> bool AddDataSeries(string areaName, string seriesName, SeriesDataLineType lineType, double[][] valuesArrays, bool graphicalSeries) { if (GetSeriesDataByName(seriesName) != null) { System.Diagnostics.Debug.Fail("Data series already exists."); return false; } // We need to make sure all the sizes are equal. foreach (double[] doubleArray in valuesArrays) { int longestDataSize = this.LongestDataSize; if (doubleArray.Length != longestDataSize && longestDataSize != 0) {// We have a problem, deny adding this series. System.Diagnostics.Debug.Fail("Data series size is wrong."); return false; } } ChartArea chartArea = GetChartAreaByName(areaName); if (chartArea == null) { CreateNewChartArea(areaName); chartArea = GetChartAreaByName(areaName); } chartArea.AxisX.Margin = false; //chartArea.AxisX.Minimum = 50; SeriesData seriesData = new SeriesData(); seriesData.IsGraphical = graphicalSeries; seriesData.ValuesArrays = valuesArrays; seriesData.SeriesName = seriesName; seriesData.ChartAreaName = areaName; _seriesDatas.Add(seriesData); { Series series = this.chartMain.Series.Add(seriesName); series.ChartArea = areaName; if (lineType == SeriesDataLineType.Custom_FatLine) { series.BorderWidth = 3; series.ChartType = "Line"; } else { series.ChartType = lineType.ToString(); } series.Name = seriesName; series.ShowInLegend = false; series.ShadowOffset = 0; // We need to call this in order to have the colors properly applied to this new series. this.chartMain.ApplyPaletteColors(); CreateSeriesLegendItem(series); } UpdateCharts(); return true; }
/// <summary> /// /// </summary> public bool AddReplaceDataSeries(string areaName, string seriesName, SeriesDataLineType lineType, double[][] valuesArrays) { if (GetSeriesDataByName(seriesName) != null) { this.RemoveDataSeries(seriesName); } return AddDataSeries(areaName, seriesName, lineType, valuesArrays, false); }
/// <summary> /// Add typical the data series to specified area. /// </summary> public bool AddDataSeries(string areaName, string seriesName, SeriesDataLineType lineType, double[][] valuesArrays) { return AddDataSeries(areaName, seriesName, lineType, valuesArrays, false); }
/// <summary> /// Add typical the data series to the default area. /// </summary> public bool AddDataSeries(string seiesName, SeriesDataLineType lineType, double[][] valuesArrays) { return AddDataSeries(MainChartArea.Name, seiesName, lineType, valuesArrays, false); }
/// <summary> /// If no area with this name exists, a new one will be created. /// Keep in mind that all data series must have equal sizes, otherwise problems occur on having zoom. /// </summary> bool AddDataSeries(string areaName, string seriesName, SeriesDataLineType lineType, double[][] valuesArrays, bool graphicalSeries) { if (GetSeriesDataByName(seriesName) != null) { System.Diagnostics.Debug.Fail("Data series already exists."); return(false); } // We need to make sure all the sizes are equal. foreach (double[] doubleArray in valuesArrays) { int longestDataSize = this.LongestDataSize; if (doubleArray.Length != longestDataSize && longestDataSize != 0) {// We have a problem, deny adding this series. System.Diagnostics.Debug.Fail("Data series size is wrong."); return(false); } } ChartArea chartArea = GetChartAreaByName(areaName); if (chartArea == null) { CreateNewChartArea(areaName); chartArea = GetChartAreaByName(areaName); } chartArea.AxisX.Margin = false; //chartArea.AxisX.Minimum = 50; SeriesData seriesData = new SeriesData(); seriesData.IsGraphical = graphicalSeries; seriesData.ValuesArrays = valuesArrays; seriesData.SeriesName = seriesName; seriesData.ChartAreaName = areaName; _seriesDatas.Add(seriesData); { Series series = this.chartMain.Series.Add(seriesName); series.ChartArea = areaName; if (lineType == SeriesDataLineType.Custom_FatLine) { series.BorderWidth = 3; series.ChartType = "Line"; } else { series.ChartType = lineType.ToString(); } series.Name = seriesName; series.ShowInLegend = false; series.ShadowOffset = 0; // We need to call this in order to have the colors properly applied to this new series. this.chartMain.ApplyPaletteColors(); CreateSeriesLegendItem(series); } UpdateCharts(); return(true); }
/// <summary> /// Add typical the data series to specified area. /// </summary> public bool AddDataSeries(string areaName, string seriesName, SeriesDataLineType lineType, double[][] valuesArrays) { return(AddDataSeries(areaName, seriesName, lineType, valuesArrays, false)); }
/// <summary> /// Add typical the data series to the default area. /// </summary> public bool AddDataSeries(string seiesName, SeriesDataLineType lineType, double[][] valuesArrays) { return(AddDataSeries(MainChartArea.Name, seiesName, lineType, valuesArrays, false)); }