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

Problem with scrolling

1 Answer 56 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Bolik
Top achievements
Rank 1
Bolik asked on 14 Jun 2012, 12:40 PM
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()
        {
            InitializeComponent();
 
            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.

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 19 Jun 2012, 11:12 AM
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,
Ves
the Telerik team

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

Tags
Chart
Asked by
Bolik
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or