Summary: Creating charts in PmWiki
Version: 0.1
Status: Alpha?
Questions answered by this recipe
This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.
Description
'This recipe allows for the creation of simple charts in PmWiki by inline specification of the data.'This recipe allows for the creation of simple charts in PmWiki by inline specification of the data.
Notes
Installation
- Download LibChart 1.1
- Unpack the libchart in the
cookbook/ directory
- Download libchart.phpΔ and put it in the
cookbook/ directory
- Make a libchart directory inside
pub/
- make sure the libchart directory is world writable (chmod 777 pub/libchart)
- Add
include_once("$FarmD/cookbook/libchart.php"); to your config.php
Usage
(:chart title='Your Chart' data='1,2,3,4' labels='1,2,3,4' width=400 height=300 type=(HorizontalChart|VerticalChart|PieChart):)
- Also supports (:chartdir:) instead of (:chart:) for compatibility with ChartDirector
- Width and Height are in pixels
- Only data and labels are required, the rest is optional
- type must be one of HorizontalChart,VerticalChart,PieChart (case sensitive probably) -- defaults to VerticalChart
- The charts are cached for an indefinite time -- delete the files in
pub/libchart if you want to regenerate them.
Release Notes
- 09/02/2006 - Initial version
Examples
Vertical bar chart
(:chartdir title='Network Activty Summary Packets' data=150,147,857,509,598,351,352,566,298,376,327,588,604 labels='Apr 01,Apr 08,Apr 15,Apr 22,Apr 29,May 06,May 13,May 20,May 27,Jun 03,Jun 10,Jun 17,Jun 24':)
Horizontal barchart
(:chartdir title='Most visited pages for www.example.com' data=50,83,142 labels='/wiki/Instant_messenger, /wiki/Web_Browser, /wiki/World_Wide_Web' type=HorizontalChart width=600 height=400:)
Pie chart
(:chartdir title='User agents for www.example.com' data=80,75,50 labels='Mozilla Firefox, Konqueror, Other' type=PieChart width=600 height=400:)
Comments
- Would it be possible to publish any sample pages please (including source markup) Thx! (hfwang sep032006)
- Of course, see the page now :) Breyten
- Does not work, neither does chart director - Poor quality code and documentation
- PKHG: Got it working, after some small changes ... ;-) 070426:0941
- I couldn't get it to work either. Unfortunately, I don't have the expertise to incorporate the "small changes" mentioned above. Could someone help with this? Thanks in advance.
- After rebuilding php with a GD library that properly incorporated freetype2, I was able to get libchart working. I've uploaded a new file libchart-1.2-compat.phpΔ that reflects the changes I made to get libchart-1.2 (the latest from http://naku.dohcrew.com/libchart/pages/introduction/) working in my setup - YMMV.
See Also
Contributors