Hi, I am trying to create a chart with an x-axis of days that has two series, a column and line series. The column series will have a bar for each day and I want the line series to be constant across a group of 7 days and then jump to a different level, where it will remain constant for another 7 days (i.e. create a step function). I am using an ArrayCollection object for the data so I currently have something like this:
Code: <fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var levels:ArrayCollection = new ArrayCollection([
{DaysLeft: 14, Daily: 8, WeeklyAvg: 12.86},
{DaysLeft: 13, Daily: 10, WeeklyAvg: 12.86},
{DaysLeft: 12, Daily: 9, WeeklyAvg: 12.86},
{DaysLeft: 11, Daily: 14, WeeklyAvg: 12.86},
{DaysLeft: 10, Daily: 12, WeeklyAvg: 12.86},
{DaysLeft: 9, Daily: 18, WeeklyAvg: 12.86},
{DaysLeft: 8, Daily: 19, WeeklyAvg: 12.86},
{DaysLeft: 7, Daily: 20, WeeklyAvg: 15.86},
{DaysLeft: 6, Daily: 19, WeeklyAvg: 15.86},
{DaysLeft: 5, Daily: 22, WeeklyAvg: 15.86},
{DaysLeft: 4, Daily: 14, WeeklyAvg: 15.86},
{DaysLeft: 3, Daily: 13, WeeklyAvg: 15.86},
{DaysLeft: 2, Daily: 11, WeeklyAvg: 15.86},
{DaysLeft: 1, Daily: 12, WeeklyAvg: 15.86}, ])
]]>
</fx:Script>In the chart MXML code I have the following series declared:
Code: <mx:series>
<mx:ColumnSeries xField="DaysLeft"
yField="Daily"
displayName="Days Left">
</mx:ColumnSeries>
<mx:LineSeries xField="DaysLeft"
yField="WeeklyAvg"
displayName="Weekly Out at Current Pace">
</mx:LineSeries>
</mx:series>This of course gives a straight line that changes values from 12.86 to 15.86 from day 7 to day 8. How could I make this line change values between day 7 and day 8 in the form of a step function?
Thank you very much for helping!
Creating Charts with Step Functions
Thursday, June 28, 2012
[Action Script] Creating Charts with Step Functions June,2012
Posted by Bimo Hery Prabowo at 3:13 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment