Bar series width problem

Chart
Top achievements
Rank 1
heallven asked on 20 Mar 2011, 08:20 AM
I am using RadChart to draw two series in one ChartArea.
The two series are LineSeries and BarSeries.

And I also set the ItemWidthPercent = "2" in ChartArea, because there are almost 200-300 point in chart.

But the each bar in BarSeries have different width.
Please see the screenshot in attachment.

Is it a bug?

0
Accepted
Evgenia
Telerik team
answered on 24 Mar 2011, 09:11 AM
Hi Liu,

The width of the bars depends on the mechanism of calculating the ItemWidthPercent, as well as the number of ticks/length between ticks. Up until a specific point , the way it's calculated is based on a portion of the step, for example, if you have Step = 5 and ItemWidthPercent = 10, it'd mean that the width of the individual bar would be only 2% of the step ( i.e. 10% of 1/5th ). After that specific point the ItemWidthPercent is applied to the available space between two ticks, which is why the bars would become wider or thinner.

As you have set very small value for ItemWidthPercent this is causing the Bars to look like they are with different Width. What I can suggest you is to set bigger ItemWidthPercent.

Greetings,
Evgenia
the Telerik team
0
heallven
Top achievements
Rank 1
answered on 25 Mar 2011, 11:25 AM
Thanks, Evgenia.
I have understand this mechanism.

And I already have another solutions.

`radKlineChart.CreateItemStyleDelegate = BuildCustomItemStyle; `
` `
`public` `Style BuildCustomItemStyle(Control item, Style style, DataPoint point, DataSeries dataSeries) `
`{ `
`    ``if` `((item ``as` `Bar) != ``null` `&& point != ``null``) `
`    ``{ `
`        ``Canvas canvas = item.FindChildByType<Canvas>(); `
`        ``Rectangle definingGeometry = canvas.Children[0] ``as` `Rectangle; `
`        ``definingGeometry.Width = 1; `
`    ``} `
`    ``return` `style; `
`}`

Then I'd like to calculate the width by myself.

Thank for your support : )
Tags
Chart