Using the LineChart component

You can use a LineChart component wherever you need to display data for users.

LineChart parameters

You can set the following authoring parameters for each LineChart component instance in the Property inspector or in the Component inspector:

__numberPrefix specifies the prefix to be added to all labels. For example, if the chart represents dollars, you would set the __numberPrefix to be $. This value is a string. The default values is empty.

__numberPostfix specifies the postfix to be added to all labels. For example, if the chart represents thousands, you would set the __numberPrefix to be K. This value is a string. The default values is empty.

__zeroBase indicates whether the chart starts at zero (true) or not (false). If you set the value to false, then the chart will start at the lowest plot value. The default value is true.

You can write ActionScript to control these and additional options for the LineChart component using its properties and methods. For more information, see LineChart class.

Creating an application with the LineChart component

The following procedure explains how to create an example chart, and add two lines to it.

To create an application with the LineChart component:

  1. Drag a LineChart component from the Charting Components section of the Components panel to the Stage.
  2. In the Property inspector, do the following:
    • Enter the instance name demo_chart.
    • Set the X parameter to 75.
    • Set the Y parameter to 50.
    • Set the __numberPrefix parameter to $.
  3. Select Frame 1 in the Timeline, open the Actions panel, and enter the following code:

    // Specify points demo_chart.points = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
    // Plot lines demo_chart.plotLine({Sunday:12, Monday:5, Tuesday:15, Wednesday:10, Thursday:18, Friday:30, Saturday:25}, "Assets"); demo_chart.plotLine({Sunday:10, Monday:5, Tuesday:15, Wednesday:10, Thursday:20, Friday:30, Saturday:25}, "Liabilities"); demo_chart.plotLine({Sunday:8, Monday:7, Tuesday:10, Wednesday:1, Thursday:4, Friday:29, Saturday:24}, "Captital");

    This code creates a chart and plots values for Assets, Liabilities, and Capital.

  4. To clear all of the chart contents, use the actionscript as follows:
    demo_chart.removeLines();