I tried something else on a suggestion, that also did not work, even
though it seems OK.
I created a style sheet entry like this:
.legendRenderer
{
legendMarkerRenderer: ClassReference
("mx.charts.renderers.CircleItemRenderer");
}
I made sure the style sheet was included in my app.
I then set the style of my series like this:
for(var k:int = 0; k < tmpSeriesArrayColl.length - 1; k++)
{
ls = new LineSeries();
ls.displayName = tmpSeriesArrayColl[k].name;
ls.yField = 'value';
ls.xField = 'time';
ls.form = "line";
ls.dataProvider = tmpSeriesArrayColl[k].data;
stroke = new Stroke();
//Use the color specified in XML for the stroke
stroke.color = tmpSeriesArrayColl[k].color;
stroke.weight = 1;
ls.setStyle("lineStroke", stroke);
ls.styleName = "legendRenderer";
this.linechart.series[k] = ls;
}
}
It still complained that the object did not find the IFactory
interface. So it is trying to load my renderer.
It looks like the answer would be to sub-class the renderer and
implement the IFactory interface.
Just thought I would share in case anyone sees this issue.
--- In [email protected], "mgrayfmr" <[EMAIL PROTECTED]> wrote:
>
> I am creating LineSeries objects dynamically, and I want to be
able
> to use the CircleItemRenderer for the legend.
> I tried doing this several ways, but get an error that the
renderer
> cannot be cast to a type of IFactory. I tried making sure
> CircleItemRenderer was imported, and using new CircleItemRenderer
(),
> but no dice.
>
> I'm doing something like this.
> The only line that blows up is the LegendMarkerRenderer.
> My array contains series data, a display name, and a color.
>
> for(var k:int = 0; k < ChartDataVO.arrCollSeriesArray.length - 1;
> k++)
> {
> ls = new LineSeries();
> ls.displayName = ChartDataVO.arrCollSeriesArray[k].name;
> ls.yField = 'value';
> ls.xField = 'time';
> ls.form = "line";
> ls.dataProvider = ChartDataVO.arrCollSeriesArray[k].data;
>
> stroke = new Stroke();
> stroke.color = ChartDataVO.arrCollSeriesArray[k].color;
> stroke.weight = 1;
> ls.setStyle("lineStroke", stroke);
> ls.setStyle
> ("legendMarkerRenderer", "mx.charts.renderers.CircleItemRenderer");
> ls.styleName = ChartDataVO.arrCollSeriesArray_AVG[k].key;
> this.linechart.series[k] = ls;
> }
>
> Anyone have any insights ?
> Thanks in advance !!!
> Mike
>