This is a migrated thread and some comments may be shown as answers.

Centering columns BarWidthPercent reduced when using BarOverlapPercent at 100%

1 Answer 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
P Kidd
Top achievements
Rank 1
P Kidd asked on 18 Aug 2011, 04:25 PM

 

I have a bar chart that has items overlapping - how do I center these overlapped bars
The code below aligns all the items to the left.

Overlapping is 100% but the additional stacked bars have had their widths reduced to half the width of the main series column.  Please view the attached chart to see what I am attempting to achieve.


Dim oTargetSeries As New ChartSeries("Target")
Dim oAchievementSeries As New ChartSeries("Target Achievement")
Dim oVarianceAccSeries As New ChartSeries("Variance - Accessories")
Dim oVariancePartsSeries As New ChartSeries("Variance - Parts")

 

 

With oTargetSeries

.Clear()

.Appearance.FillStyle.FillType = FillType.Solid

.Appearance.FillStyle.MainColor = Color.Black

.Type = ChartSeriesType.Line

.YAxisType = ChartYAxisType.Primary

.Appearance.LabelAppearance.Visible = False

End With

With oAchievementSeries

.Clear()

.Appearance.FillStyle.FillType = FillType.Solid

.Appearance.FillStyle.MainColor = Color.Green

.Type = ChartSeriesType.Bar

.YAxisType = ChartYAxisType.Primary

.Appearance.LabelAppearance.Visible = False

End With

 

With oVarianceAccSeries

.Clear()

.Appearance.FillStyle.FillType = FillType.Solid

.Appearance.FillStyle.MainColor = Color.Yellow

.Type = ChartSeriesType.StackedBar

.YAxisType = ChartYAxisType.Secondary

.Appearance.BarWidthPercent = 50

End With

With oVariancePartsSeries

.Clear()

.Appearance.FillStyle.FillType = FillType.Solid

.Appearance.FillStyle.MainColor = Color.Blue

.Type = ChartSeriesType.StackedBar

.YAxisType = ChartYAxisType.Secondary

.Appearance.BarWidthPercent = 50

End With

oChart.Appearance.BarOverlapPercent = 100

With oChart

.PlotArea.Appearance.FillStyle.FillType = FillType.Solid

.PlotArea.Appearance.FillStyle.MainColor = Color.White

.IntelligentLabelsEnabled = False

.PlotArea.XAxis.AutoScale = False

.PlotArea.XAxis.IsZeroBased = False

.PlotArea.XAxis.Visible = False

.PlotArea.XAxis.AxisLabel.Visible = True

.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 320

.PlotArea.XAxis.Appearance.Width = 3

.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between

.PlotArea.YAxis.AutoScale = False

.PlotArea.YAxis2.AutoScale = False

 

.PlotArea.YAxis.Appearance.Width = 3

.PlotArea.YAxis.MaxValue = 200

.PlotArea.YAxis.MinValue = 0

.PlotArea.YAxis.Step = 20

.PlotArea.YAxis2.Appearance.Width = 3

.PlotArea.YAxis2.MaxValue = 200

.PlotArea.YAxis2.MinValue = -200

.PlotArea.YAxis2.Step = 50

.PlotArea.XAxis.Clear()

 

For Each oItem As clsRptPerformanceVsTarget In oRptPerformanceVsTargetList

Dim oChartAxisItem As New ChartAxisItem

oChartAxisItem.TextBlock.Text = oItem.CICode

.PlotArea.XAxis.Items.Add(oChartAxisItem)

Next

 

End With

 

For Each oItem As clsRptPerformanceVsTarget In oRptPerformanceVsTargetList

Dim oTargetItem As New ChartSeriesItem()

Dim oAchievementItem As New ChartSeriesItem()

Dim oVarianceAccItem As New ChartSeriesItem()

Dim oVariancePartsItem As New ChartSeriesItem()

With oTargetItem

.YValue = oItem.Target

End With

With oAchievementItem

.YValue = oItem.TargetAchievement

'.Name = oItem.CICode

End With

With oVarianceAccItem

.YValue = oItem.VarianceAccessories

End With

With oVariancePartsItem

.YValue = oItem.VarianceParts

End With

oTargetSeries.Items.Add(oTargetItem)

oAchievementSeries.Items.Add(oAchievementItem)

oVarianceAccSeries.Items.Add(oVarianceAccItem)

oVariancePartsSeries.Items.Add(oVariancePartsItem)

Next

With oChart

.Series.Add(oTargetSeries)

.Series.Add(oAchievementSeries)

.Series.Add(oVarianceAccSeries)

.Series.Add(oVariancePartsSeries)

End With

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 23 Aug 2011, 08:24 AM
Hello,

Based on the supplied information, it is hard to determine what is causing this unwanted behavior. If the issue persists, you can open a formal support ticket, and send us a small project, demonstrating your setup, along with the present layout. We will review it locally, and advise you further.

Kind regards,
Yavor
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
General Discussions
Asked by
P Kidd
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or