handling missing data

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
BubikolRamios
Posts: 9
Joined: Sun Dec 19, 2010 1:51 am
antibot: No, of course not.

handling missing data

Post by BubikolRamios » Sun Dec 19, 2010 2:00 am

suppose I have simple x/y chart, drawing lines on it
x axis having months, y having prices

Two items, prices:

Code: Select all

month                  1     2      3      4   5 
item1/price            3     4                 4 
item2/price            4     4      5
so I suppose there should be:
1. breaked lines on graph(to be clear, I don't want points for item 1 between 2 and 5 months to be connected)
2. added missing months (there should month 4 on x axis but nothing on plot for it)

Need general guidance about this, new to freeChart, and simple things that I have now puts out x axis without 4. month, obviously ....
is there a simple sollution like sending in null (or something) instead of missing price ?
EDIT: tested last sentence, null=0, which then plots wrong chart.

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: handling missing data

Post by skunk » Sun Dec 19, 2010 2:36 am

Try using Double.NaN for missing data

BubikolRamios
Posts: 9
Joined: Sun Dec 19, 2010 1:51 am
antibot: No, of course not.

Re: handling missing data

Post by BubikolRamios » Sun Dec 19, 2010 2:46 am

Thanks for replay.

Ok just figured it out, if I send 'real' null, then it works. Does not draw anything where null is.

if I have data like this , by month: 1 null 3 null 5 6
then there is is just line between 5 and 6, I would expect dot at 1 and 3 (nothing currently), but I guess , for that I have to add dots on all points, or not ?

BubikolRamios
Posts: 9
Joined: Sun Dec 19, 2010 1:51 am
antibot: No, of course not.

Re: handling missing data

Post by BubikolRamios » Sun Dec 19, 2010 3:26 am

yes.

Code: Select all

renderer.setSeriesShapesVisible(0, true);
does the trick, but looks ugly, I gues making custom shape will be the quickes way to solve that.

Locked