javascript - Format axis on Google Annotation Chart (ScaleFormat option) -
i have google annotation chart showing values between 0 , 1 seen here: jsfiddle
google.setonloadcallback(drawchart); function drawchart() { var info = new google.visualization.datatable(); data.addcolumn('date', 'date'); data.addcolumn('number', 'kepler-22b mission'); data.addcolumn('string', 'kepler title'); data.addcolumn('string', 'kepler text'); data.addcolumn('number', 'gliese 163 mission'); data.addcolumn('string', 'gliese title'); data.addcolumn('string', 'gliese text'); data.addrows([ [new date(2314, 2, 15), 0.12400, undefined, undefined, 0.10645, undefined, undefined], [new date(2314, 2, 16), 0.24045, 'lalibertines', 'first encounter', 0.12374, undefined, undefined], [new date(2314, 2, 17), 0.35022, 'lalibertines', 'they tall', 0.15766, 'gallantors', 'first encounter'], [new date(2314, 2, 18), 0.12284, 'lalibertines', 'attack on our crew!', 0.34334, 'gallantors', 'statement of shared principles'], [new date(2314, 2, 19), 0.8476, 'lalibertines', 'heavy casualties', 0.66467, 'gallantors', 'mysteries revealed'], [new date(2314, 2, 20), 0, 'lalibertines', 'all crew lost', 0.79463, 'gallantors', 'omniscience achieved'] ]); var chart = new google.visualization.annotationchart(document.getelementbyid('chart_div')); var options = { displayannotations: true, scaleformat: '#' }; chart.draw(data, options); }
by default, vertical axis formatted integer, not ideal reading chart. documentation has scaleformat alternative (default '#' integer) not give alternatives. cannot other number format options in documentation work.
how can format y axis ticks numbers 1 decimal?
#
example, can format way want. number 1 decimal, need do:
scaleformat: '#.#'
javascript charts google-visualization
No comments:
Post a Comment