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.