Hello. I have the problem - the text of legend item is longer then width of parent container (Panel). How can I solve this problem? Perhaps it is possible to do line folding for legend item text or clip text and show label on it?
There is example code below. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();"> <mx:Script source="test.as"/> <mx:Panel id="idTest" title="Chart" width="800" height="600"> <mx:LineChart id="chart" fontSize="14"> </mx:LineChart> </mx:Panel> </mx:Application> // test.as ActionScript file import mx.collections.ArrayCollection; import mx.charts.series.LineSeries; import mx.charts.DateTimeAxis; import mx.charts.LinearAxis; import mx.controls.Label; import mx.charts.Legend; import mx.charts.LegendItem;import mx.controls.Alert; import mx.charts.chartClasses.LegendData; [Bindable] private var dp:ArrayCollection = new ArrayCollection ([{date:"05.12.2004 01:00:00", messqnt:0, queue:0}, {date:"05.12.2004 02:00:00", messqnt:0, queue:0}, {date:"05.12.2004 03:00:00", messqnt:0, queue:0}, {date:"05.12.2004 04:00:00", messqnt:0, queue:0}, {date:"05.12.2004 05:00:00", messqnt:0, queue:0}, {date:"05.12.2004 06:00:00", messqnt:0, queue:0}, {date:"05.12.2004 07:00:00", messqnt:0, queue:0}, {date:"05.12.2004 08:00:00", messqnt:0, queue:0}, {date:"05.12.2004 09:00:00", messqnt:1, queue:0}, {date:"05.12.2004 10:00:00", messqnt:0, queue:0}, {date:"05.12.2004 11:00:00", messqnt:2, queue:0}, {date:"05.12.2004 12:00:00", messqnt:3, queue:0}, {date:"05.12.2004 13:00:00", messqnt:16, queue:-4}, {date:"05.12.2004 14:00:00", messqnt:18, queue:-5}, {date:"05.12.2004 15:00:00", messqnt:20, queue:0}, {date:"05.12.2004 16:00:00", messqnt:13, queue:-1}, {date:"05.12.2004 17:00:00", messqnt:9, queue:0}, {date:"05.12.2004 18:00:00", messqnt:10, queue:0}, {date:"05.12.2004 19:00:00", messqnt:18, queue:0}, {date:"05.12.2004 20:00:00", messqnt:48, queue:-12}, {date:"05.12.2004 21:00:00", messqnt:141, queue:-5},{date:"05.12.2004 22:00:00", messqnt:206, queue:127}, {date:"05.12.2004 23:00:00", messqnt:604, queue:-90}]); private function pf(date:String):Date { var day:String = date.substring(0, date.indexOf(".")); var month:String = date.substring(date.indexOf(".")+1, date.lastIndexOf(".")); var year:String = date.substring(date.lastIndexOf(".")+1, date.indexOf(" ")); var hour:String = date.substring(date.indexOf(" ")+1, date.indexOf(":")); var result:Date = new Date(new Number(year),new Number (month),new Number(day),new Number(hour)); return result; } private function init():void { chart.dataProvider = dp; chart.percentHeight = 100; chart.percentWidth = 100; var series:Array = new Array(); var ls1:LineSeries = new LineSeries(); ls1.xField = "date"; ls1.yField = "messqnt"; ls1.dataProvider = dp; ls1.displayName = "It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. It is too long text 1. "; var ls2:LineSeries = new LineSeries(); ls2.xField = "date"; ls2.yField = "queue"; ls2.dataProvider = dp; ls2.displayName = "It is too long text 2. It is too long text 2. It is too long text 2. It is too long text 2. It is too long text 2. It is too long text 2. It is too long text 2. It is too long text 2. It is too long text 2. It is too long text 2. It is too long text 2."; series.push(ls1); series.push(ls2); chart.series = series; var dta:DateTimeAxis = new DateTimeAxis(); dta.dataUnits = "hours"; dta.parseFunction = pf; dta.title = "Date and Time"; chart.horizontalAxis = dta; var la:LinearAxis = new LinearAxis(); la.title = "Quantity of messages"; chart.verticalAxis = la; var legend:Legend = new Legend(); legend.dataProvider = chart; idTest.addChildAt(legend, 0); } -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/