O'Reilly logo

Flex 4 Cookbook by Garth Braithwaite, Joshua Noble, Todd Anderson, Marco Casario, Rich Tretola

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 21. Charting

The Flex Charting Framework is a powerful series of data-rich controls that lets you create deep and interactive displays of many types of data. Flex defines a few of the most commonly used charts—bar charts, pie charts, and column charts—and gives you a great deal of control over their appearance. A Chart contains a ChartSeries that creates the item renderers based on the dataProvider passed to the Chart. The ChartSeries object can use an itemRenderer, have distinct dataFields from the dataProvider used to display data in that ChartSeries, use display effects, and have distinct properties set to handle user interaction. The Flex Charting Framework is an immense topic, and as such the recipes in this chapter can cover only a small set of the possibilities. It should also be noted that the Flex Charting components are part of the Flex data visualization package, which is included in the Flex Builder Professional Edition and not in the Standard Edition or with the free Flex 4 SDK.

21.1. Create a Chart

Problem

You want to add a chart to your application.

Solution

Create a chart of the desired type and add the appropriate ChartSeries object for that ChartType, and then add a dataProvider to the ChartSeries.

Discussion

Charts come in a variety of types, and it’s important to know what you have in your toolbox before you start working.

For every chart type, there is a corresponding ChartSeries. To add a series of data visualized as a particular type, you add the corresponding ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required