Next
Update
Prev
Default

You can display axis labels with the format defined in the JavaScript function. To use the user-defined function, you must set a JavaScript function name to the value of the labelJsFunction attribute in the Axis or AxisRenderer element tags ( e.g. <LinearAxis>, <ScrollableAxisRenderer> ).

This sample chart is to show how to define a JavaScript function to display the user-defined Y-axis label.

...
<Line2DChart ...  >
'''
  <verticalAxis>
    <LinearAxis ... labelJsFunction="axisLabelFunc" > 
  </verticalAxis>
...


function axisLabelFunc(id, value)()
{
  var s = insertComma(value);
  return "$" + s;
}

function insertComma(n)()
{
  var reg = /(^[+-]?\d+)(\d{3})/;   // Regular expression
  n += "";
  while (reg.test(n))
    n = n.replace(reg, '$1' + "," + '$2');
	
  return n;
}

© 2017 KoolChart. All rights reserved.