Search code examples
dimple.js

Measure axis - limit tick values


I have chart looking like that:

Chart

I use measure axis for Y:

y = myChart.addMeasureAxis("y", "rate");
y.tickFormat = ",.4f";

As you can see ticks starts from 0.0000 while data has values starting from a bit above 3.0000.

Is it possible to display y ticks starting from 2.5000 for example?

I tried:

y.overrideMin = 2;

but it does not work as I expect. The x axis disappears:

chart Thank you.


Solution

  • I'm afraid overriding minimum axis values is a little suboptimal at the moment. There is a workaround but it's a bit of a hack. Basically you just hide the x axis entirely and draw a second chart with no series over the top, hiding the second chart's y axis.

    So after drawing do:

    c2 = new dimple.chart(svg, data);
    c2.addCategoryAxis("x", "Day");
    c2.addMeasureAxis("y", "Value").hidden = true;
    c2.draw();
    

    The two axes meet up nicely and look the way you would want.

    Here is a working example:

    http://jsfiddle.net/87GHM/2/