internal static bool Is3DChart(SLScatterChartType ChartType) { // all scatter charts are 2D return(false); }
internal static bool Is3DChart(SLScatterChartType ChartType) { // all scatter charts are 2D return false; }
private void PlotDataSeriesAsScatterChart(int DataSeriesIndex, SLScatterChartType ChartType, 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.Value; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Bottom; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryTextAxis.ShowMajorGridlines = true; this.PlotArea.PrimaryValueAxis.MajorTickMark = C.TickMarkValues.Cross; this.PlotArea.PrimaryTextAxis.CrossBetween = C.CrossBetweenValues.MidpointCategory; this.PlotArea.PrimaryValueAxis.CrossBetween = C.CrossBetweenValues.MidpointCategory; } else if (!bIsPrimary && this.PlotArea.HasPrimaryAxes && !this.PlotArea.HasSecondaryAxes) { this.PlotArea.HasSecondaryAxes = true; this.PlotArea.SecondaryTextAxis.AxisType = SLAxisType.Value; this.PlotArea.SecondaryTextAxis.AxisPosition = this.HasShownSecondaryTextAxis ? C.AxisPositionValues.Top : C.AxisPositionValues.Bottom; this.PlotArea.SecondaryValueAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.SecondaryTextAxis.ShowMajorGridlines = true; this.PlotArea.SecondaryTextAxis.CrossBetween = C.CrossBetweenValues.MidpointCategory; this.PlotArea.SecondaryValueAxis.CrossBetween = C.CrossBetweenValues.MidpointCategory; } SLDataSeriesChartType vType = bIsPrimary ? SLDataSeriesChartType.ScatterChartPrimary : SLDataSeriesChartType.ScatterChartSecondary; int iChartType = (int)vType; if (this.PlotArea.UsedChartTypes[iChartType]) { // the chart is already used. } else { this.PlotArea.UsedChartTypes[iChartType] = true; switch (ChartType) { case SLScatterChartType.ScatterWithOnlyMarkers: this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.LineMarker; this.PlotArea.DataSeries[index].ChartType = vType; this.PlotArea.DataSeries[index].Options.Line.Width = 2.25m; this.PlotArea.DataSeries[index].Options.Line.SetNoLine(); break; case SLScatterChartType.ScatterWithSmoothLinesAndMarkers: this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.SmoothMarker; this.PlotArea.DataSeries[index].ChartType = vType; this.PlotArea.DataSeries[index].Options.Smooth = true; break; case SLScatterChartType.ScatterWithSmoothLines: this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.SmoothMarker; this.PlotArea.DataSeries[index].ChartType = vType; this.PlotArea.DataSeries[index].Options.Smooth = true; this.PlotArea.DataSeries[index].Options.Marker.Symbol = C.MarkerStyleValues.None; break; case SLScatterChartType.ScatterWithStraightLinesAndMarkers: this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.LineMarker; this.PlotArea.DataSeries[index].ChartType = vType; break; case SLScatterChartType.ScatterWithStraightLines: this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.LineMarker; this.PlotArea.DataSeries[index].ChartType = vType; this.PlotArea.DataSeries[index].Options.Marker.Symbol = C.MarkerStyleValues.None; break; } } }
/// <summary> /// Plot a specific data series as a scatter 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="ChartType">A built-in scatter chart type for this specific data series.</param> public void PlotDataSeriesAsSecondaryScatterChart(int DataSeriesIndex, SLScatterChartType ChartType) { this.PlotDataSeriesAsScatterChart(DataSeriesIndex, ChartType, false); }
/// <summary> /// Plot a specific data series as a scatter 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="ChartType">A built-in scatter chart type for this specific data series.</param> public void PlotDataSeriesAsPrimaryScatterChart(int DataSeriesIndex, SLScatterChartType ChartType) { this.PlotDataSeriesAsScatterChart(DataSeriesIndex, ChartType, true); }
/// <summary> /// Set a scatter chart using one of the built-in scatter chart types. /// </summary> /// <param name="ChartType">A built-in scatter chart type.</param> public void SetChartType(SLScatterChartType ChartType) { this.Is3D = SLChartTool.Is3DChart(ChartType); SLDataSeriesChartType vType; int iChartType; switch (ChartType) { case SLScatterChartType.ScatterWithOnlyMarkers: vType = SLDataSeriesChartType.ScatterChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.LineMarker; this.PlotArea.SetDataSeriesChartType(vType); foreach (SLDataSeries ds in this.PlotArea.DataSeries) { ds.Options.Line.Width = 2.25m; ds.Options.Line.SetNoLine(); } this.SetPlotAreaValueAxes(); this.PlotArea.HasPrimaryAxes = true; break; case SLScatterChartType.ScatterWithSmoothLinesAndMarkers: vType = SLDataSeriesChartType.ScatterChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.SmoothMarker; this.PlotArea.SetDataSeriesChartType(vType); foreach (SLDataSeries ds in this.PlotArea.DataSeries) { ds.Options.Smooth = true; } this.SetPlotAreaValueAxes(); this.PlotArea.HasPrimaryAxes = true; break; case SLScatterChartType.ScatterWithSmoothLines: vType = SLDataSeriesChartType.ScatterChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.SmoothMarker; this.PlotArea.SetDataSeriesChartType(vType); foreach (SLDataSeries ds in this.PlotArea.DataSeries) { ds.Options.Smooth = true; ds.Options.Marker.Symbol = C.MarkerStyleValues.None; } this.SetPlotAreaValueAxes(); this.PlotArea.HasPrimaryAxes = true; break; case SLScatterChartType.ScatterWithStraightLinesAndMarkers: vType = SLDataSeriesChartType.ScatterChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.LineMarker; this.PlotArea.SetDataSeriesChartType(vType); this.SetPlotAreaValueAxes(); this.PlotArea.HasPrimaryAxes = true; break; case SLScatterChartType.ScatterWithStraightLines: vType = SLDataSeriesChartType.ScatterChartPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].ScatterStyle = C.ScatterStyleValues.LineMarker; this.PlotArea.SetDataSeriesChartType(vType); foreach (SLDataSeries ds in this.PlotArea.DataSeries) { ds.Options.Marker.Symbol = C.MarkerStyleValues.None; } this.SetPlotAreaValueAxes(); this.PlotArea.HasPrimaryAxes = true; break; } }