PDA

View Full Version : Color of CircleItemRenderer


tsj4
08-13-2008, 11:40 PM
I using the CircleItemRenderer as the tick mark of a line series to show where the data tips are. I have assigned a specific color to each line series but the CircleItemRenderer displays with a different color. The color it is using seems to be the default color that flex would have displayed the line series in if no color was specified


var u3:LineSeries = new LineSeries();

u3.name = measure3[mes_label];
u3.xField = initLabel;
u3.yField = measure3[mes_id];
u3.displayName = measure3[mes_label];
c.secondSeries.push(u3);
u3.dataProvider = traffic;

var s:Stroke = new Stroke();
s.color = Number(measure3[mes_color]);
s.weight = 3;

u3.setStyle("lineStroke", s);
u3.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer));


Why doesn't it just inherit the color of the line series and what do I need to do so it does.


http://tsj4.com/graph1.png

tsj4
08-14-2008, 12:37 AM
Well after taking a look at the CIrcleItemRenderer class I noticed the color was taken from the measures fill value.


fill = _chartItem.fill


Since I used this for a line series I did not specify a fill which is why it used the default color. The fix was to define a fill like so


series.setStyle( "fill", measure1[mes_color]);


so the new codes looks like this


var u1:LineSeries = new LineSeries();

u1.name = measure1[mes_label];
u1.xField = initLabel;
u1.yField = measure1[mes_id];
u1.displayName = measure1[mes_label];
c.secondSeries.push(u1);
u1.dataProvider = traffic;

var s:Stroke = new Stroke();
s.color = Number(measure1[mes_color]);
s.weight = 3;

u1.setStyle("lineStroke", s);
u1.setStyle( "fill", measure1[mes_color]);
u1.setStyle('itemRenderer', new ClassFactory(CircleItemRenderer));