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

Bars Overlapping

5 Answers 85 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Brendan
Top achievements
Rank 1
Brendan asked on 28 Sep 2011, 03:29 AM
Hi, I'm having trouble with my bar charts using a large amount of data where the bars are overlapping. I have reproduced the error in a simple application using only 100 values. I am using version 2011.2.712.1040

<Grid>
    <telerik:RadChart x:Name="ChartData">
        <telerik:RadChart.SeriesMappings>
            <telerik:SeriesMapping>
 
                <telerik:SeriesMapping.SeriesDefinition>
                    <telerik:BarSeriesDefinition ShowItemLabels="False" />
                </telerik:SeriesMapping.SeriesDefinition>
 
                <telerik:SeriesMapping.ItemMappings>
                    <telerik:ItemMapping DataPointMember="XValue" FieldName="Row" />
                    <telerik:ItemMapping DataPointMember="YValue" FieldName="Value" />
                </telerik:SeriesMapping.ItemMappings>
            </telerik:SeriesMapping>
        </telerik:RadChart.SeriesMappings>
    </telerik:RadChart>
</Grid>

public class Data
{
    public int Row { get; set; }
    public int Value { get; set; }
}
 
public partial class MainPage : UserControl
{
    private Random _rand = new Random();
 
    public MainPage()
    {
        InitializeComponent();
 
        List<Data> data = GenerateData().ToList();
 
        ChartData.ItemsSource = data;
    }
 
    private IEnumerable<Data> GenerateData()
    {
        for (int i = 1; i < 100; ++i)
        {
            yield return new Data()
            {
                Row = i,
                Value = _rand.Next(400, 450)
            };
        }
    }
}

5 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 28 Sep 2011, 04:08 PM
Hi Brendan,

This is an expected behavior of the Chart but unortunately not very readable. It is caused by the fact that you are trying to plot hundred bars on 100 XValues. However the Axis shows Label on each 20-th Value. You can manually reduce the Step so that all your bars are fully readable. This can be done by setting the AutoRange property to false and the MinValue, MaxValue and Step as 0, 100, 1 respectively.

All the best,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Brendan
Top achievements
Rank 1
answered on 29 Sep 2011, 01:38 AM
Why does the step size influence the bar widths? Only the ticks and labels should change position.

I have dynamic amounts of data which may be anywhere from 1 - 20,000+ values, how do I know what step size is going to be correct?
0
Brendan
Top achievements
Rank 1
answered on 29 Sep 2011, 02:36 AM
I've been playing around with the chart and it just doesn't seem to make sense why certain step sizes cause overlap. using 100 values I can us a step size of any where from 1 - 9 and the bar widths remain the same, however as soon as I use 10, they grow huge and overlap.

Having a step of 10 for 100 values seems perfectly reasonable to me, I don't understand why the chart can't render it correctly. This is most definitely a bug.

How are you calculating the bar widths?
0
Accepted
Evgenia
Telerik team
answered on 03 Oct 2011, 01:01 PM
Hi Brendan,

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.
The bigger your Step is  - the more clustered the bars will be. I still suggest that you decrease the Step to have a fully readable Chart.

Greetings,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Brendan
Top achievements
Rank 1
answered on 04 Oct 2011, 01:07 AM
Thank you for the explanation, I really appreciate the feedback. I will try to come up with something using this information
Tags
Chart
Asked by
Brendan
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Brendan
Top achievements
Rank 1
Share this question
or