Time for action — the chart showing the actual versus the projected revenue

  1. Create a copy of MultiSeriesChart.html in the same folder and name it as ActualVsProjected.html.
  2. Change the reference of the chart SWF file in the embedding code to MSCombi2D.swf. This SWF renders a 2D combination chart with a single y-axis.
  3. Change the XML URL to ActualVsProjected.xml in the chart embedding code.
  4. Create an XML file with the name ActualVsProjected.xml in the same folder and write the following data in it:
    <chart caption='Harry&apos;s SuperMart' subcaption='Revenue by Year' xAxisName='Year' yAxisName='Amount' numberPrefix='$'>
    <categories>
    <category label='2009' />
    <category label='2010' />
    <category label='2011' />
    </categories>
    <dataset seriesName='Actual Revenue'>
    <set value='1487500' />
    <set value='2100600' />
    <set value='2445400' />
    </dataset>
    <dataset seriesName='Projected Revenue' renderAs='Line' dashed='1' showValues='0' color='666666'>
    <set value='1216500' />
    <set value='2043400' />
    <set value='2292400' />
    </dataset>
    </chart>
    
  5. Open ActualVsProjected.html in your browser. You should see a chart similar to the following screenshot:
    Time for action — the chart showing the actual versus the projected revenue

What just happened?

We just created a combination chart to compare the actual revenue of Harry's SuperMart to the projected revenues, which were set as a target. For a change, we have plotted it as a 2D chart using MSCombi2D.swf. The XML data is similar in structure to the multi-series chart. The three years that form the x-axis labels are provided as<category> elements. There are two data series in the chart, one representing the actual revenue, and the other, projected revenue. There are a few new attributes that we have added to the<dataset> element of the data series representing the projected revenue, as the following line of code:

<dataset seriesName='Projected Revenue' renderAs='Line' dashed='1' showValues='0' color='666666'>

The first attribute renderAs='Line' instructs FusionCharts to render this series as a line series. The other possible values are Column and Area for this chart. As this line in the chart reflects guidance of revenues, we have visually indicated this by plotting it as a dashed line using the attribute dashed='1'. Thereafter, we have turned off the display of the data values for this series using showValues='0' to avoid cluttering of too many data values. Finally, we have provided a custom color for this series using color='666666'.

Simple, isn't it? Let us now build the second type of combination chart, to compare the revenues versus units of products sold.