Adding Multiple Axis Labels to a Google Chart
Join the DZone community and get the full member experience.Join For Free
the axes in google charts are a bit interesting, because what they display bears absolutely no resemblance to what data is there - you label the axes separately, even if they are numbers. to label multiple things - in this example a scale and some units, you simply specify the axis more than once. to specify which axes should be shown, use chxt (chart axis title) and set something like this:
then add the labels as required, for example:
&chxr=0,0,20&chxs=0,676767,11.5,0,lt,676767& chxt=y,x,x &chbh=a
this produces a graph like this:
you can then add labels (using chxl) and ranges (uses chxr) to your axes as you wish - and even add axis labels to the top and right hand graph edges, using the t and r axes, with as many of each as you'd like, and using their list position as a parameter to the range/label settings. i hope this is useful to someone, as it took me a little bit of research to figure it out.
Published at DZone with permission of Lorna Mitchell, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.