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

Y axis decimal values are repeated in bar charts

3 Answers 323 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Software Procurement
Top achievements
Rank 1
Software Procurement asked on 06 Aug 2014, 11:27 AM
In my barchart Y axis decimal values are repeated when i displayed values as one decimal place(please check the attachment)

From my jsonData i got the values as 0.2 after fixed decimal places. the problem appears when template is used like below
  axislable = [{<br>                    title: { text: this._properties['chart.y-axis.label'] },<br>                    labels: {<br>                        template:  "#=  kendo.toString(value, '0,.0;(0,.0)') #" + cuntomPrimaryFormat<br>                    },

when i remove the template it will working fine? please let me know what's wrong with my custom template? my requirement is the y axis should come as 0.0,0.1,0.2
Full Code
 $("#KPIGraphCommon").kendoChart({<br>            legend: {<br>                position: "top"<br>            },<br>            series: this._properties['chart.x-axis'],<br>            valueAxes: axislable,<br>            categoryAxis: catagoryAxisValue,<br>            theme: "Metro",<br>            tooltip: {<br>                visible: true,<br>                format: "{0}%",<br>                template: this._properties['chart.y-axis.label'].indexOf("Amount") > -1 || this._properties['chart.y-axis.label'].indexOf("Days") > -1 ? "#= series.name #: #=  kendo.toString(MinusFormat(value)) #" : "#= series.name #: #=  kendo.toString(value, '0,.0;(0,.0)') #"<br>            },<br>            chartArea: {<br>                height: context.getChartHeight(),<br>                width: context.getChartWidth()<br>            },<br>        });<br>    }

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 08 Aug 2014, 05:21 AM
Hi,

You can get the axis to skip the divisions that differ only in their second decimal digit by setting a majorUnit:
valueAxis: {
    majorUnit: 0.1
}


The default is based on the data and is likely 0.05 in your case.

I hope this helps.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Software Procurement
Top achievements
Rank 1
answered on 08 Aug 2014, 11:07 AM
I had already try your solutions but not  fix . the data i got from server is 0.2 with one decimal.can you please provide some other solutions?
0
T. Tsonev
Telerik team
answered on 11 Aug 2014, 08:03 AM
Hi,

I've prepared a short sample that I believe reproduces your original issue.

By uncommenting the majorUnit setting the duplicate labels seem to be resolved.
Perhaps I'm missing something?

Regards,
T. Tsonev
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
Software Procurement
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Software Procurement
Top achievements
Rank 1
Share this question
or