Book Image

FusionCharts Beginner's Guide: The Official Guide for FusionCharts Suite

Book Image

FusionCharts Beginner's Guide: The Official Guide for FusionCharts Suite

Overview of this book

User experience can make or break any app these days, no matter whether it's a commercial product or an internal solution. While most web applications out there are boring and outdated when it comes to their charting, you can make yours both stunning and powerful using FusionCharts Suite. Once you have mastered it, you can give your users a delightful reporting experience in no time at all. FusionCharts Beginner's Guide is a practical, step-by-step guide to using FusionCharts Suite for creating delightful web reports and dashboards. Getting you started quickly, you will learn advanced reporting capabilities like drill-down and JavaScript integration, and charting best practices to make the most out of it. Filled with examples, real-life tips and challenges, this book is the firstofitstype in the visualization industry. The book teaches you to create delightful reports and dashboards for your web applications assuming no previous knowledge of FusionCharts Suite. It gets your first chart up in 15 minutes after which you can play around with different chart types and customize them. You will also learn how to create a powerful reporting experience using drill-down and advanced JavaScript capabilities. You will also connect your charts to server-side scripts pulling data from databases. Finally you round up the experience learning reporting best practices including right chart type selection and practical usability tips. By the end of the book, you will have a solid foundation in FusionCharts Suite and data visualization itself. You will be able to give your users a delightful reporting experience, from developers to management alike.
Table of Contents (16 chapters)
FusionCharts
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface

Time for action — a chart showing revenue versus units sold


  1. 1. Create a copy of ActualVsProjected.html in the same folder and name it RevenueVsUnits.html.

  2. 2. Change the reference of the chart SWF file in embedding code from MSCombi2D.swf to MSCombiDY2D.swf, to use a chart with dual axes.

  3. 3. Change the XML URL to RevenueVsUnits.xml in the chart embedding code.

  4. 4. Create an XML file with the name RevenueVsUnits.xml in the same folder and write the following data in it:

    <chart caption='Harry&apos;s SuperMart' subcaption='Revenue and Units Sold by Year' xAxisName='Year' PYAxisName='Amount' SYAxisName='Units Sold' numberPrefix='$'>
    <categories>
    <category label='2009' />
    <category label='2010' />
    <category label='2011' />
    </categories>
    <dataset seriesName='Revenue'>
    <set value='1487500' />
    <set value='2100600' />
    <set value='2445400' />
    </dataset>
    <dataset seriesName='Units Sold' parentYAxis='S' renderAs='Line' showValues='0' color='666666'>
    <set value='24355' />
    <set value='38998' />
    <set value='43987' />
    </dataset>
    </chart>
    
  5. 5. Open RevenueVsUnits.xml in your browser. You should see a chart similar to the following screenshot:

What just happened?

We just enabled Harry to compare the revenues of Harry's SuperMart for the last three years, along with the units sold. This chart gives him a perspective on how the revenues are affected by the units sold. Note how this chart has two y-axes, one on the left called primary axis, and one on the right called secondary axis. Each axis has its title defined using two new attributes of the<chart> element, PYAxisName for the primary axis, and SYAxisName for the secondary axis. The attribute YAxisName is not applicable to this chart as there is no common y-axis.

<chart caption='Harry&apos;s SuperMart' subcaption='Revenue and Units Sold by Year' xAxisName='Year' PYAxisName='Amount' SYAxisName='Units Sold' numberPrefix='$'>

The numberPrefix attribute gets applied to the primary axes. If we had to specify a number prefix for the secondary axes, we would use the attribute sNumberPrefix.

There are two data series in the chart, the first representing the revenue, and the other containing data on the units sold. The second series, representing quantity, has a new attribute parentYAxis='S' that lets you configure whether this data series is plotted against the primary axis (parentYAxis='P', by default) or the secondary axis (parentYAxis='S'). In our example, as the units sold is to be plotted against the secondary axis, on the right, we have set parentYAxis='S', the other attributes remaining the same as before.

<dataset seriesName='Units Sold' parentYAxis='S' renderAs='Line' showValues='0' color='666666'>

If you were using a 3D chart such as MSColumn3DLineDY.swf, the renderAs attribute is not required, as the chart can only plot columns on the primary axis and lines on the secondary. Just setting parentYAxis='Y' plots the data series as a line against the secondary y-axis.