使用dimple.js绘图时角度不正确

时间:2014-12-08 10:45:33

标签: dimple.js

我正在绘制一张d3图表。     该图表在http://dimplejs.org/examples_viewer.html?id=pie_matrix给出。     但是当我用饼图中的数据绘制图表时,总百分比为99%。不是100%。

    var svg = dimple.newSvg("#ChartName", 590, 400);
        var myChart = new dimple.chart(svg, data);
        myChart.setBounds(95, 25, 475, 335);
        var x = myChart.addCategoryAxis("x", "Month");
        x.addOrderRule("mno");
        myChart.addCategoryAxis("y", "AgeGroup");
        var p = myChart.addMeasureAxis("p", "cnt");
        p.tickFormat="02d";
        var pies = myChart.addSeries("event", dimple.plot.pie);
        pies.radius = 25;
        myChart.addLegend(240, 10, 330, 20, "right");
        myChart.draw();


Am using http://dimplejs.org/dist/dimple.v2.1.0.min.js.


Example while i  plot, i get 50% not 50.00% , because of rounding of angle for plotting it is showing wrongly. Can you people please tell how to remove the round of.

The data from database is correct. It is a count like 100,200 etc.while plotting pie with that values it is showing wronly.



Example
--------

Count1 =562
Count2 =62
Count3 =53
Count4 =39  

While Plotting with these values in pie chart i got Count1 = 78%, Count2 = 9%, Count3 = 7%, Count4 = 5%.

Total is 99%.Not 100%.
While finding percentage manually we get upto 2 spaces after .

1 个答案:

答案 0 :(得分:0)

尝试在绘图后设置刻度格式,这样就不会干扰图表绘制,但会影响工具提示。