How can we represent missing data in a line chart? Right now
our
requirements are to have missing data points at the beginning or end of
the
series only but we're also curious how to have missing points in the
middle.
We tried using null objects but that caused an error in the
charts.
TypeError: Error #1009: Cannot access a property or method of a
null
object
reference.
at
mx.charts.chartClasses::Series/mx.charts.chartClasses:Series::cacheDefaultVa
lues()
at
mx.charts.series::LineSeries/mx.charts.series:LineSeries::updateData()
at
mx.charts.chartClasses::Series/mx.charts.chartClasses:Series::validateData()
at
mx.charts.series::LineSeries/describeData()
at
mx.charts.chartClasses::DataTransform/describeData()
at
mx.charts.chartClasses::AxisBase/mx.charts.chartClasses:AxisBase::describeDa
ta()
at
mx.charts.chartClasses::NumericAxis/get
mx.charts.chartClasses:NumericAxis::dataDescriptions()
at
mx.charts.chartClasses::NumericAxis/::autoGenerate()
at
mx.charts.chartClasses::NumericAxis/::updateCache()
at
mx.charts.chartClasses::NumericAxis/update()
at
mx.charts.chartClasses::NumericAxis/getLabelEstimate()
at
mx.charts::AxisRenderer/::measureLabels()
at
mx.charts::AxisRenderer/::calcRotationAndSpacing()
at
mx.charts::AxisRenderer/adjustGutters()
at
mx.charts.chartClasses::CartesianChart/::updateAxisLayout()
at
mx.charts.chartClasses::CartesianChart/mx.charts.chartClasses:CartesianChart
::updateDisplayList()
at
mx.core::UIComponent/validateDisplayList()
at
mx.managers::LayoutManager/::validateDisplayList()
at
mx.managers::LayoutManager/::doPhasedInstantiation()
at
Function/http://adobe.com/AS3/2006/builtin::apply()
at
mx.core::UIComponent/::callLaterDispatcher2()
at
mx.core::UIComponent/::callLaterDispatcher()
We also tried
using an XML element that doesn't have the attributes we've
assigned to our
series or axis but that creates lines at zero, not
missing.
Thanks,
Sam
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
private
function getTestData():Array {
var x:XML = <stats>
<stat
pat_time="0"
hr="140"
pao2_alv="38"
pao2_art="47"
/>
<stat pat_time="5"
hr="149"
pao2_alv="41"
pao2_art="42" />
<stat pat_time="10"
hr="112"
pao2_alv="15"
pao2_art="29" />
</stats>;
var
a:Array = [
null,
null,
x.stat[0],
x.stat[1],
x.stat[2]
];
return a;
}
]]>
</mx:Script>
<mx:LineChart
id="waveform"
width="80%"
height="80%"
dataProvider="{getTestData()}">
<mx:horizontalAxis>
<mx:CategoryAxis
categoryField="@pat_time"
title="Patient Time"
/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries
yField="@hr" />
<mx:LineSeries yField="@pao2_alv"
/>
<mx:LineSeries yField="@pao2_art"
/>
</mx:series>
</mx:LineChart>
</mx:Application>