1 Reply Latest reply on Oct 18, 2010 3:31 AM by Mohd Fayaz

    Missing data points in LineSeries causing exceptin

    Mohd Fayaz Level 1

      I am drawing a  LineChart in an  application. The data to this LineChart comes from server in XML format, something like this.

       

        <Process timestamp="2010-10-13 17:43:20" pid="15782" bizname="IS_1" cpu="0.0" vmem="620672.0" etime="238"/>

        <Process timestamp="2010-10-13 17:44:05" pid="11516" bizname="Repo_861" cpu="0.0" vmem="533012.0" etime="23184"/>

        <Process timestamp="2010-10-13 17:44:05" pid="15782" bizname="IS_1" cpu="0.0" vmem="620672.0" etime="239"/>

        <Process timestamp="2010-10-13 17:44:55" pid="15782" bizname="IS_1" cpu="0.0" vmem="620672.0" etime="240"/>

       

      I am converting this XML into ArrayCollection, in the format given below, and binding it to LineChart.

       

      ....

      { time:'2010-10-13 17:44:05',Repo_861:533012.0,IS_1:620672.0},              

      { time:'2010-10-13 17:44:55',Repo_861:533012.0,IS_1:620672.0},

      { time:'2010-10-13 17:45:35',Repo_861:533012.0,IS_1:620672.0},

      { time:'2010-10-13 17:46:15',Repo_861:533012.0,IS_1:620672.0},

      { time:'2010-10-13 17:47:00',Repo_861:533012.0,IS_1:620672.0},

      { time:'2010-10-13 17:47:45',Repo_861:533012.0,IS_1:620672.0},

      ....

       

      x-axis shows time and y axis value is either cpu or vmem value from the xml. The Chart displays correctly when all the data points are present. However, when any of the data point is missing from xml, it is throwing "TypeError: Error #1009: Cannot access a property or method of a null object reference." error

       

      For example, if a datapoint for timestamp "2010-10-13 17:44:55" for process Repo_861 misses from xml, the above ArrayCollection will look like this

       

       

      { time:'2010-10-13 17:44:05',Repo_861:533012.0,IS_1:620672.0},              

      { time:'2010-10-13 17:44:55',IS_1:620672.0},

      { time:'2010-10-13 17:45:35',Repo_861:533012.0,IS_1:620672.0},

      { time:'2010-10-13 17:46:15',Repo_861:533012.0,IS_1:620672.0},

      { time:'2010-10-13 17:47:00',Repo_861:533012.0,IS_1:620672.0},

      { time:'2010-10-13 17:47:45',Repo_861:533012.0,IS_1:620672.0},

       

      This kind of missing data points are causing errors. But, when I manually write this arraycollection and bind it statically, the chart is showing up properly, with broken line for missing data point.

      Can anybody please help me out on this issue?

       

        • 1. Re: Missing data points in LineSeries causing exceptin
          Mohd Fayaz Level 1

          I have resolved this issue by myself. The problem was with data conversion logic. I was wrongly using e4x parser operator.

           

          For ex, if we use   process.@timestamp  (where process is a complete XML tag), it will give an XMLList object, and arraycollection was storing XMLList object instead of string values. So whenever a datapoint is missing, the whole XMLList object was missing from arraycollection and thus causing the error.

           

          But I am facing another problem now. Now by default, the LineSeries is  interpolating a "0" values for missing data point. It is neither breaking the line.