internal SLLineChartOptions Clone() { SLLineChartOptions lco = new SLLineChartOptions(); lco.iGapDepth = this.iGapDepth; lco.Smooth = this.Smooth; return lco; }
internal void MergeOptions(SLLineChartOptions lco) { this.GapDepth = lco.GapDepth; this.HasDropLines = lco.HasDropLines; this.DropLines = lco.DropLines.Clone(); this.HasHighLowLines = lco.HasHighLowLines; this.HighLowLines = lco.HighLowLines.Clone(); this.HasUpDownBars = lco.HasUpDownBars; this.UpDownBars = lco.UpDownBars.Clone(); this.Smooth = lco.Smooth; }
/// <summary> /// Clone an instance of SLLineChartOptions. /// </summary> /// <returns>An SLLineChartOptions object.</returns> public SLLineChartOptions Clone() { SLLineChartOptions lco = new SLLineChartOptions(); lco.iGapDepth = this.iGapDepth; lco.HasDropLines = this.HasDropLines; lco.DropLines = this.DropLines.Clone(); lco.HasHighLowLines = this.HasHighLowLines; lco.HighLowLines = this.HighLowLines.Clone(); lco.HasUpDownBars = this.HasUpDownBars; lco.UpDownBars = this.UpDownBars.Clone(); lco.Smooth = this.Smooth; return(lco); }
internal void MergeOptions(SLLineChartOptions lco) { this.GapDepth = lco.GapDepth; this.Smooth = lco.Smooth; }
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; } }
/// <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); }
/// <summary> /// Set a line chart using one of the built-in line chart types. /// </summary> /// <param name="ChartType">A built-in line chart type.</param> /// <param name="Options">Chart customization options.</param> public void SetChartType(SLLineChartType ChartType, SLLineChartOptions Options) { this.Is3D = SLChartTool.Is3DChart(ChartType); SLDataSeriesChartType vType; int iChartType; switch (ChartType) { case SLLineChartType.Line: vType = SLDataSeriesChartType.LineChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.Standard; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; this.PlotArea.UsedChartOptions[iChartType].Smooth = false; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); foreach (SLDataSeries ds in this.PlotArea.DataSeries) { ds.Options.Marker.Symbol = C.MarkerStyleValues.None; } this.PlotArea.HasPrimaryAxes = true; break; case SLLineChartType.StackedLine: vType = SLDataSeriesChartType.LineChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; this.PlotArea.UsedChartOptions[iChartType].Smooth = false; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); foreach (SLDataSeries ds in this.PlotArea.DataSeries) { ds.Options.Marker.Symbol = C.MarkerStyleValues.None; } this.PlotArea.HasPrimaryAxes = true; break; case SLLineChartType.StackedLineMax: vType = SLDataSeriesChartType.LineChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; this.PlotArea.UsedChartOptions[iChartType].Smooth = false; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); foreach (SLDataSeries ds in this.PlotArea.DataSeries) { ds.Options.Marker.Symbol = C.MarkerStyleValues.None; } this.PlotArea.HasPrimaryAxes = true; break; case SLLineChartType.LineWithMarkers: vType = SLDataSeriesChartType.LineChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.Standard; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; this.PlotArea.UsedChartOptions[iChartType].Smooth = false; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; break; case SLLineChartType.StackedLineWithMarkers: vType = SLDataSeriesChartType.LineChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; this.PlotArea.UsedChartOptions[iChartType].Smooth = false; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; break; case SLLineChartType.StackedLineWithMarkersMax: vType = SLDataSeriesChartType.LineChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].ShowMarker = true; this.PlotArea.UsedChartOptions[iChartType].Smooth = false; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; break; case SLLineChartType.Line3D: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = false; this.Perspective = 30; vType = SLDataSeriesChartType.Line3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].Grouping = C.GroupingValues.Standard; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.HasDepthAxis = true; this.PlotArea.DepthAxis.IsCrosses = true; this.PlotArea.DepthAxis.Crosses = C.CrossesValues.AutoZero; break; } }
/// <summary> /// Creates an instance of SLLineChartOptions with theme information. /// </summary> /// <returns>An SLLineChartOptions object with theme information.</returns> public SLLineChartOptions CreateLineChartOptions() { SLLineChartOptions lco = new SLLineChartOptions(this.listThemeColors, this.IsStylish); return lco; }
/// <summary> /// Clone an instance of SLLineChartOptions. /// </summary> /// <returns>An SLLineChartOptions object.</returns> public SLLineChartOptions Clone() { SLLineChartOptions lco = new SLLineChartOptions(); lco.iGapDepth = this.iGapDepth; lco.HasDropLines = this.HasDropLines; lco.DropLines = this.DropLines.Clone(); lco.HasHighLowLines = this.HasHighLowLines; lco.HighLowLines = this.HighLowLines.Clone(); lco.HasUpDownBars = this.HasUpDownBars; lco.UpDownBars = this.UpDownBars.Clone(); lco.Smooth = this.Smooth; return lco; }