Hi Jake. I think you want something like this:
<CartesianChart>
<BarSet type="clustered">
<BarSet type="100%">
<BarSeries xField="targetToDate" />
<BarSeries xField="targetRemaining" />
</BarSet>
<BarSet>
<BarSeries xField="actualToDate"
itemRenderer="my.actual.thresholdRenderer" />
<BarSeries xField="actualRemaining" />
</BarSeries>
</BarSet>
</CartesianChart>
The actualToDate series has a custom renderer that examines the actual
and target and chooses its rendering color based on the heuristic you
outlined below. See numerous posts to flexcoders and examples on my
blog (quietlyscheming.com) for how to do this.
Ely.
________________________________
[esg] From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of j_sevlie
Sent: Thursday, January 11, 2007 11:10 AM
To: [email protected]
Subject: [flexcoders] Dynamic bar colors within same series for 100%
BarChart?
I have a 100% BarChart that will have two bars, each with two peices:
Bar #1: Target sales goal for the year.
........Chunk 1: Based on today's date, where SHOULD the store be for
sales.
........Chunk 2: Based on today's date, how much SHOULD they have left
to sell.
Bar #2: Actual sales for the year.
........Chunk 1: Sales the store has actually accumulated.
........Chunk 2: Sales remaining to meet their goal.
So, let's say the following facts:
1. The store has a $100,000 sales goal for the year.
2. The fiscal year runs from Jan-Dec.
3. It is currently July (for the sake of example).
4. So far, the store has had $40,000 in sales.
My bars should have the following data:
Target:
1st chunk: $50,000 ($100,000/12months * 6) (bar color: blue)
2nd chunk: $50,000 ($100,000 - 1st peice) (bar color: gray)
Actual:
1st chunk: $40,000 (bar color: SEE BELOW)
2nd chunk: $60,000 (bar color: always gray)
Now, what I want to change dynamically on this chart is the bar color
of the 1st peice from "Actual". For example, if the store is 20%
below where they should be for sales, I want the bar to be red. If
they are within 5%, make it yellow. Anything else and it's green.
However, the kicker here is that I want to leave the Target bar colors
alone. The only thing that I want to change is the Actual bar, 1st
chunk.
So, the question is: Within the same 100% bar chart, can you change
the color of a single chunk within a bar while leaving the rest alone?
Sorry for the long winded setup, but I hope that makes sense what I'm
trying to accomplish.
Thanks,
Jake