Hi,
I want to create a basical pie chart with this XMLfile:
31 #80ff7a
1
11 #bdff33
2
…
Can someone explain me how can I use the chart.load(“some.xml”, “xml”) function in the script?
I cannot obtain a result with that function while I do with that instead of the function:
var data = [
{ count:“31”, result:“1” ,color:“#80ff7a”},
{ count:“11”, result:“2” ,color:“#bdff33”},
{ count:“7”, result:“3” ,color:“#ff9e2a”},
{ count:“9”, result:“4” ,color:“#ff561b”},
{ count:“7”, result:“5” ,color:“#ff71be”},
{ count:“6”, result:“6” ,color:“#ffea69”}
];
pieChart.load(“Running.xml”, “xml”); must be loaded AFTER the window is loaded
You can’t use pieChart.parse(data,“xml”); if you haven’t define it. If you have xml - you must load your chart structure from this file.
[code]
Pie Chart
Pie Chart
[/code]
If you have XML data, you need to use load() method: dhtmlx.com/docs/products/dht … d_xml.html
If you have JSON data, you need to use parse() method: dhtmlx.com/docs/products/dht … _json.html
With with the relevant data structure
About XML you know (you have posted xml structure in the 1th message).
And JSON need to be placed before chart init or you can load it from json file using the name of the object.
I did download DHTMLXSuite_v403_std. I have “dhtmlxchart.js” at “\dhtmlxSuite_v403_std\sources\dhtmlxChart\codebase” but i don’t find “dhtmlxchart.css” anywhere in the package.
Thanks for your quick reply.
In your example, you have a line
.
That is why I was looking for dhtmlxchart.css file. And also I did copy your code and made xml file but did not get it working. IE just shows title "pie chart" and blank square box. i kept html and xml files under "\dhtmlxSuite_v403_std\sources\dhtmlxChart".
It seems like you have mixed 3.6 and 4.0.3 version… Could you provide us completed demo to inspect the issue? docs.dhtmlx.com/auxiliary_docs__ … pport.html
Now we use (and recommend) compilled dhtmlx.js and dhtmlx.css files
One more question regarding loading data from xml file. I am trying to load “dhtmlxSuite_v403_std\samples\dhtmlxChart\01_initialization\01_load_xml.html”.I got it working if i access through IIS but its not working when i load html in web browser. I am getting following error:
XMLHttpRequest cannot load file:///C:/Users/stealthbits/Desktop/dhtmlxSuite_v403_std/samples/dhtmlxChart/common/data.xml. Cross origin requests are only supported for HTTP. /C:/Users/stealthbits/Desktop/dhtmlxSuite_v403_std/samples/dhtmlxChart/01_initialization/01_load_xml.html:1
Uncaught NetworkError: Failed to execute ‘send’ on ‘XMLHttpRequest’: Failed to load ‘file:///C:/Users/stealthbits/Desktop/dhtmlxSuite_v403_std/samples/dhtmlxChart/common/data.xml’. /C:/Users/stealthbits/Desktop/dhtmlxSuite_v403_std/codebase/dhtmlx.js:9
Attaching.
Attached is demo project.
Why i am asking this question because Our application creates reports and it publish on IIS and it opens html file in web browser too. Currently we are using flash for charting but we would like to upgrade it to DHTMLX 4.0. Load_XML.zip (297 KB)