using date values from db in Dataset Day() getSerialDate()

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
aueddonline
Posts: 1
Joined: Mon Jan 09, 2012 5:12 pm
antibot: No, of course not.

using date values from db in Dataset Day() getSerialDate()

Post by aueddonline » Mon Jan 09, 2012 5:29 pm

I want to use date values, in an XYDataset, from my database currently in this format 'yyyy-mm-dd'; It's daily information so I'm pretty sure I need the Day() method, example below;

I'll get a string object back from the database with a value of say; '2012-04-01'

I see some methods in the Development guild like 'getSerialDate()' , can I use this for converting my object? how?

Code: Select all

private static IntervalXYDataset createDataset1() {
        // create dataset 1...
        TimeSeriesCollection dataset = new TimeSeriesCollection();
        // create series
        
        TimeSeries series1 = new TimeSeries("Daily Data");
        series1.add(new Day(1, SerialDate.MARCH, 2012), 10.2);
        series1.add(new Day(2, SerialDate.MARCH, 2012), 17.3);
        series1.add(new Day(3, SerialDate.MARCH, 2012), 14.6);
        series1.add(new Day(4, SerialDate.MARCH, 2012), 10.2);
        series1.add(new Day(5, SerialDate.MARCH, 2012), 17.3);
        series1.add(new Day(6, SerialDate.MARCH, 2012), 14.6);
        series1.add(new Day(7, SerialDate.MARCH, 2012), 10.2);
        series1.add(new Day(8, SerialDate.MARCH, 2012), 17.3);
        series1.add(new Day(9, SerialDate.MARCH, 2012), 14.6);
        // add series to dataset
        dataset.addSeries(series1);
        // return dataset
        return dataset;

    }

Locked