javascriptd3.jsc3.js

How to format the values of c3.js y-axis?


Is there a way in c3.js to format the axis to give it 'nice' values. Such as the X-axis starts at 0 and goes by 500 increments to the max value of 2000?

enter image description here


Solution

  • You could use axis.x.tick.values (http://c3js.org/reference.html#axis-x-tick-values)

    ...
    axis: {
      x: {
        tick: {
          values: [0, 500, 1500, 2000]
        }
      }
    }
    ...