Cant get multiple Y axis to work

3 posts, 0 answers
  1. RES
    RES avatar
    77 posts
    Member since:
    Sep 2010

    Posted 05 Nov 2010 Link to this post

    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. RES
    RES avatar
    77 posts
    Member since:
    Sep 2010

    Posted 08 Nov 2010 Link to this post

    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? 
  3. UI for WPF is Visual Studio 2017 Ready
  4. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 10 Nov 2010 Link to this post

    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
Back to Top