Do you mean you want it to show the labels (ie, the values) at each point of a
line at the same time? Or do you mean your want it to show, say, a slightly
larger square or some shape at each point on the line?
For the latter, there are examples in the charting chapters of the DevApps
guide. For the former, you need to write a custom item renderer. Here's one
that I adapted from Ely's sample (on quietlyscheming.com) -- his original
example was for a column, but this one works for lines.
hth,
matt horn
flex docs
---------LabelRenderer2.as------------
package
{
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.core.UIComponent;
import mx.charts.LineChart;
import mx.charts.series.items.LineSeriesItem;
public class LabeledRenderer2 extends UIComponent implements IDataRenderer
{
private var _label:Label;
public function LabeledRenderer2():void
{
super();
_label = new Label();
addChild(_label);
_label.setStyle("color",0x000000);
}
private var _chartItem:ChartItem;
public function get data():Object
{
return _chartItem;
}
public function set data(value:Object):void
{
if (_chartItem == value)
return;
_chartItem = ChartItem(value);
if(_chartItem != null)
_label.text = LineSeriesItem(_chartItem).yValue.toString();
}
private static const fills:Array = [0xFF0000,0x00FF00,0x0000FF,
0x00FFFF,0xFF00FF,0xFFFF00,
0xAAFFAA,0xFFAAAA,0xAAAAFF];
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
_label.setActualSize(_label.getExplicitOrMeasuredWidth(),_label.getExplicitOrMeasuredHeight());
_label.move(unscaledWidth - _label.getExplicitOrMeasuredWidth(),
unscaledHeight/2 - _label.getExplicitOrMeasuredHeight()/2);
}
}
}
------------LineChart.mxml-------------
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" styleName="plain">
<mx:Script>
import mx.graphics.Stroke;
[Bindable]
public var expenses:Object = [{Month: "Jan", Profit: 2000, Expenses:
1500, Amount: 450},
{Month: "Feb", Profit: 1000, Expenses: 200, Amount: 600},
{Month: "Mar", Profit: 1500, Expenses: 500, Amount: 300}];
public var s:Stroke = new Stroke(0x001100);
</mx:Script>
<mx:Panel title="Line Chart" borderStyle="solid" textAlign="center">
<mx:Label text=" "/>
<mx:LineChart dataProvider="{expenses}" >
<mx:horizontalAxis>
<mx:CategoryAxis dataProvider="{expenses}"
categoryField="Month" />
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries yField="Profit" itemRenderer="LabeledRenderer2"/>
<mx:LineSeries yField="Expenses"/>
<mx:LineSeries yField="Amount"/>
</mx:series>
</mx:LineChart>
</mx:Panel>
</mx:Application>
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Jesús Iglesias
> Sent: Friday, July 28, 2006 3:03 PM
> To: [email protected]
> Subject: [flexcoders] show points on linechart
>
> Hi,
>
> I am starting with chart components and I am a little missing.
>
> How to show the points of a lineseries on a linechart?
>
>
> I have my line graph but I want it to show all de points that
> generate the line, as when you are over the point with mouse
> but all the points and forever.
>
> Thanks.
>
> jesus
>
>
>
--
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/
<*> 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/