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

Cant get multiple Y axis to work

2 Answers 104 Views
Chart
This is a migrated thread and some comments may be shown as answers.
RES
Top achievements
Rank 1
RES asked on 05 Nov 2010, 07:50 PM
Hello all,

I need some help getting multiple Y axis to work.  I can get other graphs to work, but as soon as I go to multiple Y axis I get nothin.

In my xaml I have this --> 

<telerikChart:RadChart x:Name="radChart" />
In my code behind I have this --> (Which is copied from the online help files, the only changes are in bold)

radChart.DefaultView.ChartArea.AxisY.Title = "Megawatt [MW]";
AxisY axisY = new AxisY();
axisY.AxisName = "AxisY_South";
axisY.Title = "Kilowatt [kW]";
radChart.DefaultView.ChartArea.AdditionalYAxes.Add( axisY );
  
//Series mapping for the collection with index 0
SeriesMapping seriesMapping = new SeriesMapping();
seriesMapping.CollectionIndex = 0;
seriesMapping.LegendLabel = "North [MW]";
seriesMapping.SeriesDefinition = new BarSeriesDefinition();
seriesMapping.SeriesDefinition.ShowItemLabels = false;
seriesMapping.ItemMappings.Add( new ItemMapping( "Actual", DataPointMember.YValue ) );
radChart.SeriesMappings.Add( seriesMapping );
//Series mapping for the collection with index 1
seriesMapping = new SeriesMapping();
seriesMapping.CollectionIndex = 1;
seriesMapping.LegendLabel = "South [kW]";
seriesMapping.SeriesDefinition = new BarSeriesDefinition();
seriesMapping.SeriesDefinition.AxisName = "AxisY_South";
seriesMapping.SeriesDefinition.ShowItemLabels = false;
seriesMapping.ItemMappings.Add( new ItemMapping( "Goal", DataPointMember.YValue ) );
radChart.SeriesMappings.Add( seriesMapping );
radChart.ItemsSource = TMbyDate;

...

TMbyDate works with itemmapping Actual or Goal for single Y axis so I dont think it is my data.

Any ideas?  By copying and pasting and then changing 3 variables I hope I have ruled out typos.
Is there more that the online help isn't telling?  What am I missing?

Also, how come this example doesn't tell me when to put in the DataPointMember.XValue?

Thanks
Travis

2 Answers, 1 is accepted

Sort by
0
RES
Top achievements
Rank 1
answered on 08 Nov 2010, 08:35 PM
I got it working using this instead:

SeriesMapping seriesMapping = new SeriesMapping();
seriesMapping.SeriesDefinition = new BarSeriesDefinition();
ItemMapping itemMapping = new ItemMapping();
itemMapping.DataPointMember = DataPointMember.YValue;
itemMapping.FieldName = "Goal";
seriesMapping.ItemMappings.Add(itemMapping);
chart.SeriesMappings.Add(seriesMapping);
SeriesMapping seriesMapping2 = new SeriesMapping();
seriesMapping2.SeriesDefinition = new BarSeriesDefinition();
ItemMapping itemMapping2 = new ItemMapping();
itemMapping2.DataPointMember = DataPointMember.YValue;
itemMapping2.FieldName = "Actual";
seriesMapping2.ItemMappings.Add(itemMapping2);
chart.SeriesMappings.Add(seriesMapping2);


However, how / when do I add DataPointMemeber.XValue? 
0
Evgeni "Zammy" Petrov
Telerik team
answered on 10 Nov 2010, 01:31 PM
Hi Travis,

 Thank you for contacting us.

You can add another ItemMapping for X and this should yeild the desired effect:

ItemMapping itemMapping = new ItemMapping();
 
itemMapping.DataPointMember = DataPointMember.XValue;
 
itemMapping.FieldName = "SomeOtherProperty";
 
seriesMapping.ItemMappings.Add(itemMapping);

Here is some more help about populating with data chart:

http://www.telerik.com/help/silverlight/radchart-populating-with-data-data-binding-with-manual-series-mapping.html

All the best,
Evgeni "Zammy" Petrov
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
Tags
Chart
Asked by
RES
Top achievements
Rank 1
Answers by
RES
Top achievements
Rank 1
Evgeni "Zammy" Petrov
Telerik team
Share this question
or