create a BasicTimeSeries corresponding to my time

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Bart

create a BasicTimeSeries corresponding to my time

Post by Bart » Tue Dec 17, 2002 8:44 am

HEllo, I am a new user of JFreeChart:

I woul like to create a dynamic time serie specifying the time.
In the exemple I only saw some example creating a new time:

this.series = new BasicTimeSeries(graphYAxes, Millisecond.class);

and during the update:

this.series.add(new Millisecond(), functionValue); //add point to the graph

Instead of ´new Millisecond()´ I would like to create one from a known time: hour, minute, second, but I didn´t find a such constructor for Millisecond class.
Actually I just need to update it evey second , but I didn´t manage to use the Second class in a better way.

* two smaller questions:
- how to change the Font size of the Graph Title
- how to draw some vertical courbs in a time serie Plot (for represente the division by zero in my function)

Thank you for your help !


Bart

David Gilbert

Re: create a BasicTimeSeries corresponding to my time

Post by David Gilbert » Wed Dec 18, 2002 10:01 am

Bart wrote:
> Instead of ´new Millisecond()´ I would like to create one
> from a known time: hour, minute, second, but I didn´t find a
> such constructor for Millisecond class.
> Actually I just need to update it evey second , but I didn´t
> manage to use the Second class in a better way.

You could use either the Millisecond or Second classes to represent your time period. It might be simplest to use the constructor that takes a java.util.Date to initialise the time period.

> * two smaller questions:
> - how to change the Font size of the Graph Title

It's not all that straightforward in 0.9.4, because the titles are stored in a list:

TextTitle title = (TextTitle) myChart.getTitle(0);
title.setFont(...);

This will work for the standard case, but you need to watch out for the case where your chart doesn't have a title, or the title is an image rather than text.

> - how to draw some vertical courbs in a time serie Plot (for
> represente the division by zero in my function)

You can draw a vertical line on a chart using the setDomainMarker(...) method in the XYPlot class.

Regards,

DG

Locked