javascript - Google Chart odd rounding for values -
So I'm using the jquery plugin to create a good pie chart on my website. The problem is that the plugin is rounding values very oddly.
This is the table that I give it to:
& lt; Table id = "piechart" & gt; & Lt; Captions & gt; Priebezné výsledky ankety & lt; / Caption & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; Th & gt; Tuto formula vzdelávania využívame uj dlhšiu dobu & Lt; / Th & gt; & Lt; Th & gt; Som zastcom štandardnej prezenčnej formy vzdelávania & Lt; / Th & gt; & Lt; Th & gt; If you have any questions, please feel free to contact us at any time. & Lt; / Th & gt; & Lt; Th & gt; Dotraj Som Nipokel O Lazito Forms vzdelawvania, El Zozalo Ma. & Lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; Th & gt; 100 & lt; / Th & gt; & Lt; TD & gt; 7.7 & lt; / TD & gt; & Lt; TD & gt; 30.8 & lt; / TD & gt; & Lt; TD & gt; 53.8 & lt; / TD & gt; & Lt; TD & gt; 7.7 & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt;
But the values displayed in the pie chart are as follows:
7.2 (should be 7.7) 30.9 (should be 30.8) 54.6 (should be 53.8) 7.2 (Must be 7.7)
What's the reason behind this? I think this Google chart API can have some weird rounds?
Update:
The jquery plugin generates an iframe like this:
& lt; Iframe scrolling = "no" height = "300" frameborder = "0" width = "720" name = "chart_frame_22518" id = "chart_frame_22518" marginhight = "0" marginwidth = "0" & gt; & Lt; / Iframe & gt;
I changed it to a jQuery plugin:
< Code> lines (in the index) {$ (this) .find ('TD'). Each (function (index2) {data.setCell (index 2, index + 1, parasent ($ (this) .text ()));});});
To do this:
rows.each (function (index) {$ (this) .find ('TD'). (Index 2) {Data.setCell (Index 2, Index + 1, Paras Flot ($ (this) .text ()));});});
Actually I changed parseInt () for parseFloat ().
And it starts working :)
Comments
Post a Comment