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.
One can see this with the following chart, as seen in this screen shot.