Add Google charts and graphs to your WordPress site based on tallies of any numeric custom field over time. Visualize progress toward any goal.
You'll want to do two things to use Tally Graph:
Tally Graph looks in WordPress custom fields for data to pass on to the Google Chart API. As indicated by those instructions, a custom field consists of a key and value. You'll make up the key. The value must be some kind of number. In the next step you'll use the key name to tell Tally Graph which custom field data to use.
If you want to enter data without publishing a post, just put the custom fields on a dummy post and check "Keep this post private". You may still want to edit the post date.
Say you have a bunch of posts with the custom field key "Marbles Lost". You may feel like you've been losing your marbles faster recently, but you're not sure, so you write a new post (or a page) containing this shortcode:
[tally_graph key="Marbles Lost"]
The Tally Graph plugin will replace that shortcode with a bar chart of how many marbles you've lost each month for the past six months. Those are default settings you can change with some more parameters.
[tally_graph key="Marbles Lost" tally_interval="day" interval_count="14" to_date="2008-05-01" chs="300x220" chtt="Marbles Lost"]
That shortcode results in a 300 pixel wide, 220 pixel high graph of your marbles lost in the 14 days prior to May 1st, 2008.
Shortcodes are great in post and page content, but if you want a graph somewhere else on your site, like in a sidebar, you'll need a template tag. Aside from the different format, it works the same:
<?php echo tally_graph('key=Marbles Lost&tally_interval=week&interval_count=4'); ?>
That makes a nice sidebar graph of marbles lost over 4 weeks, up to the date of the last post displayed.
Read the Usage section first.
You type a tag directly into a post or page using WordPress shortcode format. To put a tag in a theme template, use template tag with querystring parameters. Both formats take the same parameters listed below.
This tag is replaced with an image created with the Google Chart API.
[tally_graph key="My Key"]
<?php echo tally_graph('key=My Key'); ?>
key - Required.
The key name of the custom field to use for the graph. Multiple keys can be included, separated by a comma.
year. default is
this is the interval of time over which the custom field values are tallied.
year. default is tally_interval.
this is the interval of time that is labeled at the bottom of the graph
This is the number of intervals to include in the graph.
Valid values include several date formats, like
October 31, 2007,
yesterday. Default is the date of the
most recent post displayed.
The graph is constructed backward in time from this date.
Valid values are
delta. Default is
cumulative method totals custom field values for each interval.
track method doesn't total field values, but fills in time gaps
between values. This is good for tracking numbers like current weight that you
just want to track without tallying.
delta method computes a running total, adding changes to the total
for each interval. This can be used for data where only losses and gains are
entered. One entry is necessary to establish a starting value, then gains and
losses are recorded as positive and negative values.
false. Default is
Turn off URL caching. Rarely used - only when the same graph appears more than once on a page.
This is a [Google Chart API][gapi] parameter, the chart size in pixels.
This is a [Google Chart API][gapi] parameter, the chart type.
is a vertical bar chart.
Any other [Google Chart API parameters][gapi] are passed along, so you
can go nuts with all the options. You'll probably use at least
the chart title.
If you want to create your own image tag in a template, this tag will give you only the URL for the chart.
<?php echo tally_graph_url(); ?>
Parameters are the same as the
Requires: 2.5.1 or higher
Compatible up to: 3.5.2
Last Updated: 4 years ago
Active Installs: 200+
Got something to say? Need help?