I. Introduction
Fusioncharts is a chart component based on XML and Flash. fusioncharts free is free of charge and has powerful and beautiful functions.
Online Demo: http://www.fusioncharts.com/free/demos/Blueprint/
It can be used in PHP, JSP, ASP, and so on.
Ii. Common chart types
1. Area Chart
2. Bar Chart
3. Column chart
4. line diagram
5. pie diagram
6. Stacked Diagram
7. Combine Diagram
Iii. Data sources
The data source is in the form of XML, which is divided into single sequence and multi-sequence XML, and other formats.
Iv. Simple use
Directory structure:
Test.html
Data. xml
Fusioncharts
| ---------- Charts
| ------------- Invalid charts *. SWF
| ---------- Jsclass
| ------------- Fusioncharts. js
Test.html code:
<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd"> <br/> <HTML> <br/> <pead> <br/> <meta http-equiv = "Content-Type" content = "text/html; charset = GBK "> <br/> <MCE: script language =" JavaScript "src =" fusioncharts/jsclass/fusioncharts. JS "mce_src =" fusioncharts/jsclass/fusioncharts. JS "> </MCE: SCRIPT> <br/> <title> figure </title> <br/> </pead> <br/> <body> </P> <p> <Table align = 'center' border = "1"> <br/> <caption> figure </caption> </P> <p> <tr> <br/> <TD> <br /> <Div id = 'pie' align = "center"> <br/> <SCRIPT type = "text/JavaScript"> <br/> var chart = <br/> new fusioncharts ('fusioncharts/charts/fcf_pie2d.swf ', "chartid", "400", "300"); <br/> chart. setdataurl ("data. XML "); <br/> chart. render ('pie '); </P> <p> </SCRIPT> <br/> </div> <br/> </TD> <br/> </tr> </P> <p> </table> <br/> </body> <br/> </ptml>
Note the following lines of code and the path:
(1) Import JS: <script language = "JavaScript" src ='Fusioncharts/jsclass/fusioncharts. js
'> </SCRIPT>
(2) Where the chart is displayed: <DivId = 'pie'
Align = "center">... </div>
(3) Script: used to set the graph and graph data to be displayed.
<SCRIPT type = "text/JavaScript">
VaR chart =
New fusioncharts ('Fusioncharts/charts/fcf_pie2d.swf
', "Chartid", "400", "300 ");
Chart. setdataurl ("data. xml ");
Chart. Render ('Pie
');
</SCRIPT>
Here, pie in chart. Render ("pie") is the ID of the DIV you want to display the Graph
Data. xml
<Graph basefont = 'sunsim 'basefontsize = '12' caption = 'analytic' subcaption = ''' yaxisminvalue = '2017. 1 'axismaxvalue = '71118. 3 'axisname = 'date' yaxisname = 'qty 'hovercapbg = 'ffecaa' hovercapborder = 'f47e00' formatnumberscale = '0' decimalprecision = '0' showvalues = '1' numdivlines =' 10 'numvdivlines = '0' shownames = '1' rotatenames = '1'> <br/> <set name = '2017-10-04 'value = '000000' color = 'afd8f8 '/> <br/> <set name = '2017-10-05' value = '000000' color = 'f6bd0f'/> <br/> <set name = '2017-10-06 'value = '000000' color = '8bba00'/> <br/> <set name = '2017-10-07 'value = '000000' color = 'ff8e46'/> <br /> <set name = '2017-10-08 'value = '000000' color = '008e8e'/> <br/> <set name = '2017-10-09 'value = '2017 'color = 'd64646 '/> <br/> <set name = '2017-10-10' value = '000000' color = '8e468e '/> <br/> <Set Name = '2017-10-11 'value = '000000' color = '000000'/> <br/> </graph>
The display effect is as follows:
You can also use the setdataxml method instead of storing XML files separately, as shown below:
<SCRIPT type = "text/JavaScript"> <br/> var chart = <br/> New fusioncharts ('fusioncharts/charts/fcf_pie2d.swf ', "chartid", "400 ", & quot; 300 & quot;); <br/> chart. setdataxml ("<graph basefont = 'sunsim 'basefontsize = '12' caption = 'analytic' subcaption = ''' yaxisminvalue = '100. 1 'axismaxvalue = '71118. 3 'axisname = 'date' yaxisname = 'qty 'hovercapbg = 'ffecaa' hovercapborder = 'f47e00' formatnumberscale = '0' decimalprecision = '0' showvalues = '1' numdivlines =' 10 'numvdivlines = '0' shownames = '1' rotatenames = '1'> <set name = '2017-10-04 'value = '000000' color = 'afd8f8'/> <set Name = '2017-10-05 'value = '000000' color = 'f6bd0f'/> <set name = '2017-10-06' value = '000000' color = '8bba00 '/> <set name = '1970-10-07' value = '000000' color = 'ff8e46'/> <set name = '1970-10-08 'value = '000000' color = '008e8e '/> <set name = '2017-10-09' value = '000000' color = 'd64646 '/> <set name = '2017-10-10' value = '000000' color = '8e468e'/> <set name = '2017-10-11 'value = '000000' color = '000000'/> </graph> "); <br/> chart. render ('pie'); </P> <p> <SCRIPT>