Hi guys,
I've read the posts on this board for a long time, but I've never had
the need to post until now. As some of you may know Flex doesn't like
to show data labels on column charts which are placed inside cartesian
charts. Doesn't like to, as in won't. To get around this I wrote my
own item renderer which extends boxitemrenderer (I was lazy and didn't
feel like writing my own renderer from scratch). The data labels post
now and it works great, until I resize. On resize the columns will
scale, but the labels stay in one place. My updatDisplayList method
is below. If anyone can help I would greatly appreciate it!!
protected override function
updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth, unscaledHeight);
//If the item is really a chart item
if (parent is UIComponent) {
var parentID:String = String(parentSeries.id);
var yField:String = String(parentSeries.yField);
//If the textfield hasn't been initialized AND the item is NOT a
legend item
if( !textField && ! isLD){
textField = new TextField();
var tf:TextFormat = new TextFormat();
//Get color of text from CSS
tf.color = getStyle("color");
//Set the rest of the text field properties
tf.font = "Verdana";
tf.align = "center";
tf.bold = true;
textField.x = (unscaledWidth / 2) + this.x - (textField.width / 2);
textField.y = (unscaledHeight / 2) + this.y;
textField.defaultTextFormat = tf;
//Set the text itself
if(item.item.hasOwnProperty(yField)){
textField.text = String(textField.x);
}
parent.addChild(textField);
}
}
}