internal static bool Is3DChart(SLBarChartType ChartType) { bool result = false; switch (ChartType) { case SLBarChartType.ClusteredBar3D: case SLBarChartType.ClusteredHorizontalCone: case SLBarChartType.ClusteredHorizontalCylinder: case SLBarChartType.ClusteredHorizontalPyramid: case SLBarChartType.StackedBar3D: case SLBarChartType.StackedBarMax3D: case SLBarChartType.StackedHorizontalCone: case SLBarChartType.StackedHorizontalConeMax: case SLBarChartType.StackedHorizontalCylinder: case SLBarChartType.StackedHorizontalCylinderMax: case SLBarChartType.StackedHorizontalPyramid: case SLBarChartType.StackedHorizontalPyramidMax: result = true; break; } return result; }
internal static bool Is3DChart(SLBarChartType ChartType) { var result = false; switch (ChartType) { case SLBarChartType.ClusteredBar3D: case SLBarChartType.ClusteredHorizontalCone: case SLBarChartType.ClusteredHorizontalCylinder: case SLBarChartType.ClusteredHorizontalPyramid: case SLBarChartType.StackedBar3D: case SLBarChartType.StackedBarMax3D: case SLBarChartType.StackedHorizontalCone: case SLBarChartType.StackedHorizontalConeMax: case SLBarChartType.StackedHorizontalCylinder: case SLBarChartType.StackedHorizontalCylinderMax: case SLBarChartType.StackedHorizontalPyramid: case SLBarChartType.StackedHorizontalPyramidMax: result = true; break; } return(result); }
/// <summary> /// Set a bar chart using one of the built-in bar chart types. /// </summary> /// <param name="ChartType">A built-in bar chart type.</param> /// <param name="Options">Chart customization options.</param> public void SetChartType(SLBarChartType ChartType, SLBarChartOptions Options) { // bar charts have their axis positions different from column charts. this.Is3D = SLChartTool.Is3DChart(ChartType); SLDataSeriesChartType vType; int iChartType; switch (ChartType) { case SLBarChartType.ClusteredBar: vType = SLDataSeriesChartType.BarChartBarPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Clustered; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedBar: vType = SLDataSeriesChartType.BarChartBarPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].Overlap = 100; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedBarMax: vType = SLDataSeriesChartType.BarChartBarPrimary; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].Overlap = 100; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.ClusteredBar3D: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Clustered; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Box; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedBar3D: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Box; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedBarMax3D: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Box; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.ClusteredHorizontalCylinder: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Clustered; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Cylinder; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedHorizontalCylinder: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Cylinder; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedHorizontalCylinderMax: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Cylinder; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.ClusteredHorizontalCone: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Clustered; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Cone; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedHorizontalCone: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Cone; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedHorizontalConeMax: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Cone; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.ClusteredHorizontalPyramid: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Clustered; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Pyramid; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedHorizontalPyramid: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.Stacked; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Pyramid; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; case SLBarChartType.StackedHorizontalPyramidMax: this.RotateX = 15; this.RotateY = 20; this.RightAngleAxes = true; vType = SLDataSeriesChartType.Bar3DChart; this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType); iChartType = (int)vType; this.PlotArea.UsedChartTypes[iChartType] = true; this.PlotArea.UsedChartOptions[iChartType].BarDirection = C.BarDirectionValues.Bar; this.PlotArea.UsedChartOptions[iChartType].BarGrouping = C.BarGroupingValues.PercentStacked; this.PlotArea.UsedChartOptions[iChartType].Shape = C.ShapeValues.Pyramid; if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options); this.PlotArea.SetDataSeriesChartType(vType); this.PlotArea.HasPrimaryAxes = true; this.PlotArea.PrimaryTextAxis.AxisPosition = C.AxisPositionValues.Left; this.PlotArea.PrimaryValueAxis.AxisPosition = C.AxisPositionValues.Bottom; break; } }
/// <summary> /// Set a bar chart using one of the built-in bar chart types. /// </summary> /// <param name="ChartType">A built-in bar chart type.</param> public void SetChartType(SLBarChartType ChartType) { this.SetChartType(ChartType, null); }