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

How to show only the actual data Point X values as Labels in Axis?

4 Answers 343 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Shilpa
Top achievements
Rank 1
Shilpa asked on 22 Feb 2016, 12:09 PM

Hi,

I am going to use a RadCartesianChart to show a point series with  DataTimeContinuousAxis as my Horizontal axis and Linear Vertical axis. My requirement is that I want to show only those DateTime axis labels where I have some data point. Also instead of showing it as DateTime I want to bind to some other string.Except those other axis labels should be hidden (where no data point is present). How do I Achieve this? 

Thanks,

Shilpa

4 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 25 Feb 2016, 10:00 AM
Hello Shilpa,

If we understand you correctly you want to show only the labels on the Horizontal axis which have DataPoint and present them with a string different from the date format. Correct us if we are wrong. Basically, DateTimeContinuousAxis is like a numerical axis and the values are always sorted chronologically. For example, you cannot have one step represented by one day and then another step for two days interval. If it is appropriate for your scenario we advise you to consider using CategoricalAxis instead. 

As for the second question in your post, using a CategoricalAxis you can specify a string which will represent the label values and bind it to the X value of the data points, instead of the date property.

Hope this information is helpful.

Regards,
Dinko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Shilpa
Top achievements
Rank 1
answered on 27 Feb 2016, 02:34 PM

Hi Dinko,

I would like to restate, I am using a Linear axis as Horizontal and Vertical. In the horizontal axis I want to make only those axis Labels visible where I have original DataPoints. (Eg. Say my points are pt1=(2,10) pt2= (6,5) pt3=(7,4). Make only 2,6,7 visible in horizontal axis. Also instead of 2, 6,7 I want to display strings (2=second, 6=Sixth,7=Seventh). How do I acheive this? I cannot use categorical axis because the chart is continuous. And positions of 2,6,7 should be as in Linear Axis.

0
Dinko | Tech Support Engineer
Telerik team
answered on 02 Mar 2016, 04:55 PM
Hi Shilpa,

The Linear axis doesn't support the behavior mentioned in your last reply out of the box. Basically, the Linear axis is a continuous one the chart tries to position labels in a numerical manner and at equal distances (evenly distributed). For example, 0, 5 and 10 are evenly distributed, where 2, 6 and 7 are not (because 2 is much closer to 6 than 7 is).

We think that in order to clearly visualize the scenario, it would be best if you leave the numerical axis as it is and use datapoint labels (ShowLabels property of the series). This way, the user will know very well the range of the axis and he will also see the labels of the data points, so their values will be clear too.

If you insist on the look you describe, you can hide the labels on the Horizontal axis using the ShowLabels property set to false. Then you can create custom annotations for the values you want to display, and position them at the bottom, where the horizontal axis is. You can take a look at the following resources below:
Custom Annotations - help article which describes how you can create a custom annotation.
- ChartView Annotation - online example demo which demonstrates a possible way of using annotation
AnnotationTypes - SDK example where you can examine the different types of annotations

Regards,
Dinko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Shilpa
Top achievements
Rank 1
answered on 04 Mar 2016, 02:29 AM

Hi Dinko,

Thank you very much for the detailed information. I too feel by showing Labels on points and annotations this could be achieved. 

Thanks,

Shilpa

Tags
ChartView
Asked by
Shilpa
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Shilpa
Top achievements
Rank 1
Share this question
or