/// <summary> /// Plot a specific data series as a line chart on the secondary axes. If there are no primary axes, it will be plotted on the primary axes instead. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> /// <param name="WithMarkers">True to display markers. False otherwise.</param> /// <param name="Options">Chart customization options.</param> public void PlotDataSeriesAsSecondaryLineChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType, bool WithMarkers, SLLineChartOptions Options) { this.PlotDataSeriesAsLineChart(DataSeriesIndex, DisplayType, WithMarkers, Options, false); }
private void PlotDataSeriesAsLineChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType, bool WithMarkers, SLLineChartOptions Options, bool IsPrimary) { // the original chart is not combinable if (!this.IsCombinable) return; int index = DataSeriesIndex - 1; // out of bounds if (index < 0 || index >= this.PlotArea.DataSeries.Count) return; // is primary, no primary axes -> set primary axes // is primary, has primary axes -> do nothing // is secondary, no primary axes -> set primary axes, force as primary // is secondary, has primary axes, no secondary axes -> set secondary axes // is secondary, has primary axes, has secondary axes -> do nothing bool bIsPrimary = IsPrimary; if (!this.PlotArea.HasPrimaryAxes) { // no primary axes in the first place, so force primary axes bIsPrimary = true; this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisType = SLAxisType.Category; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryTextAxis.CrossBetween = C.CrossBetweenValues.Between; this.PlotArea.PrimaryValueAxis.CrossBetween = C.CrossBetweenValues.Between; } else if (!bIsPrimary && this.PlotArea.HasPrimaryAxes && !this.PlotArea.HasSecondaryAxes) { this.PlotArea.HasSecondaryAxes = true; this.PlotArea.SecondaryTextAxis.AxisType = SLAxisType.Category; this.PlotArea.SecondaryTextAxis.AxisPosition = this.HasShownSecondaryTextAxis ? C.AxisPositionValues.Top : C.AxisPositionValues.Bottom; this.PlotArea.SecondaryValueAxis.AxisPosition = C.AxisPositionValues.Right; this.PlotArea.SecondaryTextAxis.CrossBetween = C.CrossBetweenValues.Between; this.PlotArea.SecondaryValueAxis.CrossBetween = C.CrossBetweenValues.Between; } SLDataSeriesChartType vType = bIsPrimary ? SLDataSeriesChartType.LineChartPrimary : SLDataSeriesChartType.LineChartSecondary; int iChartType = (int)vType; if (this.PlotArea.UsedChartTypes[iChartType]) { // the chart is already used. if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); } else { this.PlotArea.UsedChartTypes[iChartType] = true; switch (DisplayType) { case SLChartDataDisplayType.Normal: this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.Standard; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); if (!WithMarkers) this.PlotArea.DataSeries[index].Options.Marker.Symbol = C.MarkerStyleValues.None; break; case SLChartDataDisplayType.Stacked: this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); if (!WithMarkers) this.PlotArea.DataSeries[index].Options.Marker.Symbol = C.MarkerStyleValues.None; break; case SLChartDataDisplayType.StackedMax: this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); if (!WithMarkers) this.PlotArea.DataSeries[index].Options.Marker.Symbol = C.MarkerStyleValues.None; break; } this.PlotArea.DataSeries[index].ChartType = vType; } }
private void PlotDataSeriesAsBarChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType, SLBarChartOptions Options, bool IsPrimary, bool IsBar) { // the original chart is not combinable if (!this.IsCombinable) return; int index = DataSeriesIndex - 1; // out of bounds if (index < 0 || index >= this.PlotArea.DataSeries.Count) return; // is primary, no primary axes -> set primary axes // is primary, has primary axes -> do nothing // is secondary, no primary axes -> set primary axes, force as primary // is secondary, has primary axes, no secondary axes -> set secondary axes // is secondary, has primary axes, has secondary axes -> do nothing bool bIsPrimary = IsPrimary; if (!this.PlotArea.HasPrimaryAxes) { // no primary axes in the first place, so force primary axes bIsPrimary = true; this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisType = SLAxisType.Category; if (IsBar) { this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; } else { this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Left; } this.PlotArea.PrimaryTextAxis.CrossBetween = C.CrossBetweenValues.Between; this.PlotArea.PrimaryValueAxis.CrossBetween = C.CrossBetweenValues.Between; } else if (!bIsPrimary && this.PlotArea.HasPrimaryAxes && !this.PlotArea.HasSecondaryAxes) { this.PlotArea.HasSecondaryAxes = true; this.PlotArea.SecondaryTextAxis.AxisType = SLAxisType.Category; if (IsBar) { this.PlotArea.SecondaryTextAxis.AxisPosition = this.HasShownSecondaryTextAxis ? C.AxisPositionValues.Right : C.AxisPositionValues.Left; this.PlotArea.SecondaryValueAxis.AxisPosition = C.AxisPositionValues.Top; } else { this.PlotArea.SecondaryTextAxis.AxisPosition = this.HasShownSecondaryTextAxis ? C.AxisPositionValues.Top : C.AxisPositionValues.Bottom; this.PlotArea.SecondaryValueAxis.AxisPosition = C.AxisPositionValues.Right; } this.PlotArea.SecondaryTextAxis.CrossBetween = C.CrossBetweenValues.Between; this.PlotArea.SecondaryValueAxis.CrossBetween = C.CrossBetweenValues.Between; } SLDataSeriesChartType vType = SLDataSeriesChartType.BarChartBarPrimary; if (bIsPrimary) { if (IsBar) vType = SLDataSeriesChartType.BarChartBarPrimary; else vType = SLDataSeriesChartType.BarChartColumnPrimary; } else { if (IsBar) vType = SLDataSeriesChartType.BarChartBarSecondary; else vType = SLDataSeriesChartType.BarChartColumnSecondary; } int iChartType = (int)vType; if (this.PlotArea.UsedChartTypes[iChartType]) { // the chart is already used. if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); } else { this.PlotArea.UsedChartTypes[iChartType] = true; switch (DisplayType) { case SLChartDataDisplayType.Normal: this.PlotArea.UsedChartOptions[iChartType].BarDirection = IsBar ? C.BarDirectionValues.Bar : C.BarDirectionValues.Column; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Clustered; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); break; case SLChartDataDisplayType.Stacked: this.PlotArea.UsedChartOptions[iChartType].BarDirection = IsBar ? C.BarDirectionValues.Bar : C.BarDirectionValues.Column; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].Overlap = 100; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); break; case SLChartDataDisplayType.StackedMax: this.PlotArea.UsedChartOptions[iChartType].BarDirection = IsBar ? C.BarDirectionValues.Bar : C.BarDirectionValues.Column; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].Overlap = 100; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); break; } this.PlotArea.DataSeries[index].ChartType = vType; } }
/// <summary> /// Plot a specific data series as a line chart on the primary axes. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> /// <param name="WithMarkers">True to display markers. False otherwise.</param> public void PlotDataSeriesAsPrimaryLineChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType, bool WithMarkers) { this.PlotDataSeriesAsLineChart(DataSeriesIndex, DisplayType, WithMarkers, null, true); }
/// <summary> /// Plot a specific data series as a bar chart on the secondary axes. If there are no primary axes, it will be plotted on the primary axes instead. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> public void PlotDataSeriesAsSecondaryBarChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType) { this.PlotDataSeriesAsBarChart(DataSeriesIndex, DisplayType, null, false, true); }
/// <summary> /// Plot a specific data series as a bar chart on the secondary axes. If there are no primary axes, it will be plotted on the primary axes instead. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> /// <param name="Options">Chart customization options.</param> public void PlotDataSeriesAsSecondaryBarChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType, SLBarChartOptions Options) { this.PlotDataSeriesAsBarChart(DataSeriesIndex, DisplayType, Options, false, true); }
/// <summary> /// Plot a specific data series as a column chart on the primary axes. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> /// <param name="Options">Chart customization options.</param> public void PlotDataSeriesAsPrimaryColumnChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType, SLBarChartOptions Options) { this.PlotDataSeriesAsBarChart(DataSeriesIndex, DisplayType, Options, true, false); }
/// <summary> /// Plot a specific data series as a column chart on the primary axes. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> public void PlotDataSeriesAsPrimaryColumnChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType) { this.PlotDataSeriesAsBarChart(DataSeriesIndex, DisplayType, null, true, false); }
/// <summary> /// Plot a specific data series as an area chart on the secondary axes. If there are no primary axes, it will be plotted on the primary axes instead. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> /// <param name="Options">Chart customization options.</param> public void PlotDataSeriesAsSecondaryAreaChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType, SLAreaChartOptions Options) { this.PlotDataSeriesAsAreaChart(DataSeriesIndex, DisplayType, Options, false); }
/// <summary> /// Plot a specific data series as an area chart on the primary axes. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> /// <param name="Options">Chart customization options.</param> public void PlotDataSeriesAsPrimaryAreaChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType, SLAreaChartOptions Options) { this.PlotDataSeriesAsAreaChart(DataSeriesIndex, DisplayType, Options, true); }
/// <summary> /// Plot a specific data series as an area chart on the primary axes. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution. /// </summary> /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param> /// <param name="DisplayType">Chart display type. This corresponds to the 3 typical types in most charts: normal (or clustered), stacked and 100% stacked.</param> public void PlotDataSeriesAsPrimaryAreaChart(int DataSeriesIndex, SLChartDataDisplayType DisplayType) { this.PlotDataSeriesAsAreaChart(DataSeriesIndex, DisplayType, null, true); }