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

Format Decimals in the Horizontal Axis?

1 Answer 150 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
PoppySarah
Top achievements
Rank 1
PoppySarah asked on 21 Nov 2020, 07:31 PM
Hi. I need your help about formatting my KendoUI chart.I use KendoUI chart with my Delphi + Unigui code
My doubts are in  the figure attached. The main doubt is how to format the horizontal axis to show the desired number of decimals. I want to change from one decimal ( one number after the comma like   2200,0  ) to two decimals   (like 2200,00 ). This line of code did not work TNumericField(FieldByName('distM')).DisplayFormat :=  '#,0.00';
Code to try to fix the decimals
ChartSeries.Values['Fmod'] := 'serFmod';
ChartProperties.Values['valueAxis'] := '{labels: {format: "#,0.0"}}';             // vertical  axis  one decimal
ChartProperties.Values['tooltip'] := '{visible: true, format: "#,0.000"}';          // points   3 decimals
ChartSeriesDefaults := 'labels: {visible: true, position: "insideEnd", format: "#,0.00"}';
If needed I can send a test case using Delphi + Unigui.

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 24 Nov 2020, 12:15 PM

Hi PoppySarah,

The horizontal axis labels can be formatted through the categoryAxis.labels.format property.

categoryAxis: [{
    labels: {
      format: "{0:n3}" // This will produce 123.456. {0:n4} would produce 123.4567 and so on.
    }
}]

You can find the different number formats that kendo supports in the Number Formatting article. The same type of formatting is also true for the valueAxis and the tooltip.

Let me know if you require further assistance.

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
PoppySarah
Top achievements
Rank 1
Answers by
Georgi Denchev
Telerik team
Share this question
or