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

HowTo: Bind Second YAxis to the second Value of a DataPoint

1 Answer 90 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Manfred
Top achievements
Rank 2
Manfred asked on 24 Feb 2011, 08:36 AM
Hi there,

I have the following:

foreach (KeyValuePair<string, List<OperationData>> opd in _viewModel.OperationDataDictionary)
      {
        DataSeries ds = new DataSeries();
        DataSeries ds1 = new DataSeries();
        ds.Definition = ProfitChart.DefaultSeriesDefinition;
        ds.LegendLabel = opd.Key.ToString();
        ds1.Definition = ProfitChart.DefaultSeriesDefinition;
        AxisY ay = new AxisY();
        ay.AxisName = "WindSpeed";
        ay.Title = "m/s";
        ProfitChart.DefaultView.ChartArea.AdditionalYAxes.Add(ay);
  
  
        foreach (var elem in opd.Value.ToList())
        {
          string _zeit = elem.OD_DATE.Value.Hour + ":" + elem.OD_DATE.Value.Minute;
          ds.Add(new DataPoint(_zeit, Convert.ToDouble(elem.LEISTNG_MIT)));
          ds1.Add(new DataPoint(_zeit, Convert.ToDouble(elem.WINDGES_MIT)));
            
        }
        ProfitChart.DefaultView.ChartArea.DataSeries.Add(ds);
        ProfitChart.DefaultView.ChartArea.DataSeries.Add(ds1);
        SeriesMapping seriesMapping = new SeriesMapping();
        seriesMapping.CollectionIndex = 1;
        seriesMapping.LegendLabel = "WindSpeed";
        seriesMapping.SeriesDefinition = new LineSeriesDefinition();
        seriesMapping.SeriesDefinition.ShowItemLabels = false;
        seriesMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
        ProfitChart.SeriesMappings.Add(seriesMapping);
  
      }

My Axis appears, but the Values are not bound to the elem.WINDGES_MIT-Value, my Chart looks like attached.
How can I bound my Windspeed to the second YAxis?

Best Regards
Manfred

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 25 Feb 2011, 01:25 PM
Hello Manfred,

Check this example here -- the AxisY.AxisName property must match with the respective SeriesDefinition.AxisName property in order to associate the series with one of the secondary axes.

Hope this helps.


Greetings,
Giuseppe
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Chart
Asked by
Manfred
Top achievements
Rank 2
Answers by
Giuseppe
Telerik team
Share this question
or