Creating your First Multi-Series & Stacked Charts | ||||||||||||||||
In our previous example, we have seen how to create a chart using single series of data. We might want to compare the sales data for two different products. The comparison can be achieved using a Multi-Series chart which can accept multiple sets of data. Here, we will see how to build a simple Multi-Series 3D column chart comparing the "Weekly Sales Summary" for two products. Once completed, the chart will look as under: Follow the steps below to create a Multi-series chart:
Open the file ms-weekly-sales.html in a Web browser and you will see an animated Multi-Series Column 3D chart similar to the one below: See it live! Code examples discussed in this section are present in Download Package > Code > MyFirstChart folder. |
||||||||||||||||
Creating a Stacked Chart | ||||||||||||||||
If you want to group the data into cumulative stacks, you will just need to change the chart type to Stacked Column chart. The HTML file for a Stacked Column chart will look as under: | ||||||||||||||||
<html> <head> <title>My First chart using FusionCharts</title> <script type="text/javascript" src="FusionCharts/FusionCharts.js"> </script> </head> <body> <div id="chartContainer">FusionCharts XT will load here!</div> <script type="text/javascript"><!-- var myChart = new FusionCharts( "FusionCharts/StackedColumn3D.swf", "myChartId", "400", "300", "0" ); myChart.setXMLUrl("MSData.xml"); myChart.render("chartContainer"); // --> </script> </body> </html> | ||||||||||||||||
The modified HTML file can be found in Download Package > Code > MyFirstChart > stacked-weekly-sales.html. | ||||||||||||||||
In the above code, we have only changed the name of the SWF file from MSColumn3D.swf to StackedColumn3D.swf (please copy StackedColumn3D.swf file from Charts folder of the Download Pack). Open the HTML file in a Web browser. The chart will look like as under: |
||||||||||||||||
See it live! | ||||||||||||||||
What happens if Flash player is not available? |
||||||||||||||||
Troubleshooting | ||||||||||||||||
If for any reason, you do not see a chart, run through the following checks: If you see an endless loading progress bar in your browser, or if the right click menu (right click at the place where the chart is supposed to be) shows "Movie not loaded", check the following:
If you get an "Error in Loading Data" message, check the following:
If you get an "Invalid XML Data" message, it means that the XML data document is malformed. Check it again for common errors like:
To check whether your final XML is correct, open it in your browser and you will see the error. If only the text "FusionCharts XT will load here!" is displayed, check with the following:
|