OK, I'll start with flex2, which is the nicer answer.
In Flex2, we've extracted the stacking behavior of AreaChart,
ColumnChart, and BarChart into separate series that allow you to do more
complex things. So this:
<AreaChart type="stacked">
<series>
<AreaSeries ... />
<AreaSeries ... />
</series>
</AreaChart>
Is roughly equivalent to this:
<CartesianChart>
<series>
<AreaSet type="stacked">
<series>
<AreaSeries ... />
<AreaSeries ... />
</series>
</AreaSet>
</series>
</CartesianChart>
Which means you could also do this:
<CartesianChart>
<series>
<LineSeries ... />
<AreaSet type="stacked">
<series>
<AreaSeries ... />
<AreaSeries ... />
</series>
</AreaSet>
</series>
</CartesianChart>
Now that's the quick and dirty way to do what you're looking for in Flex
2. LineSeries is a little heavyweight, so you might want to look into
building a custom element that just draws a single horizontal line.
In Flex 1.5, you're going to have to do a little more work, because
there's no way to keep that line series out of the chart. Instead of
using a stacked area chart, I'd use a CartesianChart with one line
series and a bunch of area series. You'll have to pre-process your
dataProvider into a new, synthesized dataProvider that pre-sums all of
the fields. So given the dataProvider:
[ { a: 2, b: 12, { a:,10, b: 25 } ]
You want to generate an equivalent dataProvider that looks like this:
[ { field0: 2, field1: 24 }, { field0: 12, field1: 35 } ]
Then assign the fields of your AreaSeries accordingly:
<CarteisanChart dataProvider="{ synthesizeStackedDP( myData ) }">
<series>
<Array>
<AreaSeries yField="field0" />
<AreaSeries yField="field1" minField="field0" />
<LineSeries ... />
</>
</>
</>
Ely.
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Carlos
Sent: Tuesday, February 21, 2006 9:30 AM
To: [email protected]
Subject: [flexcoders] Re: Stacked Areachart with Trendline
Errr... let me clarify...
1. The effect that I'm trying to achieve is showing a stacked area chart
with y-axis from 1 to 100. Overlaying (sp?) the chart, I want to draw a
single line at y=50 to show stacked values potentially exceeding this
cap.
2. This is for Flex 1.5, and will be for Flex 2.0
- Carlos
--- In [email protected], "Carlos Balacuit"
<[EMAIL PROTECTED]> wrote:
>
> Is there a way to add a trend line, with a constant value, to a
> stacked AreaChart? I've tried just a LineSeries to areaChart.series,
> but because the chart is type="stacked", the values stack on top of
> the trend line.
>
> Can a chart have a set of series that are stacked, and another set be
> overlaid?
>
> Thanks in advance.
>
> - Carlos
>
--
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
--
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/