Doccie
11-13-2008, 11:40 PM
Okay, so this one's been giving me a headache for days.
I'm retrieving several XML files and storing the values in an array with several objects (kinda like in this example (http://livedocs.adobe.com/flex/3/html/help.html?content=charts_types_10.html))
I then pass that array along to a function that dynamically creates a lineseries object from this data. This is my function:
public function addSeries(dp_array:Array, displayName:String, xField:String, yField:String):Array {
// Create a new lineSeries and fill it with data from the parameters
_ls = new LineSeries();
_ls.dataProvider = dp_array;
// xField and yField can either be passed along via the parameters
// For now I'm using static values that match the keys for the objects contained in the array
_ls.xField = 'date';
_ls.yField = 'views';
// Just for dataTip/Legend purposes
_ls.displayName = displayName;
//_ls.setStyle("form","curve");
// This actually traces the date for the first object in the dp_array.
trace("ChartUtils::AddSeries >> xField data: " + dp_array[0].date);
//trace("ChartUtils::AddSeries::ChartSeries >> Name: " + _chart.series);
var tmp:Array = _chart.series;
tmp.push(_ls);
// Returns an array containing LineSeries (later added to the chart via the series setter).
return tmp;
}
Basically, the legend shows the display name and the y axis values (0 to 5000, corresponding to the values from the 'views') just fine however, it does not set the values for the xField and also, does not plot out coordinates for the different series. But it -does- trace the dp_array[0].date value.
Any ideas why this is?
I'm retrieving several XML files and storing the values in an array with several objects (kinda like in this example (http://livedocs.adobe.com/flex/3/html/help.html?content=charts_types_10.html))
I then pass that array along to a function that dynamically creates a lineseries object from this data. This is my function:
public function addSeries(dp_array:Array, displayName:String, xField:String, yField:String):Array {
// Create a new lineSeries and fill it with data from the parameters
_ls = new LineSeries();
_ls.dataProvider = dp_array;
// xField and yField can either be passed along via the parameters
// For now I'm using static values that match the keys for the objects contained in the array
_ls.xField = 'date';
_ls.yField = 'views';
// Just for dataTip/Legend purposes
_ls.displayName = displayName;
//_ls.setStyle("form","curve");
// This actually traces the date for the first object in the dp_array.
trace("ChartUtils::AddSeries >> xField data: " + dp_array[0].date);
//trace("ChartUtils::AddSeries::ChartSeries >> Name: " + _chart.series);
var tmp:Array = _chart.series;
tmp.push(_ls);
// Returns an array containing LineSeries (later added to the chart via the series setter).
return tmp;
}
Basically, the legend shows the display name and the y axis values (0 to 5000, corresponding to the values from the 'views') just fine however, it does not set the values for the xField and also, does not plot out coordinates for the different series. But it -does- trace the dp_array[0].date value.
Any ideas why this is?