Title: Simple Graph
Author: pacius
Published: <strong>2007 年 4 月 3 日</strong>
Last modified: 2011 年 3 月 18 日

---

搜尋外掛

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

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

# Simple Graph

 由 [pacius](https://profiles.wordpress.org/pacius/) 開發

[下載](https://downloads.wordpress.org/plugin/simple-graph.1.0.5m.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/simple-graph/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/simple-graph/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/simple-graph/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/simple-graph/#developers)

 [技術支援](https://wordpress.org/support/plugin/simple-graph/)

## 外掛說明

Draws a graph of single set of date related data. Graph can be made public (i.e.
sidebar widget or static page) and the data can be manipulated through dashboard.
Many people use this plugin for weight tracking on their blogs (as do I), but it
has been used for many other things as well. Only requirement – or rather a constraint–
is that the horizontal axis of the graph shows dates. The vertical axis can hold
any values. Each user can have their own graphs, which can be easily inserted in
posts and pages.

### Content filter

If you want to insert a graph in posts and/or pages, simply write a string similar
to following in your post or page.

[[simple-graph n=1 x=0 y=0 trend=0 wkly=0 lm=0 ytd=0 uid=0 gid=0 ]]

Just replace the values as you wish. The ones above are default values, and if you
don’t need to change the default value, you can simply omit that value from the 
string. I.e. [[simple-graph]] alone produces the graph with default values drawn
from widget setup.

 * n is number of widget options, from where default options (such as colours) are
   drawn
 * x is width, any positive value is acceptable
 * y is height, any positive value is acceptable
 * trend is whether trend graph is shown, 0 = no, 1 = yes
 * wkly is whether weekly averages are shown, 0 = no, 1 = yes
 * lm is whether only values from last month are shown, 0 = no, 1 = yes
 * ytd is whether only values from last year are shown, 0 = no, 1 = yes
 * uid is user ID of the graph owner (see WordPress dashboard -> Users)
 * gid is user-specific graph number, same as in widget control panel’s graph# selection

## 螢幕擷圖

[⌊Data management page⌉⌊Data management page⌉[

Data management page

[⌊Widget control panel⌉⌊Widget control panel⌉[

Widget control panel

[⌊Widget in action⌉⌊Widget in action⌉[

Widget in action

## 安裝方式

IMPORTANT! When upgrading from versions earlier than 1.0.0, please deactivate the
plugin before copying the new files and activate it again after the files are in
place. The database tables have changed, so this is vital!

Requires that your PHP installation has GD support enabled. The plugin’s configuration
page shows information on this.

First of all, backup your WordPress files and database! Installation of this plugin
shouldn’t do any harm, but since I’ve done absolutely no testing besides using it
on my WP 2.0.3 platform, I cannot guarantee it’s entirely bug free. Also, this is
my first ever WP plugin, which I created both for fun and to learn the art of making
plugins. So, this plugin is provided AS IS, and installation and usage of this plugin
is entirely at your own risk. I will not assume any responsibility for any possible
damages. (Although it still isn’t supposed to cause any damages.)

Extract the zip archive in your WordPress plugins folder (wp-content/plugins/) and
then activate the plugin through your WordPress dashboard. The activation sets up
initial configuration options and creates the database table for the plugin data.

Please make sure that you upload/extract the simple-graph folder entirely in your
plugin folder, and not just the contents of it! Your folder structure should look
like this:

    ```
    * wp-content/plugins/
          o simple-graph/
                + pjm_graph.php
                + grapher/
                      # graph.php
    ```

Finally, insert a code similar to the one below to your WordPress theme, for example
in the sidebar.php file. The essential part is calling the pjm_graph() function.
Note! If you are using widgets, of course you don’t need to edit any files.

    ```
    <?php if (function_exists('pjm_graph')) { ?>
    <li><h2>The Project</h2>
    <?php pjm_graph(); ?><br />
    <a href="http://www.pasi.fi/simple-graph-wordpress-plugin/">About this graph plugin
    </a>
    </li>
    <?php } ?>
    ```

Installation is now complete!

There are some parameters to that function though, so if you want to make your graph
look different, you might want to check these out.

You can override width and height of the graph with function parameters. Also, as
of v0.9.3 it is possible to add optional trend graph with a boolean flag. In version
0.9.6 further parameters (target, ytd, lm, and wkly) were added. See the function
declaration below.

void pjm_graph($NUM, $WIDTH, $HEIGHT, $TREND, $TARGET, $YTD, $MTD, $WKLY, $UID, 
$GID, $ONLY_RETURN_TAG);

Zero (0) values for WIDTH and HEIGHT preserve the default width and height that 
are specified in the admin panel. Any other values override the default.

TREND, TARGET, YTD, MTD and WKLY parameters expect a boolean value, which is either
TRUE or FALSE. By default they’re all FALSE. If TREND is TRUE, gliding trend graph
appears. If YTD is TRUE, only the values from last year are used in the graph. If
MTD is TRUE, only the values from last month are used. (If YTD is TRUE, value of
MTD is irrelevant.) If WKLY is TRUE, rough weekly average values will be calculated
instead of daily values where possible. TARGET is not fully implemented yet and 
thus its value has no meaning at the moment.

NUM specifies which of different widget options are used for default settings. UID
and GID specify which user (user ID) and which graph (user-specific ID) is taken
from database. For each of these, value 1 is the default.

Finally, ONLY_RETURN_TAG is a boolean; if TRUE, the IMG tag is only returned from
function, not printed; if FALSE, it’s both returned and echoed; FALSE is default.

## 常見問題集

  How about multiple graphs?

If a 1.0 release is ever finished, it will support multiple graphs. However, don’t
hold your breath.

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈Simple Graph〉的開發相關工作。

參與者

 *   [ pacius ](https://profiles.wordpress.org/pacius/)
 *   [ MarkDennehy ](https://profiles.wordpress.org/markdennehy/)

[將〈Simple Graph〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/simple-graph)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/simple-graph/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/simple-graph/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/simple-graph/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/simple-graph/)。

## 變更記錄

#### 1.0.5

 * Added basic Google Chart API support for rendering the widget graph. The graph
   looks better, but there’s a limit to amount of values shown due to URL length
   limitations. Currently weekly averages is forced to reduce number of values. 
   If graph doesn’t show, try disabling the trend graph, which effectively reduces
   the value count to half. If the graph is still empty or doesn’t show up at all,
   disable Google Chart API support from widget control pane. It’s disabled by default.
   Note that some widget options are not used at this time when Google Chart API
   is enabled. This will be fixed in the future.

#### 1.0.4

 * Fixed version numbering. 🙂

#### 1.0.3

 * Fixed widget not showing when PHP register_globals was on.

#### 1.0.2

 * Fixed widget customization bug. (Control panel changes did not affect the widgets.)

#### 1.0.1

 * Fixed activation bug which occurred in a rare situation.

#### 1.0.0

 * Added multiple widgets support.
 * Added multiple user-sensitive graphs, i.e. each user may have their own graphs.
   Each user can also see and edit only his/her graph.
 * Added content filter which allows insertion of graphs to pages and posts.

#### 0.9.8c

 * Fixed user roles issue, which broke the plugin in WordPress 2.2.

#### 0.9.8b

 * Fixed broken graph image for sites that use different site and WordPress addresses.

#### 0.9.8

 * Added configurable title and text to widget. Both can contain wildcards which
   are replaced by values such as highest value, lowest value, et cetera.
 * Extended widget control panel significantly.
 * Removed old plugin configuration page as it was redundant.
 * Bug fix: plugin now works even if plugin folder name is changed.

## 中繼資料

 *  版本 **1.0.5**
 *  最後更新 **15 年前**
 *  啟用安裝數 **20+**
 *  WordPress 版本需求 ** 2.0.1 或更新版本 **
 *  已測試相容的 WordPress 版本 **2.3.1**
 *  語言
 * [English (US)](https://wordpress.org/plugins/simple-graph/)
 * 標籤:
 * [chart](https://tw.wordpress.org/plugins/tags/chart/)[google chart API](https://tw.wordpress.org/plugins/tags/google-chart-api/)
   [graph](https://tw.wordpress.org/plugins/tags/graph/)[weight loss](https://tw.wordpress.org/plugins/tags/weight-loss/)
   [widget](https://tw.wordpress.org/plugins/tags/widget/)
 *  [進階檢視](https://tw.wordpress.org/plugins/simple-graph/advanced/)

## 評分

這個項目尚無任何評論記錄。

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

[查看全部使用者評論](https://wordpress.org/support/plugin/simple-graph/reviews/)

## 參與者

 *   [ pacius ](https://profiles.wordpress.org/pacius/)
 *   [ MarkDennehy ](https://profiles.wordpress.org/markdennehy/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/simple-graph/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](http://tinyurl.com/3aths7)