Scroll/Zoom doesn't work on X Axis

8 posts, 1 answers
  1. Nemanja
    Nemanja avatar
    27 posts
    Member since:
    Mar 2011

    Posted 29 Sep 2011 Link to this post

    Hi,

    I'm having trouble with the scroll and zoom feature on the RadChart. I have a 2D Range bar set up to mimic a Gantt style chart where certain products are on sale over different weeks and the chart allows users to keep track of the movement.

    I have the chart set up to use the High/Low co-ordinates for start week and end week respectively, with the Y axis labels using the Low value while the X axis uses the product name as a label instead of the High value.

    The trouble I'm having is when i add the scroll bar to the chart as per the example in the demos, it only works for the Y axis and not the X. The actual scroll bar does appear and the zoom buttons do change the dimensions of the scroller, and the drag select option also seems to work properly, but the actual chart remains unchanged for some reason...

    As you can see, the scroll bar on the left is set to a high level of zoom, yet the entire chart is still displayed and no zooming actually happens.



    The XAML that I use looks like this:

    <telerik:ChartArea Grid.Row="0" x:Name="ChartArea" NoDataString="" LabelFormatBehavior="None" ItemClick="ChartArea_ItemClick"
                                                PaletteBrushesRepeat="False" EnableAnimations="False" >
                                <telerik:ChartArea.ZoomScrollSettingsX>
                                    <telerik:ZoomScrollSettings ScrollMode="ScrollAndZoom" MinZoomRange="0.005"/>
                                </telerik:ChartArea.ZoomScrollSettingsX>
                                <telerik:ChartArea.PaletteBrushes>
                                    <SolidColorBrush Color="Orange"/>
                                </telerik:ChartArea.PaletteBrushes>
                                <telerik:ChartArea.AxisY>
                                    <telerik:AxisY Title="Week" ExtendDirection="Up" DefaultLabelFormat="W20#VAL" AutoRange="True">
                                        <telerik:AxisY.AxisStyles>
                                            <telerik:AxisStyles TitleStyle="{StaticResource CustomAxisTitleStyle}" />
                                        </telerik:AxisY.AxisStyles>
                                    </telerik:AxisY>
                                </telerik:ChartArea.AxisY>
                                <telerik:ChartArea.AxisX>
                                    <telerik:AxisX LayoutMode="Between" />
                                </telerik:ChartArea.AxisX>
                            </telerik:ChartArea>


    The code for the zoom is the same as in the demo and works fine if I set it for the Y axis but for some reason, not the X...

    public void ZoomIn(object parameter)
            {
                this.ChartArea.ZoomScrollSettingsX.SuspendNotifications();
     
                double zoomCenter = this.ChartArea.ZoomScrollSettingsX.RangeStart + (this.ChartArea.ZoomScrollSettingsX.Range / 2);
                double newRange = Math.Max(this.ChartArea.ZoomScrollSettingsX.MinZoomRange, this.ChartArea.ZoomScrollSettingsX.Range) / 2;
                this.ChartArea.ZoomScrollSettingsX.RangeStart = Math.Max(0, zoomCenter - (newRange / 2));
                this.ChartArea.ZoomScrollSettingsX.RangeEnd = Math.Min(1, zoomCenter + (newRange / 2));
     
                this.ChartArea.ZoomScrollSettingsX.ResumeNotifications();
     
                ((Telerik.Windows.Controls.DelegateCommand)_zoomInCommand).InvalidateCanExecute();
                ((Telerik.Windows.Controls.DelegateCommand)_zoomOutCommand).InvalidateCanExecute();
            }


    What am I doing wrong?

    Regards,
    Nemanja

  2. Nemanja
    Nemanja avatar
    27 posts
    Member since:
    Mar 2011

    Posted 03 Oct 2011 Link to this post

    any updates on this? it's quite urgent..

  3. Download a free trial of UI for WPF
  4. Answer
    Ves
    Admin
    Ves avatar
    2648 posts
    Member since:
    Sep 2012

    Posted 04 Oct 2011 Link to this post

    Hi Nemanja,

    Please, find attached a simplified version of the example, which uses your code and works as expected.

    Best regards,
    Ves
    the Telerik team

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

  5. Nemanja
    Nemanja avatar
    27 posts
    Member since:
    Mar 2011

    Posted 05 Oct 2011 Link to this post

    Hi Ves,

    thanks for your reply. it was the itemmapping as you suggest in the attached code. it works perfectly now.

    Regards,
    Nemanja

  6. Vikash
    Vikash avatar
    12 posts
    Member since:
    Apr 2012

    Posted 05 May 2012 Link to this post

    Hello Telerik Team,
    Can we set value for maximum zoom in  just like zoom out.

  7. Ves
    Admin
    Ves avatar
    2648 posts
    Member since:
    Sep 2012

    Posted 10 May 2012 Link to this post

    Hi Vikash,

    You can use the MinZoomRange property, described here.


    Regards,
    Ves
    the Telerik team

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

  8. Anitha
    Anitha avatar
    33 posts
    Member since:
    Apr 2012

    Posted 18 Dec 2013 Link to this post

    Hi All,
    This works fine for X-Axis, but I want the same for Y-Axis.

    Any solution for ZoomAndScroll for Y-Axis

    Thanks in Advance

  9. Peshito
    Admin
    Peshito avatar
    328 posts
    Member since:
    Sep 2012

    Posted 20 Dec 2013 Link to this post

    Hi Anitha,

    Could you elaborate a bit more on the issue. Is it the MinZoomRange you have in mind that is not working for your scenario? Providing us with sample project pointing out the issue will help us resolve it faster and give you an appropriate answer. In the meantime you can take a look at the help topic describing the use of MinZoomRange property here.

    Regards,
    Peshito
    Telerik

    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>

Back to Top
Download a free trial of UI for WPF