Title: Tally Graph
Author: Dylan Kuhn
Published: <strong>2008 年 10 月 7 日</strong>
Last modified: 2022 年 10 月 16 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/tally-graph.svg)

# Tally Graph

 作者：[Dylan Kuhn](https://profiles.wordpress.org/cyberhobo/)

[下载](https://downloads.wordpress.org/plugin/tally-graph.0.4.4.zip)

 * [详情](https://cn.wordpress.org/plugins/tally-graph/#description)
 * [评价](https://cn.wordpress.org/plugins/tally-graph/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/tally-graph/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/tally-graph/#developers)

 [支持](https://wordpress.org/support/plugin/tally-graph/)

## 描述

No recent updates? This plugin once went 9 years without an update. It probably 
works!

WordPress already lets you attach time-based custom data to posts. Tally Graph lets
you plot that data over time using the Google Chart API. Any numeric data will work,
whether it is related to athletic training, profits, environmental footprint, weight
loss, or any topic you care about.

#### Features

 * Tallies data from any numeric value you enter under “Custom Field” in the WordPress
   post editor.
 * Provides daily, weekly, monthly, or yearly tallies.
 * Tally either data that accumulates, like donations, or just track a number like
   current weight.
 * You can make basic use of Tally Graph without any knowledge of the Google Chart
   API, but you can also use nearly any [Google Chart API parameters](https://developers.google.com/chart/image/docs/chart_params).
 * Rarely requires upgrading

#### Limitations

Tally Graph is easier to use than direct Google Chart API calls, but may not be 
what you need if:

 * You’re looking for a point-and-click full graphical user interface
 * A post for each data point is too cumbersome for your graphs
 * You need to graph time intervals shorter than a day

Move on to the Other Notes tab for details.

### Usage

You’ll want to do two things to use Tally Graph:

 * _Enter Data_ – put the numbers you want to track in a WordPress custom field.
 * _Visualize Data_ – tally and plot your numbers over time in a Google Chart.

#### Enter Data

Tally Graph looks in WordPress [custom fields](https://codex.wordpress.org/Using_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.

#### Visualize Data

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](https://codex.wordpress.org/Template_Tags).
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.

### Tag Reference

Read the Usage section first.

You type a tag directly into a post or page using WordPress [shortcode format](https://codex.wordpress.org/Shortcode_API).
To put a tag in a theme template, use [template tag with querystring parameters](https://codex.wordpress.org/Template_Tags/How_to_Pass_Tag_Parameters#Tags_with_query-string-style_parameters).
Both formats take the same parameters listed below.

#### tally_graph

This tag is replaced with an image created with the Google Chart API.

Shortcode: `[tally_graph key="My Key"]`

Template Tag: `<?php echo tally_graph('key=My Key'); ?>`

Parameters:

 * **key** – Required.
 * The key name of the custom field to use for the graph. Multiple keys can be included,
   separated by a comma.
 * _tally\_interval_
 * valid values: `day`, `week`, `month`, or `year`. default is `month`.
 * this is the interval of time over which the custom field values are tallied.
 * _label\_interval_
 * valid values: `day`, `week`, `month`, or `year`. default is tally_interval.
 * this is the interval of time that is labeled at the bottom of the graph
 * _interval\_count_
 * Default is `6`.
 * This is the number of intervals to include in the graph.
 * _to\_date_
 * Valid values include several date formats, like `2007-10-31`, `October 31, 2007`,`
   today`, or `yesterday`. Default is the date of the most recent post displayed.
 * The graph is constructed backward in time from this date.
 * _method_
 * Valid values are `cumulative`, `track`, or `delta`. Default is `cumulative`.
 * The `cumulative` method totals custom field values for each interval.
 * The `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.
 * The `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.
 * _no\_cache_
 * Valid values: `true` or `false`. Default is `false`.
 * Turn off URL caching. Rarely used – only when the same graph appears more than
   once on a page.
 * _chs_
 * Default is `200x200`.
 * This is a [Google Chart API](https://developers.google.com/chart/image/docs/chart_params)
   parameter, the chart size in pixels.
 * _cht_
 * Default is `bvs`.
 * This is a [Google Chart API](https://developers.google.com/chart/image/docs/chart_params)
   parameter, the chart type. `bvs` is a vertical bar chart.
 * Any other [Google Chart API parameters](https://developers.google.com/chart/image/docs/chart_params)
   are passed along, so you can go nuts with all the options. You’ll probably use
   at least `chtt`, the chart title.

#### tally_graph_url

If you want to create your own image tag in a template, this tag will give you only
the URL for the chart.

Template Tag: `<?php echo tally_graph_url(); ?>`

Parameters are the same as the `tally_graph` tag.

## 屏幕截图

 * [[
 * Some examples of custom fields attached to a post. They’ll be tallied by the 
   post date.
 * [[
 * Some different kinds tally graphs in a page.
 * [[
 * Some monthly tally graphs in a sidebar.

## 安装

Install using any [standard plugin installation method][https://codex.wordpress.
org/Managing_Plugins#Installing_Plugins].

## 常见问题

### Do I have to know about this Google API thing, or anything else techy?

You can get by with very little techyness, just WordPress custom fields and shortcodes.
They’re really not bad – look over the Usage section under Other Notes. It’s not
a point-and-click interface either, but it is easier than building your charts from
scratch.

If you do want to get adventurous, you can have fancier charts in more places.

### Are there any examples?

Check the [forum](https://wordpress.org/tags/tally-graph?forum_id=10), there’s at
least one [oldie-but-goodie](https://wordpress.org/support/topic/plugin-tally-graph-example-implementation-fishing-stats?replies=1).

### Where are the custom fields?

As of WordPress 3.3 you must check a box in the “Screen Options” area in the upper
right of the post editor page to make the custom field interface appear.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Tally Graph」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Dylan Kuhn ](https://profiles.wordpress.org/cyberhobo/)

[帮助将「Tally Graph」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/tally-graph)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/tally-graph/)，查看[SVN仓库](https://plugins.svn.wordpress.org/tally-graph/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/tally-graph/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/tally-graph/)。

## 更新日志

#### 0.4.4

 * Security improvements

#### 0.4.3

 * Support for PHP 7+

#### 0.4.0

 * New feature: the label_interval parameter

## 额外信息

 *  版本 **0.4.4**
 *  最后更新：**4 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 2.5.1 或更高版本 **
 *  已测试的最高版本为 **6.0.12**
 *  语言
 * [English (US)](https://wordpress.org/plugins/tally-graph/)
 * 标签
 * [charts](https://cn.wordpress.org/plugins/tags/charts/)[google](https://cn.wordpress.org/plugins/tags/google/)
   [graphs](https://cn.wordpress.org/plugins/tags/graphs/)[mashup](https://cn.wordpress.org/plugins/tags/mashup/)
   [visualization](https://cn.wordpress.org/plugins/tags/visualization/)
 *  [高级视图](https://cn.wordpress.org/plugins/tally-graph/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/tally-graph/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/tally-graph/reviews/)

## 贡献者

 *   [ Dylan Kuhn ](https://profiles.wordpress.org/cyberhobo/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/tally-graph/)