PDA

View Full Version : Custom Label (Y axis) for a Line Chart



allanmike.jandayan
16 Mar 2016, 7:09 AM
Hello Everyone!


data: [ ['W1',"Avail Qtr Opty",76343,"In-Period Bookings",20031],
['W2',"Avail Qtr Opty",178990,"In-Period Bookings",143459],
['W3',"Avail Qtr Opty",275758,"In-Period Bookings",208139],
['W4',"Avail Qtr Opty",464345,"In-Period Bookings",299032],
['W5',"Avail Qtr Opty",580025,"In-Period Bookings",384006],
['W6',"Avail Qtr Opty",734469,"In-Period Bookings",406092],
['W7',"Avail Qtr Opty",857489,"In-Period Bookings",501320],
['W8',"Avail Qtr Opty",969641,"In-Period Bookings",559783],
['W9',"Avail Qtr Opty",1076497,"In-Period Bookings",559783],
['W10',"Avail Qtr Opty",1173833,"In-Period Bookings",559783],
['W11',"Avail Qtr Opty",1279387,"In-Period Bookings",559783],
['W12',"Avail Qtr Opty",1412080,"In-Period Bookings",559783],
['W13',"Avail Qtr Opty",1736327,"In-Period Bookings",559783]
]

attached is my data for the line chart with 2 variables, the values vary from 0-2 million, how can I customized the label on the Y axis to only display 0M, 1M and 2M?


A reply will be much appreciated.

Also, how could I generate this kind of data (I mean in that form above) in php? I want to use a ajax request that will retrieve data in php.. Thanks again!

Gary Schlosberg
16 Mar 2016, 11:48 AM
Perhaps you could use a label renderer to achieve this? There's an example on this page.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.chart.Label

allanmike.jandayan
17 Mar 2016, 7:32 AM
I saw the link you posted, but when i am using a label render, and put if conditions there, if 0 return '0M' if 1million return '1M' and so on, but it returns undefined in between of the values, what I want is just 0M 1M AND 2M.

Gary Schlosberg
17 Mar 2016, 1:13 PM
Perhaps something like this example will help you:
https://fiddle.sencha.com/#fiddle/17ce