Zoom not working on custom itemmappings specified?

4 posts, 1 answers
  1. Rahul
    Rahul avatar
    116 posts
    Member since:
    Feb 2011

    Posted 08 Mar 2011 Link to this post

    Zoom is working fine in the following Case. Have a look at the code
    .
     foreach (var t in e.Result.lstMeasureData)
     {
          tempData.Add(new MeasureData { Datetaken = t.Datetaken, A1C = t.A1C, DBP = t.DBP, HDL = t.HDL, LDL = t.LDL, SBP = t.SBP, Weight = t.Weight });
     }

    radChart1.DefaultSeriesDefinition = new LineSeriesDefinition();
                 
    radChart1.DefaultSeriesDefinition.ShowItemLabels = false;
    radChart1.DefaultView.ChartArea.EnableAnimations = true;
    radChart1.DefaultView.ChartArea.EnableTransitionAnimations = true;
     
    radChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeEnd = 1;
    radChart1.DefaultView.ChartArea.ZoomScrollSettingsX.MinZoomRange = 0.001;
    radChart1.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;
     
    radChart1.DefaultView.ChartArea.AxisY.Title = "Measures";
    radChart1.DefaultView.ChartArea.AxisX.Title = "Dates";
     
    radChart1.ItemsSource = tempData;

    However if define custom series mappings and item mapping zoom is not working.
    Even after zooming on chart data remains as it is.
    Check the following code in which zoom is not working.

    foreach (var t in e.Result.lstMeasureData)
     {
          tempData.Add(new MeasureData { Datetaken = t.Datetaken, A1C = t.A1C, DBP = t.DBP, HDL = t.HDL, LDL = t.LDL, SBP = t.SBP, Weight = t.Weight });
     }

     
    radChart1.DefaultSeriesDefinition = new LineSeriesDefinition();
                  
     radChart1.DefaultSeriesDefinition.ShowItemLabels = false;
     radChart1.DefaultView.ChartArea.EnableAnimations = true;
     radChart1.DefaultView.ChartArea.EnableTransitionAnimations = true;
     
     radChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeEnd = 1;
     radChart1.DefaultView.ChartArea.ZoomScrollSettingsX.MinZoomRange = 0.001;
     radChart1.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;
      
     radChart1.DefaultView.ChartArea.AxisY.Title = "Measures";
     radChart1.DefaultView.ChartArea.AxisX.Title = "Dates";
     
     
     SeriesMapping seriesMapping1 = new SeriesMapping() { LegendLabel = "Weight" };
     seriesMapping1.ItemMappings.Add(new ItemMapping("Weight", DataPointMember.YValue));
     
     SeriesMapping seriesMapping2 = new SeriesMapping() { LegendLabel = "HDL" };
     seriesMapping2.ItemMappings.Add(new ItemMapping("HDL", DataPointMember.YValue));
     
     SeriesMapping seriesMapping3 = new SeriesMapping() { LegendLabel = "LDL" };
     seriesMapping3.ItemMappings.Add(new ItemMapping("LDL", DataPointMember.YValue));
     
     SeriesMapping seriesMapping4 = new SeriesMapping() { LegendLabel = "Datetaken" };
     seriesMapping4.ItemMappings.Add(new ItemMapping("Datetaken", DataPointMember.XCategory));
     
     SeriesMappingCollection seriesMappings = new SeriesMappingCollection() { seriesMapping1, seriesMapping2, seriesMapping3 };
     radChart1.SeriesMappings = seriesMappings;
     
    radChart1.ItemsSource = tempData;
  2. Rahul
    Rahul avatar
    116 posts
    Member since:
    Feb 2011

    Posted 08 Mar 2011 Link to this post

    Admins plz answer this post as soon as possible. I'm completely stucked here.
  3. DevCraft banner
  4. Answer
    Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 11 Mar 2011 Link to this post

    Hi Rahul,

    The issue you are facing is caused because you are setting XCategory as new SeriesMapping. Instead you should add it as new ItemsMapping in your existing series mappings. Here is how you can achieve this:

    RadChart1.DefaultSeriesDefinition = new LineSeriesDefinition();
               RadChart1.DefaultSeriesDefinition.ShowItemLabels = false;
               RadChart1.DefaultView.ChartArea.EnableAnimations = true;
               RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.RangeEnd = 1;
               RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.MinZoomRange = 0.001;
               RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;
               RadChart1.DefaultView.ChartArea.AxisY.Title = "Measures";
               RadChart1.DefaultView.ChartArea.AxisX.Title = "Dates";
               SeriesMapping seriesMapping1 = new SeriesMapping() { LegendLabel = "Weight" };
               seriesMapping1.ItemMappings.Add(new ItemMapping("Weight", DataPointMember.YValue));
               seriesMapping1.ItemMappings.Add(new ItemMapping("Datetaken", DataPointMember.XCategory));
               SeriesMapping seriesMapping2 = new SeriesMapping() { LegendLabel = "HDL" };
               seriesMapping2.ItemMappings.Add(new ItemMapping("HDL", DataPointMember.YValue));
               seriesMapping2.ItemMappings.Add(new ItemMapping("Datetaken", DataPointMember.XCategory));
               SeriesMapping seriesMapping3 = new SeriesMapping() { LegendLabel = "LDL" };
               seriesMapping3.ItemMappings.Add(new ItemMapping("LDL", DataPointMember.YValue));
               seriesMapping3.ItemMappings.Add(new ItemMapping("Datetaken", DataPointMember.XCategory));
               SeriesMappingCollection seriesMappings = new SeriesMappingCollection() { seriesMapping1, seriesMapping2, seriesMapping3};
               RadChart1.SeriesMappings = seriesMappings;

    Greetings,
    Evgenia
    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!
  5. Rahul
    Rahul avatar
    116 posts
    Member since:
    Feb 2011

    Posted 11 Mar 2011 Link to this post

    Thanx for reply. Thats what i want.
Back to Top