javascriptdimple.js

Dimple.js change axis units format


I have charts using dimple.js to show frequencies of objects. Some of them are thousands of objects and instead of showing 20,000 it shows 20k. This is no good for me at all, is it possible to change the format? I haven't been able to figure out how.

This is my chart

drawthis=JSON.parse(JSON.stringify(frequencies));
var chartsize=frequencies.length*drawxsize;
var svg = dimple.newSvg("#chartContainer", chartsize, 400);
var myChart = new dimple.chart(svg, drawthis);
myChart.setBounds(60, 30, chartsize-50 , 330)
var x = myChart.addCategoryAxis("x", ["Code","Id"]);
myChart.addMeasureAxis("y", "freq");
myChart.addSeries("expId", dimple.plot.bar);
myChart.addLegend(65, 10, 510, 20, "right");
x.addOrderRule(draworder,drawdesc);
myChart.draw();

This is an example of how it looks

enter image description here

Thank you all


Solution

  • Please make this changes, I believe it should solve your problem

    var y = myChart.addMeasureAxis("y", "freq");
    
    y.tickFormat = ',.1f';
    

    ',.1f gives you one decimal, if you do not want any decimal just to ',.0f'