[ic] graph.usertag

Peter peter at pajamian.dhs.org
Mon Sep 8 06:09:11 UTC 2014


On 08/19/2014 03:04 AM, Josh Lavin wrote:
> Quoting dev2 at adeux.net (dev2 at adeux.net):
>> I am trying to use the graph.usertag on the RTFM site

It's been ages since I've even looked at that tag, let alone when I
wrote it way back then.  As Stefan already pointed out there are better
ways to do it now than with GD, but that said...

My first suggestion is that you just start playing around with it on an
Interchange page, see what it spits out with different options.

>> - looking at
>> the documentation I have come up with the following syntax:

>> [graph type="lines" title="Temperature" x_label="Time"
>> y_label="degrees c" query=""]

>> However, I do not really folow what the query should be.  The
>> documentation says:

>> query - SQL query returning data to populate the graph with.  The
>> first column returned is the code or label of the dataset, the
>> second column is the x-axis label and the 3rd column is the y-axis
>> point.

>> Does that mean that each row needs the dataset name - eg:
>> temp 10:00 20.0
>> temp 10:01 20.0
>> temp 10:02 19.9
> 
> If it did, then you could just do something like: SELECT 'temp',
> row1, row2 FROM ...

Exactly.  The point of allowing multiple data sets is that you could
have multiple overlaying line graphs with data for different cities, for
example, so you might have a data set for "Los Angeles", one for "New
York", one for "Cincinnati", etc, and you would get a different colored
line overlapping on the graph for each.  There is a similar idea behind
bar graphs, etc.  If you just have one dataset then you only need to
return the one dataset from your query and just give each the same name
as Josh pointed out above.

Incidentally, I don't recall if the version posted on RTFM is the most
current or not.  If not you can grab it from:
https://github.com/pajamian/stuff/blob/master/interchange/graph.usertag


Peter



More information about the interchange-users mailing list