It seems that the chart API doesn't parse out a date and use it as a
domain/range value (this would be nice to have, especially with XSLT
processing!) and I've been asked numerous times how I manage to do
this. So here it is for those of you out there struggling to get a non-
uniform spacing on a domain consisting of dates, simply try the
following:

  1) For each plot point ([value], [date]) create a conversion to
([value], [epoch seconds]) - most programming languages cater for this
or at least some way to convert a dateTime to a numeric value of
sorts.

  2) Normalize the set: find smallest epoch seconds value in the set,
then subtract this amount from each epoch seconds value.  equation:
($EpochValue - $MinEpoch) - This just mean using less characters, but
is not entirely necessary as the chart can do this for you.

  3)generate the chart URL

you can see the effect of this grouping in the following example:
http://chart.apis.google.com/chart?cht=lxy&chs=800x300&chxt=x,y,y&chxl=0:|2010-08-01|2010-10-15|1:|0|230|2:|umol/l&chxp=2,50&chco=000000,FF0000,0000FF&chm=o,004185,0,-1,10&chds=0,430,14,230&chd=t:0,160,170,180,185,190,198,211,358,371,389,430|14,30,50,77,155,170,88,71,111,131,155,230&chtt=Test+Chart

Parameters of the above example are as follows:
cht=lxy
chs=800x300
chxt=x,y,y
chxl=0:
    2010-08-01
    2010-10-15
    1:
    0
    230
    2:
    umol/l
chxp=2,50
chco=000000,FF0000,0000FF
chm=o,004185,0,-1,10
chds=0,430,14,230
chd=t:0,160,170,180,185,190,198,211,358,371,389,430
    14,30,50,77,155,170,88,71,111,131,155,230
chtt=Test+Chart

-- 
You received this message because you are subscribed to the Google Groups 
"Google Chart API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-chart-api?hl=en.

Reply via email to