I am trying to create a pie chart using an array that removes the data from the XML file. It displays the pie chart but the size of the area is not consistent with the values of the array. Surprisingly, if I use a constant array then the code works
this is the XML file:
& Lt; A2 & gt; A2 & lt; / A2 & gt; & Lt; C & gt; 20 & lt; / C & gt; & Lt; C & gt; 30 & lt; / C & gt; & Lt; C & gt; 50 & lt; / C & gt; & Lt; C & gt; 60 & lt; / C & gt; & Lt; C & gt; 70 & lt; / C & gt; & Lt; / A & gt; This is a javascript file (I've just written the main code):
var x = xmlDoc.getElementsByTagName ("A"); Var myvalues = New Array (); Var staticarray = {5,5,5}; (I = 0; i & lt; x.length; i ++) {myvalues [i] = x [i] .getElementsByTagName ("c") [0] .childNodes [0] .nodeValue; } $ (Document) .ready (function () {$ .jqplot.config.enablePlugins = true; plot1 = $ .jqplot ('chart1', [myvalues]); // plot2 = $ .jqplot ('chart2' , [StaticRay]), // WORKS
to use parseInt () Change node value in an integer.
gt; Printer> script type = "text / javascript" src = "http://ajax.googleapis.com / Ajax / lbs / jquery / 1.5.2 / jquery.min.js "> gt; & lt; / scripts & gt; script type =" text / javascript "src =" js / jquery.jqplot.min. Js "& gt; & lt; / sc Script> type = "text / javascript" src = "js / plugins / japplot.pdf. Render.money.js"> gt; & lt; / script & gt; link rel = "stylesheet" Type = "Text / CSS" href = "css / jquery.jqplot.min.css" />
Comments
Post a Comment