This content has been marked as final. Show 4 replies
Oh, a 3rd option I'm not sure about is if I could have an extra series for the projection that would only have data during the future months. I'm not sure if I can create a series that only has data for certain months though.
how do you keep your data?
are you running the projections based on numbers you have? Then
doing the calculations on the client side with flex and actionscript?
When i do stuff like that..
I do it on the server side.. then send it to my PC for display...
I do some number crunching.. but I do all the data crunching when the usr hits the url...
Then i send it as XML for display.. less work for me.. and server side is far faster for stuff like that than the users computer...
In this instance it can be assumed that a ColdFusion web service will be handing back all the data necessary to display the graph via a remote object call.
I'm still playing with this solution, but for what it's worth this is what I am doing:
I downloaded the source from quietly scheming for the dashed line renderer. ( http://www.quietlyscheming.com/blog/charts/dashed-lines/)
I changed the DashedLineSeries to a ProjectionLineSeries and changed the DashedLineRenderer to be ProjectionLineRenderer. Then in the renderer, I changed the updateDisplayList method to loop over the LineSeriesItems (_lineSegment.items array) and find where past meets future. Note: in doing this, I made an assumption that your xValue would be a date to use this series. I then used a combination of the drawPolyLine and drawDashedPolyLine methods from their respective graphics utility classes to draw the applicable portions of the line.
Here is the contents of the ProjectionLineRenderer.updateDisplayList method as I have it now.
override protected function updateDisplayList(unscaledWidth:Number,
var stroke:IStroke = getStyle("lineStroke");
var form:String = getStyle("form");
var pattern:Array = getStyle("dashingPattern");
pattern = (pattern == null) ? _pattern : pattern;
var current_date:Date = new Date();
var beginning_of_month:Date = new Date(current_date.getMonth(),1,current_date.getFullYear());
var projected_items:Array = new Array();
// Loop over the lineseriesitems
for(var i:int = 1;i<_lineSegment.items.length;i++)
// Grab the items whose dates are in the future
if(LineSeriesItem(_lineSegment.items ).xValue = beginning_of_month)
// If this is the first item that is in the future, back
// up and grab the previous one so our dotted has a starting point
if(projected_items.length == 0 && i > 0)
// Add the future data points into the projected array
// Draw the solid portion of the line. Notice the end point is the size of the entire array, minus the future points.
// Adjusted by two because they overlap one point and the array starts at 0.
// Draw the dashed portion with the projected_items array
DashedGraphicUtilities.drawDashedPolyLine(graphics, stroke, pattern, projected_items);
Technically, I am also assuming that the last data point is the current month, and therefore the projected one. Based on that, the date math is probably unnecessary, but maybe I'll change that later.