Hmmm. I'm guessing the problem is that the findDataPoints() function
assumes that the data is sorted by x value (i.e., it assumes that if
you've set sortByXValue to false its because you know its already
sorted).  After it checks the value at x=500, it decides that there must
not be any values at x=400, and gives up.
 
 
Looks like you'll either have to override the findDataPoints() function
to fix the problem, or write a custom subclass of PlotSeries to draw the
line connection the dots.
 
FWIW, drawing the line shouldn't be too hard. Something like this:
 
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
 
   super.updateDisplayList(unscaledWidth,unscaledHeight);
var renderData:PlotSeriesRenderData = transitionRenderData ?
PlotSeriesRenderData(transitionRenderData) : this.renderData;
if(renderData == null)
    return;
var cache:Array = renderData.filterCache;
 
if(cache == null || cache.length == 0)
    return;
 
var g:Graphics = this.graphics;
 
g.lineStyle(0,0);
g.moveTo(cache[0].x,cache[0].y);
 
for(var i:int = 0;i<cache.length;i++)
{
    g.lineTo(cache[i].x,cache[i].y);   
}
}
 
Ely.
 
________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alex
Sent: Monday, November 27, 2006 4:38 AM
To: [email protected]
Subject: RE: [flexcoders] Additional charting types



Thanks, Ely! Works perfectly.
But do you know why it doesn't display a tool tip for the plot 
{Profit: 50, Expenses: 400}?

The rest displays ok. 

See code below. 
----------------

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> ">
<mx:Script><![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([ 
{Profit: 200, Expenses: 200 },
{Profit: 300, Expenses: 300},
{Profit: 300, Expenses: 500},
{Profit: 50, Expenses: 400},
{Profit: 200, Expenses: 200}
]);
]]></mx:Script>
<mx:CartesianChart id="plot" showDataTips="true"
dataProvider="{expenses}">
<mx:horizontalAxis>
<mx:LinearAxis title="XVals" displayName="XVal"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis title="YVals" displayName="YVal"/>
</mx:verticalAxis>
<mx:series>
<mx:LineSeries sortOnXField="false" xField="Expenses"
yField="Profit" />
</mx:series>
</mx:CartesianChart>

</mx:Application>

-----Original Message-----
From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
Behalf Of Alex
Sent: Saturday, November 25, 2006 1:26 PM
To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
Subject: RE: [flexcoders] Additional charting types

Thanks Ely, I'll give it a try. 
I was also thinking of adapting AreaChart by specifying minField value
and
alpha=0 for <mx:fill>

Thanks,
Alex

-----Original Message-----
From: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> ]
On
Behalf Of Ely Greenfield
Sent: Saturday, November 25, 2006 10:21 AM
To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> 
Subject: RE: [flexcoders] Additional charting types

Hi Alex. You should be able to do that with a LineSeries, in a
CartesianChart with a LinearAxis for both the horizontal and vertical
axes..
Make sure you set sortOnXField to false on the lineSeries though, or
else it
will sort all of your points by horizontal value before drawing the
connecting line.

Ely.

________________________________

From: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> ]
On
Behalf Of Alex
Sent: Friday, November 24, 2006 8:22 AM
To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com> 
Subject: [flexcoders] Additional charting types

Hi All, 

Just wondering if anyone knows additional charts developed for Flex.
I'm interested in the Scatter chart - looks a bit similar to the Plot
Chart
but have all plots connected with lines so it finally looks like a
polygon.

Kind regards,
Alex



 

Reply via email to