Search code examples
javascriptd3.jssvgnvd3.jsdimple.js

Dimplejs Vertical 100% Bar Decimal


I working with Dimplejs, I created my chart, however; I am having difficult time setting tickFormat to decimal. When you hover over bar you will get "Percent: 24%", but I want is to get whatever is the percent value set too. such "Percent: 24.1%"

fiddle

      var myChart = new dimple.chart(svg, data);
  myChart.setBounds(65, 45, 505, 315)
  myChart.addCategoryAxis("x", "YRMO");
  var y = myChart.addPctAxis("y", "Percent");
  myChart.addSeries("halfit", dimple.plot.bar);
  myChart.addLegend(200, 10, 380, 20, "right");
  y.tickFormat = ".1f";
  myChart.draw();

this is not my fiddle, but its same idea, if you change value to decimal. chart rounds the decimal.


Solution

  • Okay I just solve my own question for the first time. Here is how it done.

     bars.getTooltipText = function (e) {
                return [
                    "Point : " + e.aggField[0] + "",
                    "Value : " + e.yValue + "%",
                    "Series : " + e.cx + ""
                ];
            };