How to add two TimeSeries JfreeChart

92 views Asked by At

I want to add two or more timeSeries in order to generate stacked line graph. I could not find something in the API. I am trying to do it manually but still does not work as I want. Is there any function in the API, or not, that could manage this? Thanks

1

There are 1 answers

0
Panagiotis Stoupos On BEST ANSWER

Well this worked ^^
rtp: RegulatTimePeriod instance. As iterating through the datasets of the two series we use this code to add a new node if there is not a record for the current rtp or udate the existing by the sum of the values.

if(StackedSerie.getValue(rtp)!=null){         //stacked lines dataset
StackedSerie.addOrUpdate(rtp,(double)((float)v + StackedSerie.getValue(rtp).floatValue()));
                        }
                        else
                        {
                            StackedSerie.add(rtp,v);
                        }