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

value axis format labels to positive numbers

2 Answers 269 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Amrinder
Top achievements
Rank 1
Amrinder asked on 18 Jun 2012, 05:40 PM
Hi Kendo Team,

Scenario:
I would like to draw two area charts in a single chart such that one of them is drawn above the category axis and the other one below the category axis, with only positive numbers being displayed along the value axis.

Partial solution:
I drew one chart with positive values and the other with negative values and it is working as expected i.e. showing negative labels for the chart drawn with negative values. I would like to format the values axis to display positive numbers (for the numbers in negative direction). Is this possible?

Ideally, I would like to be able to draw the second chart with positive values but in reverse direction (this will help display positive labels for the second chart). I know there is an option to reverse the value axis but not sure how can I use it to draw two charts - one in normal direction and other in reverse.

Thanks,
Amrinder

2 Answers, 1 is accepted

Sort by
0
Accepted
Iliana Dyankova
Telerik team
answered on 20 Jun 2012, 03:25 PM
Hi Amrinder,

To achieve this you could use a template for the labels of the valueAxis. In this template implement a custom logic, which remove the "minus" symbol. For example: 
$("#chart").kendoChart({
 //...
  valueAxis:{
    labels: {
      visible: true,
      template: "#= Math.abs(value) #"
    }
  }
 //...
});

I hope this helps.

Regards,
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!
0
Amrinder
Top achievements
Rank 1
answered on 20 Jun 2012, 03:45 PM
Works great, thanks!

-Amrinder
Tags
Charts
Asked by
Amrinder
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Amrinder
Top achievements
Rank 1
Share this question
or