diff --git a/src/fr/devinsy/statoolinfos/htmlize/charts/BarChartView.java b/src/fr/devinsy/statoolinfos/htmlize/charts/BarChartView.java index 6505145..5fe83a5 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/charts/BarChartView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/charts/BarChartView.java @@ -101,21 +101,26 @@ public class BarChartView lines.append(" {\n"); lines.append(" xAxes:\n"); lines.append(" [{\n"); - lines.append(" ticks: \n"); - lines.append(" {\n"); - lines.append(" beginAtZero: true\n"); - lines.append(" },\n"); - lines.append(" stacked: ").append(chart.isStacked()).appendln(","); + lines.append(" ticks:\n"); + lines.append(" {\n"); + lines.append(" beginAtZero: true\n"); + lines.append(" },\n"); + lines.append(" stacked: ").append(chart.isStacked()).appendln(","); lines.append(" }],\n"); lines.append(" yAxes:\n"); lines.append(" [{\n"); - lines.append(" ticks: \n"); + lines.append(" ticks:\n"); + lines.append(" {\n"); + lines.append(" beginAtZero: true,\n"); + lines.append(" suggestedMax: 10,\n"); + lines.append(" precision: 0,\n"); + lines.append(" callback: function(value, index, values)"); lines.append(" {\n"); - lines.append(" beginAtZero: true,\n"); - lines.append(" suggestedMax: 10,\n"); - lines.append(" precision: 0\n"); - lines.append(" },\n"); - lines.append(" stacked: ").append(chart.isStacked()).appendln(","); + lines.append( + " if (value > 1000000000) return value/1000000000 + 'G'; else if (value > 1000000) return value/1000000 + 'M'; else if (value > 1000) return value/1000 + 'k';else return value;\n"); + lines.append(" }\n"); + lines.append(" },\n"); + lines.append(" stacked: ").append(chart.isStacked()).appendln(","); lines.append(" }]\n"); lines.append(" },\n"); lines.append(" animation:\n");