John,
I tried out
getXAxis().setTickLabelFormat("=(Date)h:mmaa");
and it works perfectly. It would probably be a good idea to allow line
breaks, or simply HTML,
in the format. Nevertheless, it will satisfy most time-series graphing
requirements that users of
GChart will have.
However, I've got something more in mind, and it might be a very easy
thing for you to add to GChart.
The dataset I will be displaying is from midnight yesterday until a
few minutes ago today. That means
the tick intervals are harder to calculate. What I have found is it's
simple to just add an if statement
within the loop that it calling
curve.addPoint(millis, value);
and see whether we have reached a round number in terms of time:
static final int TICK_INTERVAL_HOURS = 2;
...
if (hour % TICK_INTERVAL_HOURS == 0 && minute == 0) {
getXAxis().addTick(millis, tickString);
}
This removes the need for GChart to anticipate a wide range of time-
series requirements. The calculations
are dead simple, using a Date object to get back hour and minute
numbers. And the worst that can happen
is that a round numbered time may be missing. That's extremely rare
with the data I am plotting. But if it
were a problem, it would be easy to step along intervals in the
epochal time instead. In fact, that may be
a better solution.
If the addTick() method were to accept an offset
int offset = 10; // Pixels below default tick offset.
getXAxis().addTick(millis, tickString, offset);
I would be able to calculate and plot coarser time units as well, such
as day (Wed) and date, without them
repeating at the same frequency as the the finest tick frequency (2
hourly in the above code).
In other words, I could do two, maybe three, rows of time information:
(1) Minutes, such as 0 15 30 45
(2) Hours, such as 3pm 4pm
(3) Days and dates, such as Wed 11 June Thu 12 June
These would all fit neatly below, with no risk of messy overlap.
This may be very easy for you to add to the library (an addTick()
method with offset) I hope.
And it is very easy to code as an end-user of the GChart library.
I am responsible for one of the highest hit weather pages on the most
hit government website in my country.
Management has been unwilling to authorise sophisticated charts
because of the bandwidth costs of images.
Using GWT and GChart promises to get around that restriction, because
of course data-only is shipped.
(It took some time to convince people that client-side charts are
technically possible, and that it's written in Java.)
After the first few iterations of the GChart charts, management has
sat up and taken notice.
What do you think?
Mal.
On Jun 11, 1:54 pm, "
m.gor...@bom.gov.au" <
malcolm.gor...@gmail.com>
wrote:
> John,
>
> I'm very sorry for not seeing your post until now.
>
> I have just one suggestion right now from usingGChart, and then I'll
> take
> some time to go through yourGChartenhancements and incorporate them.