Always show origin(0,0) as major grid line

4 posts, 1 answers
  1. Sam
    Sam avatar
    6 posts
    Member since:
    Sep 2016

    Posted 06 Feb Link to this post

    I'm using the RadCartesianChart and the ScatterPointSeries for the chart view and was wondering if there is a way to permanently show the origin (0,0) on the axis.

    I have the Minimum and Maximum of each axis defined by the points that are being plotted... so for instance it can occasionally display something like

    X-Axis: min -0.034... to max 0.02...
    Y-Axis: min -0.04... to max 0.035... etc.

    The major grid lines obviously tries to account for the spacing between the min and max to produce equally spaced lines. This sometimes obscures the origin axis lines. I have been able to mitigate this is some situations by forcing the min and max to be equal absolute values... 

    Taking my earlier example for instance, making:

    X-Axis: min -0.04 to max 0.04
    Y-Axis: min -0.04 to max 0.04

    [See attached image "Test Working"]

    Sometimes depending on the min/max and the spacing decided, the axis origin is still being hidden.

    [See attached image "test Not Working"]

    I was wondering if there is any way to force the origin (0,0) to be displayed at all times, i'm unable to find an option in the documentation, perhaps as a major grid line etc.

  2. Sam
    Sam avatar
    6 posts
    Member since:
    Sep 2016

    Posted 06 Feb Link to this post

    Update:

    I've managed to get the (0,0) axis to display at the top zoom level each time by a workaround behind the scenes. I manage my min/max axis value as mentioned in my opening question, but also i force a particular Major Step value depending on the min/max values.

    [See attached image: "Test - Workaround"]

    However, my original question remains. It would be useful to show the (0,0) origin as a major line at all times (at least at 100% zoom level, you could admittedly expect the (0,0) point to be off the chart and not displayed if you zoomed right in at (-100,-100) for instance).

    So perhaps an addition to my question, but potentially a different thread is can highlight the particular major line of (0,0) so it stands out among a potentially cluttered plot with many major lines.

  3. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    1258 posts

    Posted 09 Feb Link to this post

    Hi Sam,

    You can try the axis' TickOrigin property. Setting it to 0 will tell the chart to draw its ticks using the 0 value as their origin.

    As for highlighting a specific grid line, currently this is not possible. Instead, you can check the chart annotations and see if you can use one of them to highlight the desired area of the chart. For example you can use a GridLineAnnotation.

    Regards,
    Martin
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  4. Sam
    Sam avatar
    6 posts
    Member since:
    Sep 2016

    Posted 10 Feb in reply to Martin Ivanov Link to this post

    Ahh ofcourse, thanks Martin!
Back to Top