Chart Orientation

5 posts, 0 answers
  1. Marcello
    Marcello avatar
    58 posts
    Member since:
    Apr 2013

    Posted 20 Jan 2015 Link to this post

    Hi,

    in Wpf demos, the Galleries -> Bar example allow to switch chart orientation  between Horizontal and Vertical.
    It work binding:

    demo:OrientationBehavior.Orientation="{Binding ChartOrientation, Mode=TwoWay}"

    Exists documentation about this?
    How to add a check for a generic cartesian chart as Vertical/Horizontal switch?

    Thank's very much,
    marc.
  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 23 Jan 2015 Link to this post

    Hi Marcello,

    The orientation change functionality provided through the OrientationBehavior class is created with custom code which means that it is not built-in in the chart. You can find the implementation of the OrientationBehavior class in the demo solution where the Chart Orientation demo is placed. The demo is located under the Product Versions page for UI for WPF in your account. To navigate to there you can open our website click on the "Products & Subscriptions" button and choose the corresponding product that contains the UI for WPF suite. Then click on the blue "Download" button to open the Donwload List page. Find the "UI for WPF" section and click its "Browse all product files" button. This will open the Product Versions page where you can find the "Demo.zip" file which contains the demos solution.

    You can use this approach to implement a check logic for changing the orientation. In addition I also attached a sample project demonstrating such customization. Please take a look at it and let me know if it works for you.

    Regards,
    Martin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Marcello
    Marcello avatar
    58 posts
    Member since:
    Apr 2013

    Posted 26 Jan 2015 in reply to Martin Link to this post

    Hello,

    so it's just an axes exchange!
    I want to compliment you. The architecture of your charts is unmatched making everything perfectly linear and simple.
  5. Marcello
    Marcello avatar
    58 posts
    Member since:
    Apr 2013

    Posted 30 Jan 2015 in reply to Martin Link to this post

    Hi Martin,

    A problem occours if PanAndZoomBehavior is enabled.
    I change the ZoomMode property and the zoom in effect works good.
    But the zoom scrollbar appears allways horizontally!

    Solutions?
    Thank's.
  6. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 03 Feb 2015 Link to this post

    Hello Marcello,

    It seems that there is an issue in the RadCartesianChart control that concerns the PanZoomBars used for zooming and scrolling on the axes. I logged it in our feedback portal where you can track its status. I also updated your Telerik points as a small sign of gratitude for helping us finding the issue. As a workaround you can get the PanZoomBar element and set its Orientation property.

    private void TrySetOrientation(CartesianAxis axis, Orientation orientation)
    {
        var panZoomBar = Telerik.Windows.Controls.ChildrenOfTypeExtensions.FindChildByType<PanZoomBar>(axis);
        if (panZoomBar != null)
        {
            panZoomBar.Orientation = orientation;
        }
    }

    private void SwapAxes()
    {           
        // Swapping code here

        this.Dispatcher.BeginInvoke((Action)(() =>
        {
            this.TrySetOrientation(this.chart.HorizontalAxis, Orientation.Horizontal);
            this.TrySetOrientation(this.chart.VerticalAxis, Orientation.Vertical);
        }));
    }

    Please let me know if this works for you.

    Regards,
    Martin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready