View Full Version : Time Series Chart

31 Aug 2009, 6:40 AM
I'm having a really hard time getting a time sieries line chart to display right. Take the two time series below, i'd like to get a chart with a timestamp x axis showing markers at hour intervals with two lines showing each y axis with markers on the values.

Series 1
X Axis Y Axis
1/1/2000 10:00 AM 3.14
1/1/2000 11:00 AM 2.20
1/1/2000 11:30 AM 8.24

Series 2
X Axis Y Axis
1/1/2000 10:15 AM 7.44
1/1/2000 11:20 AM 3.66
1/1/2000 11:45 AM 2.26

it seems like a simple problem but the line charts can't seem to do it. If i add an x axis with these lables:
String[] dates = {
"1/1/2000 10:00:00 AM",
"1/1/2000 11:00:00 AM",
"1/1/2000 12:00:00 PM"

i can't add a point at 11:20 AM.... any help? I just want a time series scatter plot with connecting lines smart enough to handle dates as an x axis...

2 Sep 2009, 6:45 AM
I have a problem actually understandig what you want to achieve? Could you post your code?

8 Sep 2009, 4:41 AM
Hi bsautner,

Did you found a solution for this ?

I'm trying to do the same, have a time series chart. Time in the X and value on the Y with the correct scale and adjustment.


8 Sep 2009, 4:46 AM
Any sample code?

10 Sep 2009, 7:57 AM
I'm not sure why code is needed here. He wants a time series chart and wants the chart module to handle that smartly. If the difference between two points is 60 minutes, the visual distance on the displayed x axis should be twice as large as if the point difference was 30 minutes.

For the record: I don't think that's possible with OFC, and I really, really would appreciate if I would be wrong ;) I would need such a feature as well.

19 Oct 2009, 7:58 AM
Thanks for the replies - i was actually still trying to figure this out when i stumbled upon my original old post. maniac is right, i'm trying to build a chart where i have a collection of double/date - let's say i have these values to trend in a chart

value timestamp
5.5 1/1/2009 8:00 AM
6.5 1/1/2009 8:05 AM
3.2 1/1/2009 8:25 AM
4.4 1/1/2009 9:00 AM
8.3 1/1/2009 9:32 AM

none of the chart sample codes seems to adress what should be a basic need. Dates on X, Value on Y and smart enough to give me ticks on regulare date intervals (say 8AM to 10AM) with ticks every 30 minutes and markers on my values.

26 Oct 2009, 7:34 AM

it just seems like the chart examples let you do a line chart with a value at each marker which isn't realistic for a time series where markers are at regular intervals but values are somewhere in between - how would i add an X and Y Axis and data to get myself close to creating a chart like this one


just changing time series values over a date range of markers...

If we need sample code - take this right from the chart galery area chart example where it puts values on Month markers, how would i add a value in between march and april?? obviously this example would understand it becuse the collections need a value at each X marker....

class AreaChartExample implements ChartModelExample {
public ChartModel getChartModel(int segments) {
ChartModel cm = new ChartModel("Growth per Region",
"font-size: 14px; font-family: Verdana;");
XAxis xa = new XAxis();
xa.setLabels("J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D");
AreaChart area1 = new AreaChart();
for (int n = 0; n < 12; n++) {
if (n % 3 != 0)
area1.addValues(n * Random.nextDouble());
AreaChart area2 = new AreaChart();
int floor = Random.nextInt(3);
double grade = (Random.nextInt(4) + 1) / 10.0;
for (int n = 0; n < 12; n++) {
if (n % 2 != 0)
area2.addValues(n * grade + floor);
return cm;


30 Mar 2010, 2:59 AM
Did anyone come up with a solution for this?

30 Mar 2010, 6:58 AM
I ended up using the Google Visualization API for GWT - the time series chart they have is the same as the one on Google finance, it's really slick. You can see the chart on my Nimbits data logger web site: http://www.nimbits.com. Hope that helps