官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 华安县| 城步| 松潘县| 巴南区| 浦县| 安国市| 丰都县| 鞍山市| 边坝县| 庆元县| 达拉特旗| 延吉市| 鹿泉市| 宝坻区| 乐都县| 宝坻区| 汶上县| 方城县| 宣化县| 萨嘎县| 华坪县| 仙居县| 谢通门县| 沙河市| 全州县| 镶黄旗| 内江市| 万荣县| 白沙| 瑞金市| 洛隆县| 怀宁县| 永平县| 浦江县| 济阳县| 桃园市| 呼图壁县| 玉山县| 仪陇县| 满洲里市| 通城县|