Skip navigation
Currently Being Moderated

Help Solutioning Line Chart - Live Data

Dec 17, 2009 10:13 AM

I have a situation that I could use some feedback on.  Here is the situation. I have a line chart that has 1 to 4 lines being charted.  The chart represents race data and is real time data from a hardware device. I am using the standard arrayCollection and adding values as they arrive and binding the chart to the data. All good so far.  There is a set distance that I am able to predefine so I do know what data point is the end point. I can stop the data collection at that time.


My first problem is that the line chart data spans the entire chart no matter how many points I have. So let's assume that the distance is 100. I have 5 of the 100 points added to the arrayCollection. It might look like this.




I don't want this.  Since I know I will be charting 100 points, I want it to look something more like this below at the point I only have 5 of the 100 points. I assume that a NULL value is not plotted at all and not like having a 0 entry where the line would drop down to a 0 value. I want it cut off like in the screenshot.




As far as I can figure out in my testing I cannot set a pre-defined max like a bar chart can be set.If I could I think the problem would be solved.


So how can I achieve he second example and build the line as the data comes in as related to the pre-defined length.


One thought I have is pre-populating the arrayCollection to the length I need. If the race was to 100 then I would enter 100 entired with a value of NULL.  If I then set interpolateValues to false and started to update (not adding new) the arrayCollection this it might give me the display I want.


Is there any easier way without prepopulating the arrayCollection?  I want to make sure I am not missing something obvouse on the line graph.

  • Currently Being Moderated
    Dec 17, 2009 12:52 PM   in reply to ehusar

    Can't you just set min and max values on the horizontal axis?

    Mark as:
  • Currently Being Moderated
    Dec 18, 2009 7:49 AM   in reply to ehusar

    If your horizontal axis is graphing time, why is it a CategoryAxis?

    can't you just use LinearAxis for both horizontal and vertical?

    Mark as:
  • Currently Being Moderated
    Dec 18, 2009 11:15 AM   in reply to ehusar

    How about separate series on the same chart? Each series can have a separate dataProvider, and you can update these independently. Since you're interested in laps, update each data source according to the current number of items (since from the description it sounds like your situation is append-only), instead of tracking the actual times. E.g., when you receive input for racerA, do something like

    function updateRacerData(racerId:String, racerSpeed:int):void {

      var racerData:ArrayCollection = racerDataMap[racerId];

      racerData.addItem({ lap: racerData.length, speed: racerSpeed });


    Mark as:
  • Currently Being Moderated
    Dec 18, 2009 2:19 PM   in reply to ehusar

    Yep. I do this all the time.

    Mark as:
  • Currently Being Moderated
    Jul 4, 2011 1:07 PM   in reply to ehusar

    Hi Ehusa


    Its been a very long search on google for a solution to this problem. I have live data coming which I am plting against the current time, I have used Datetimeaxis but did not get any result. Glad to see that you got this solved. Please see my code here Hope you can help or kindly paste the code that worked. many thanks in advance.



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points