DWUser.com
Empowering Web Creativity
Support Center - LineChart Component for Flash
Installation
When you download the LineChart_vvv.mxp file (where vvv is the version number), save the file to an easy-to-find location. Next, launch Flash and select Help > Manage Extensions to launch the Extension Manager. Click the Install button, browse to the MXP file you downloaded and saved, then click OK and allow the installation to complete. Restart Flash, and the extension will be ready to use.
Basic Usage
To use the component, you must be using an Actionscript 2.0 document and publish to Flash Player 7 or higher. The component is not compatible with AS 3.0 projects.
First, open the Components Panel (Window > Components (for older versions of Flash, Window > Development Panels > Components). In the Charting Components folder, you'll find the LineChart component. To add the component to your library, drag the LineChart item onto your stage and drop it. Then, press the Delete key to immediately remove the just-created instance. The LineChart component will now reside in your FLA's library.
Next, switch to the movieclip where you want to display a chart (this could be the main stage). Open the Actions panel (Window > Actions), and add actionscript to initialize an instance of the component. The following example code creates the example chart shown on the main product page:
import com.dwuser.charting.LineChart; this.createClassObject(LineChart, "chart", getNextHighestDepth(), {_x:25, _y:50}); chart.setSize(400, 300); chart.numberPrefix = "$"; chart.numberPostfix = "K"; chart.points = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; chart.plotLine({Sunday:12, Monday:5, Tuesday:15, Wednesday:10, Thursday:18, Friday:30, Saturday:26}, "Assets"); chart.plotLine({Sunday:10, Monday:5, Tuesday:15, Wednesday:10, Thursday:20, Friday:24, Saturday:25}, "Liabilities"); chart.plotLine({Sunday:8, Monday:7, Tuesday:10, Wednesday:1, Thursday:4, Friday:19, Saturday:24}, "Captital"); chart.plotLine({Sunday:6, Monday:17, Tuesday:12, Wednesday:3, Thursday:9, Friday:34, Saturday:12}, "Income"); chart.plotLine({Sunday:3, Monday:1, Tuesday:15, Wednesday:6, Thursday:7, Friday:30, Saturday:18}, "Expenses"); this.createEmptyMovieClip("legend_mc", getNextHighestDepth()); legend_mc._x = 450; legend_mc._y = 50; chart.drawLegend(legend_mc);
Detailed Reference
The following is the detailed API reference for the LineChart class and component:
Advanced Customization: Editing the Class File
If, for example, the default calculations for the vertical axis bounds are inappropriate for your application, you can edit the source file for the component to make desired changes. To do this:
- Create a new com/dwuser/charting/ folder path in your FLA application's root directory
- Copy the (Flash Configuration Folder)/Classes/com/dwuser/charting/LineChart.as file in to the newly created directory. (If you can't locate the file, try runing a search for LineChart.as and include hidden/system folders).
- In Flash, open Edit > Preferences... (Flash > Preferences... on Mac), Actionscript Tab, Actionscript 2.0 Settings..., Classpath section. Make sure that the "." is the very first item.
- Open the new copy of LineChart.as. Make modifications as desired.
- Save and re-export your FLA file
Resetting Chart Data
If your application has trouble with chart data persisting even after trying to remove a chart, try using the following code:
_global.com.dwuser.charting.LineChart.__hPoints = []; _global.com.dwuser.charting.LineChart.__lines = [];
Interactive Support Options
Can't find an answer in the on-demand options? Try interacting with other users on the forums or contacting support: