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

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

3 Answers 142 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 06 Feb 2017, 12:46 PM

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.

3 Answers, 1 is accepted

Sort by
0
Sam
Top achievements
Rank 1
answered on 06 Feb 2017, 04:11 PM

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.

0
Accepted
Martin Ivanov
Telerik team
answered on 09 Feb 2017, 10:29 AM
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.
0
Sam
Top achievements
Rank 1
answered on 10 Feb 2017, 11:10 AM
Ahh ofcourse, thanks Martin!
Tags
ChartView
Asked by
Sam
Top achievements
Rank 1
Answers by
Sam
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or