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

Horizontal Stacked Bar Chart Y axis

1 Answer 77 Views
This is a migrated thread and some comments may be shown as answers.
Joe Lozina
Top achievements
Rank 1
Joe Lozina asked on 01 Aug 2010, 11:17 AM

Ive created a Horizontal Stacked Bar Chart and it looks fine whn I follow the example and only use and array of double.

The problem is when I want to use a y axis value and Id like the Z axis to be a string.

I created a  Class ChartResults to hold the values
public ChartResults(double total, string typeValue)
    this.Total = total;
    this.TypeValue = typeValue;

When I try to fill the sample data. Ive only put one SeriesMapping in the below example to make it easier to read
private void FillSampleChartData()
      SeriesMapping sm1 = new SeriesMapping();
      StackedBarSeriesDefinition d1 = new HorizontalStackedBarSeriesDefinition();
      d1.StackGroupName = "Stack1";
      sm1.SeriesDefinition = d1;
      sm1.LegendLabel = "One";
      sm1.CollectionIndex = 0;
      ItemMapping im1a = new ItemMapping("TypeValue", DataPointMember.YValue);
      ItemMapping im1b = new ItemMapping("Total", DataPointMember.XValue);
      List<ChartResults[]> itemsSource = new List<ChartResults[]>();
      ChartResults[] one= new ChartResults[] { new ChartResults(83, "a"), new ChartResults(75, "a"), new ChartResults(80, "a") };
      RadChart1.ItemsSource = itemsSource;

I get the follwoing error
unhandled exception in Silverlight Application
System.FormatException:Input string was not in a correct format

Can you let me know what I am doing wrong?


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 03 Aug 2010, 04:41 PM
Hi Joe Lozina,

You should map the string field TypeValue to DataPointMember.XCategory and the double field Total to DataPointMember.YValue. You can find more information on enabling the categorical axis mode here as well.

Hope this helps.

Best wishes,
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Asked by
Joe Lozina
Top achievements
Rank 1
Answers by
Telerik team
Share this question