Show the Tick-label value

1 Answer 137 Views
Chart
Magnus
Top achievements
Rank 1
Magnus asked on 23 Dec 2022, 12:17 PM

Hi! I'm building an UWP app and having some issues with the bar graph.

I would like to show the value-label for each Tick instead of categoryname.

Like the example in the attached image that is from another application:

As you can see there is no Label for the bar, only labels for the tick. How do I do that in an UWP application.

1 Answer, 1 is accepted

Sort by
0
Didi
Telerik team
answered on 26 Dec 2022, 07:50 AM

Hi Magnus,

The labels on the x axis shows the values for the x, the labels on the y axis, shows the values on y. If you want to display the values for the BarSeries you have to set the ShowLabels property to the Series. The same property is available for the axis. 

For example: 

<telerikChart:RadCartesianChart>
    <telerikChart:RadCartesianChart.HorizontalAxis>
        <telerikChart:CategoricalAxis ShowLabels="True"/>
    </telerikChart:RadCartesianChart.HorizontalAxis>
    <telerikChart:RadCartesianChart.VerticalAxis>
        <telerikChart:LinearAxis ShowLabels="True"/>
    </telerikChart:RadCartesianChart.VerticalAxis>
    <telerikChart:BarSeries ItemsSource="{Binding}" ShowLabels="True"/>
</telerikChart:RadCartesianChart>

This is the approach I can suggest. I hope it will be of help. 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Magnus
Top achievements
Rank 1
commented on 26 Dec 2022, 08:52 AM

Hmm.. that was not exactly what I asked for, so I reformulate the question a little bit then.

If i use the X-axis "Label" then the label is centered below the bar. I dont want that. In my case I want to have the number 0 below the 0-tick, the number 0.1 below the 0.1 tick, the 0.2 below the 0.2 tick and so on.

That is why I asked if there is some kind of hidden "Tick-label" that I have missed.

The other way to to this is to move the label so It is centered below the thick instead of centered below the bar. I tried that by setting a Style on the Label that moved the label with margin but when I then rescaled the application the margins got misaligned.

As you can se in the image the numbers are centered below the tick, not the bar..

Didi
Telerik team
commented on 26 Dec 2022, 09:20 AM

To show the label text on ticks you have to use the CategoricalAxis PlotMode property set to OnThicks: https://docs.telerik.com/devtools/universal-windows-platform/controls/radchart/cartesianchart/axes/categoricalaxis#properties  

OnTicks: Data points are positioned over each tick.

The property is available for Categorical and DateTime Axis.  

 
Magnus
Top achievements
Rank 1
commented on 26 Dec 2022, 11:13 AM

Still not want I want.

1: PlotMode = "BetweenTicks"

As you can see that the numbers are centered under the bar.

Image below is PlotMode = "OnTicks".

As you now see that the numbers are still centered to the bar but the bar has moved to the tick itself. This means that the number is on the right place, but the bar is not.

The third option here is PlotMode="OnTicksPadded"

As you can see this is even more wrong.

In the image below I tried to fill in with lines and text what I want to achieve:

 

Didi
Telerik team
commented on 26 Dec 2022, 11:30 AM

Hello Magnus,

The axis labels and bars are drawn as expected. The PlotMode property and its values are described in the documentation. 

There isn't a combination to have the axis labels on ticks and the bar between the ticks.

Tags
Chart
Asked by
Magnus
Top achievements
Rank 1
Answers by
Didi
Telerik team
Share this question
or