Zoom/scrolling problem

9 posts, 0 answers
  1. Mike Dutra
    Mike Dutra avatar
    6 posts
    Member since:
    Apr 2010

    Posted 27 Apr 2010 Link to this post

    I have created a simple chart with 50k points and added scrolling/zooming. However, once I have zoomed to roughly 1/10 of the chart ecah smaller zoom seems to draw all the point s on the far right side. I have attached a sample image of what I am talking about. I am following the zooming/scrolling sample from the RadControls for Silverlight Q1 2010 SP1 demos. Apparently I have done something incorrect. Any ideas on what might be causing the issue?

    Here is my code:

     public MainPage()
            {
                InitializeComponent();
                HtmlPage.RegisterScriptableObject("RadLiveData", this);
                this.SetUpRadChart();
                this.SetUpXAxis();
                this.SetUpPrimaryYAxis();
            }
            private void SetUpRadChart()
            {
                RadChart1.DefaultView.ChartArea.NoDataString = "Waiting for data...";
                RadChart1.DefaultView.ChartArea.EnableAnimations = true;

                RadChart1.DefaultView.ChartArea.AxisY.MajorGridLinesVisibility = Visibility.Visible;
                RadChart1.DefaultView.ChartArea.AxisY.MinorGridLinesVisibility = Visibility.Visible;
                RadChart1.DefaultView.ChartArea.AxisX.MajorGridLinesVisibility = Visibility.Visible;
                RadChart1.DefaultView.ChartLegend.Margin = new Thickness(15, 0, 0, 0);

                RadChart1.SamplingSettings.SamplingThreshold = 600;
                RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollAndZoom;
            }
            private void SetUpXAxis()
            {
                RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#VAL{hh:mm:ss}";
                RadChart1.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
                RadChart1.DefaultView.ChartArea.AxisX.LabelStep = 2;
                RadChart1.DefaultView.ChartArea.AxisX.Title = "Time";
            }
            private void SetUpPrimaryYAxis()
            {
                RadChart1.DefaultView.ChartArea.AxisY.AutoRange = false;
                RadChart1.DefaultView.ChartArea.AxisY.AddRange(0.0, 100.0, 20);
                RadChart1.DefaultView.ChartArea.AxisY.Title = "%";
            }
            private void SetUpMapping(string name, string units)
            {
                SeriesMapping mapping = new SeriesMapping();
                mapping.LegendLabel = name;
                mapping.SeriesDefinition = new LineSeriesDefinition();
                (mapping.SeriesDefinition as LineSeriesDefinition).ShowPointMarks = false;
                (mapping.SeriesDefinition as LineSeriesDefinition).ShowItemLabels = false;
                mapping.ItemMappings.Add(new ItemMapping("Key", DataPointMember.XValue));
                mapping.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
                mapping.ItemMappings[1].SamplingFunction = ChartSamplingFunction.KeepExtremes;
                RadChart1.SeriesMappings.Add(mapping);
            }
            private void btnHistory_Click(object sender, RoutedEventArgs e)
            {
                LiveORNonAJAXwsClient proxy = new LiveORNonAJAXwsClient("basicHttp");
                proxy.GetViperChartDataCompleted += new EventHandler<LiveORsvc.GetViperChartDataCompletedEventArgs>(proxy_GetViperChartDataCompleted);
                proxy.GetViperChartDataAsync("test", "test");
            }
            void proxy_GetViperChartDataCompleted(object sender, GetViperChartDataCompletedEventArgs e)
            {
                if (e.Error == null && e.Result != null)
                {
                    ChannelData readings = e.Result;

                    RadChart1.SeriesMappings.Clear();
                    SetUpMapping(readings.ChannelName, readings.Units);

                    RadChart1.ItemsSource = null;
                    RadChart1.ItemsSource = readings.DataPoints;
                }
            }

  2. Mike Dutra
    Mike Dutra avatar
    6 posts
    Member since:
    Apr 2010

    Posted 28 Apr 2010 Link to this post

    I have found a bit more information. It appears that when zooming in to a specific range the X axis AutoRange feature sets the axis ticks incorrectly. All of a sudden the date ranges include far more than even the original dataset contains. Is this a problem with the AutoRange feature, dataset or in the way I am using the chart?
  3. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 30 Apr 2010 Link to this post

    Hi Mike Dutra,

    I can confirm this is a problem with the AutoRange feature unfortunately. Currently we are reworking this logic and we hope to have much improved behavior for Q2 release. As a work-around I would suggest to manually manage the range using AutoRange=false and AddRange() method.

    Please, accept my sincere apologies for this inconvenience.

    All the best,
    Vladimir Milev
    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.
  4. Mike Dutra
    Mike Dutra avatar
    6 posts
    Member since:
    Apr 2010

    Posted 30 Apr 2010 Link to this post

    Vlad,
    Since I need to call AddRange() each time the user zooms can you tell me which event(s) I can attach to to handle the zoom and scroll events?
  5. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 05 May 2010 Link to this post

    Hello Mike Dutra,

    Why do you need to call that method everytime you zoom? You should set the range manually just once in the beginning and when zooming the chart control will maintain the new range internally.


    All the best,
    Vladimir Milev
    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.
  6. Mike Dutra
    Mike Dutra avatar
    6 posts
    Member since:
    Apr 2010

    Posted 05 May 2010 Link to this post

    Vladimir,

    I misunderstood. I thought in order to work around the zoom range problem I would need to manually recalculate the range each time the user zoomed and call AddRange(). However, even if I turn autorange to false and manually set the range the problem still occurs when zoomed past a certain point.
  7. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 10 May 2010 Link to this post

    Hello Mike Dutra,

    We are in the middle of a serious axis refactoring/rewrite. We believe a lot of the problems described will be fixed as a result of this process. While there are no official fixed planned for the SP2 release, we will ship a  BETA release shortly after that which should address axis issues reported.

    All the best,
    Vladimir Milev
    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.
  8. Jamshed Rahman
    Jamshed Rahman avatar
    2 posts
    Member since:
    May 2010

    Posted 29 Jul 2010 Link to this post

    Has this been fixed? I am seeing a similar problem, in spite of using manual addrange() for axis range. Which version should I use that fixes this bug?

    Thanks,
    Jamshed
  9. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 04 Aug 2010 Link to this post

    Hi Jamshed Rahman,

    The axis rewrite is available with the official version which is Q2 release.

    Best wishes,
    Vladimir Milev
    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