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

2 posts, 0 answers
  1. Manfred
    Manfred avatar
    54 posts
    Member since:
    Jan 2011

    Posted 24 Feb 2011 Link to this post

    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";
            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)));
            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));

    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
  2. Giuseppe
    Giuseppe avatar
    2363 posts

    Posted 25 Feb 2011 Link to this post

    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.

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