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

Changing the values of x-axis to integer only

3 Answers 348 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 03 Jun 2012, 09:19 AM
I am using a bar chart whose category axis generates values depending upon the numbers in data. The problem is when the value of data is less, it generated the values in decimals also. Is there any way to ensure that the values generated in category axis are integers only. Please refer to attachment for the problem.

3 Answers, 1 is accepted

Sort by
0
Iliana Nikolova
Telerik team
answered on 05 Jun 2012, 03:46 PM
Hi Gaurav,

You could control the value types that are displayed via the majorUnit of the value axis - this option sets the interval between major divisions. For example: 

$("#chart").kendoChart({
   ...
   valueAxis: {
      ...
      majorUnit: 1
   },
   ...
});

I hope this helps.

Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
1
Kate | D-Flo
Top achievements
Rank 1
answered on 11 Dec 2013, 10:48 AM
Hi Iliana,

It seems that this is a popular request - to be able to make majorUni values integer only.  We use Kendo Complete package, and we build many charts for our clients - on all of them the values can range from very small to very big. So far I have a function that I call on dataSource.requestEnd that looks like this:

requestEnd: function(e){
 
    var max = 1;
    for(var i = 0; i < e.response.length; i++) {
        console.log(e.response[i]);
        if(e.response[i].Count > max)
            max = e.response[i].Count;
    };
 
    if(max <= 10)
        $("#chart").data('kendoChart').options.valueAxis.majorUnit = 2;
    else
        $("#chart").data('kendoChart').options.valueAxis.majorUnit = undefined;
 
},
Is there a plan to make this setting a property of the chart?
0
Iliana Nikolova
Telerik team
answered on 13 Dec 2013, 03:30 PM
Hi Kate,

Implementation of a similar feature is not planned, however we will appreci you wish you submit a new entry in Kendo UI UserVoice portal - this way the community would be able to vote / comment it and if the suggestion gains popularity we will consider it for future releases.

Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Iliana Nikolova
Telerik team
Kate | D-Flo
Top achievements
Rank 1
Share this question
or