Problem with scrolling

2 posts, 0 answers
  1. Bolik
    Bolik avatar
    3 posts
    Member since:
    Jun 2012

    Posted 14 Jun 2012 Link to this post

    I created the simple application. It creates collection of some objects and displays them using RadChart.
    Here is the source code:

        public partial class MainPage : UserControl
            private ObservableCollection<ChartEntry> m_ChartEntries;
            public MainPage()
                m_ChartEntries = new ObservableCollection<ChartEntry>();
                for (int i = 0i < 20i++)
                    m_ChartEntries.Add(new ChartEntry { XValue = iYValue = 10 });
                    m_ChartEntries.Add(new ChartEntry { XValue = i + 0.5YValue = 20 });
                radChart.ItemsSource = m_ChartEntries;
                radChart.DefaultView.ChartArea.AxisX.AutoRange = false;
                radChart.DefaultView.ChartArea.AxisX.MinValue = 1;
                radChart.DefaultView.ChartArea.AxisX.MaxValue = m_ChartEntries.Count;
                radChart.DefaultView.ChartArea.AxisX.Step = 1; // The Step is 1
    The data are displayed correctly and Step is 1 (please note that AutoRange=false and Step is specified).

    Afterwards I tried to add horizontal scroll bar. I added the next code:
                radChart.DefaultView.ChartArea.ZoomScrollSettingsX.RangeStart = 0;
                radChart.DefaultView.ChartArea.ZoomScrollSettingsX.RangeEnd = 0.25;
                radChart.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode = ScrollMode.ScrollOnly;

    After adding scroll bar I have found the problem - now the data are displayed with the step 0.5 (please see the attached file). Why? How to solve this problem?

    Many thanks.
  2. Ves
    Ves avatar
    2869 posts

    Posted 19 Jun 2012 Link to this post

    Hi Bolik,

    RadChart scales the step when it is zoomed in/out, so that the number of items along X axis remains reasonable. In order to avoid this behavior in this case you can set the Step property directly to 4.

    Best regards,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft R3 2016 release webinar banner
Back to Top