Display Labels/Datapoints for Line series in flex

1. Create class in Actionscript:ImpactMktLineLabelRenderer.as



import flash.display.Graphics;

import flash.geom.Rectangle;

import mx.charts.ChartItem;

import mx.charts.chartClasses.GraphicsUtilities;

import mx.core.IDataRenderer;

import mx.graphics.IFill;

import mx.graphics.IStroke;

import mx.skins.ProgrammaticSkin;

import mx.controls.Label;

import mx.controls.Alert;

import mx.core.UIComponent;

import mx.charts.LineChart;

import mx.charts.series.LineSeries;

import mx.charts.series.items.LineSeriesItem;

import mx.graphics.SolidColor;

import mx.formatters.NumberFormatter;

public class ImpactMktLineLabelRenderer extends UIComponent implements IDataRenderer


private var _label:Label;

public var solidColor:SolidColor;

public function ImpactMktLineLabelRenderer():void



_label = new Label();





private var _chartItem:ChartItem;

public function get data():Object


return _chartItem;


public function set data(value:Object):void


if (_chartItem == value)


_chartItem = ChartItem(value);

var currFormat:Object = new NumberFormatter();

currFormat.precision = 1;

currFormat.rounding = “nearest”;

if(_chartItem != null)

_label.text = currFormat.format(LineSeriesItem(_chartItem).yValue).toString();


override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void


super.updateDisplayList(unscaledWidth, unscaledHeight);

var ls:LineSeries = _chartItem.element as LineSeries;

solidColor = ls.getStyle(“fill”);


_label.move(unscaledWidth – _label.getExplicitOrMeasuredWidth()/5,unscaledHeight- _label.getExplicitOrMeasuredHeight() – 5 );







2.Usage in Line series like this:

About ashokabhat

I am a C,C ,JAVA,Adobe Flex,.NET Programmer Currently working as a Software Developer
This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to Display Labels/Datapoints for Line series in flex

  1. Andre says:

    How use this package?

  2. anam says:

    <mx:LineSeries xField=”alt” yField=”total” displayName=”Total” itemRenderer= “ ImpactMktLineLabelRenderer” ></mx:LineSeries >

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s