0

I am using Telerik RadChart controls for Silverlight with Silverlight 4.0. I have a problem, due I think to the variance in my data sets, which causes my larger stacked bars to be clipped within the ChartArea. No problem, I thought, I can just loop through all my data and find the maximum size my StackedBar has to be, and adjust the scale of the y-axis. Here's the method I chose to implement.

    private void ForceScaleOfYaxis(IEnumerable<ChartObject> chartData)
    {
        double sum = 0;
        foreach (var bar in chartData)
        {
            sum = Math.Max(sum, bar.Series1 +
                                bar.Series2 +
                                bar.Series3 +
                                bar.Series4 +
                                bar.Series5);
        }

        ChartArea chartArea = radChart1.DefaultView.ChartArea;
        chartArea.AxisY.AutoRange = true;
        double min = chartArea.AxisY.ActualMinValue;
        double step = sum / 10; 
        chartArea.AxisY.AutoRange = false;
        chartArea.AxisY.AddRange(min, sum, step); 
    }

This worked quite well, in that it changed the y-axis to equal the largest sum of series values for the stacked bar.

Now I have a different problem: I correctly set the scale of the y-axis, but the Charts do not appear to stack. Stacked Bar Chart

One can see this with the following chart, as seen in this screen shot.

Blanthor
  • 2,568
  • 8
  • 48
  • 66
  • 1
    I'm afraid I can't reproduce your problem. Would it be possible to provide more information about it, such as the chart XAML, or perhaps even put together an [SSCCE](http://sscce.org) that demonstrates the problem? I'm also confused about the number of steps on the Y-axis: your code snippet limits this to 10 but the image above shows considerably more than that. – Luke Woodward Dec 30 '11 at 21:14
  • I'm will have to put some effort into making a sufficiently scrubbed example. This will take some time. – Blanthor Jan 04 '12 at 18:30

1 Answers1

0

I don't think that this is related to the clipping of bars caused by the YAxis Range but rather the way you Group the data and populate the Chart. A sample project of yours should shed some more light on the real issue.

Evgenia
  • 268
  • 2
  • 9