|
Single value surrounded by Chart.NoValue |
Posted by L on May-11-2012 04:26 |
|
Hello,
Very often, our y data will contain a single value surrounded by Chart.NoValue values. In
an area or line chart, is there a way to have ChartDirector draw a single point for that
case? It looks like by default nothing is drawn, because no line can be drawn, so it's as if
our single value doesn't exist.
thanks,
L |
Re: Single value surrounded by Chart.NoValue |
Posted by Peter Kwan on May-11-2012 21:10 |
|
Hi L,
You may use one of the following methods:
(a) You may configure the line layer to draw a line (perhaps using a different style like a dash line) to join through the gap, instead of leaving the gap empty. See the sample code "Missing Data Points".
(b) If you do want to leave the gap empty, you can add data symbols to the points In this way, all the data points are visible. See the "Symbol Line Chart (2)" sample code.
(c) If you just want the isolated points to have a symbol, you may create a separate scatter layer that contains just the isolated points. For example (in Java):
double[] myIsolatedData = new double[myData.length];
for (int i = 0; i < myData.length; ++i) {
if (((i == 0) || (myData[i - 1] == Chart.NoValue)) && ((i == myData.length - 1) || (myData[i + 1] == Chart.NoValue)))
myIsolatedData[i] = myData[i];
else
myIsolatedData[i] = Chart.NoValue;
}
//if you do not have myXData, just use null
c.addScatterLayer(myXData, myIsolatedData, "", Chart.CircleSymbol, 5, 0x0000ff, 0x0000ff);
Hope this can help.
Regards
Peter Kwan |
|