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

Zoom/scrolling problem

8 Answers 213 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Mike Dutra
Top achievements
Rank 1
Mike Dutra asked on 27 Apr 2010, 10:40 PM
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;
            }
        }

8 Answers, 1 is accepted

Sort by
0
Mike Dutra
Top achievements
Rank 1
answered on 28 Apr 2010, 04:05 PM
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?
0
Vladimir Milev
Telerik team
answered on 30 Apr 2010, 10:36 AM
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.
0
Mike Dutra
Top achievements
Rank 1
answered on 30 Apr 2010, 12:45 PM
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?
0
Vladimir Milev
Telerik team
answered on 05 May 2010, 01:49 PM
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.
0
Mike Dutra
Top achievements
Rank 1
answered on 05 May 2010, 02:58 PM
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.
0
Vladimir Milev
Telerik team
answered on 10 May 2010, 01:04 PM
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.
0
Jamshed Rahman
Top achievements
Rank 1
answered on 30 Jul 2010, 12:01 AM
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
0
Vladimir Milev
Telerik team
answered on 04 Aug 2010, 11:15 AM
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
Tags
Chart
Asked by
Mike Dutra
Top achievements
Rank 1
Answers by
Mike Dutra
Top achievements
Rank 1
Vladimir Milev
Telerik team
Jamshed Rahman
Top achievements
Rank 1
Share this question
or