Tutorials Home
What's New
Top Rated
Submit
myTutes
Random!
Dynamic charts
Author: Sas Jacobs
| Website: http://www.sasjacobs.com |
Setting the bar chart data provider
We start by creating an array for the labels and values and creating a new
instance of the DataProviderClass.
var arrLabel = new Array();
var arrValue = new Array();
var ChartData = new DataProviderClass();
We loop through each of the text fields and add their value to the labels and
values arrays. Then we add the information to the data provider and assign
field names of DataLabel and DataValue.
for (i=0; i < NumToUpdate; i++) {
arrLabel[i] = this["ChartLabel"+i].text;
arrValue[i] = this["ChartValue"+i].text;
ChartData.addItem({DataLabel:ArrLabel[i], DataValue:ArrValue[i]});
}
Finally, we link the data provider with the chart.
ThisBarChart.setDataProvider(ChartData);
ThisBarChart.setLabelSource("DataLabel");
ThisBarChart.setValueSource("DataValue");
| » Level Intermediate |
|
|
Added: : 2002-08-05
Rating: 7.80 Votes: 41
Hits: 2673
|
| » Author |
|
Applications Developer Marconi Australia
|
| » Download |
|
Download the files used in this tutorial.
|
|
Download (158 kb)
|
|
Get conversion and unzipping tools
for PC and Mac here!
|
| » Forums |
|
More help? Search our boards for quick answers!
|
|
Please rate this tutorial, 10 is the top rating, you can also click the
comments link to read/write a review.
|
|
|