NB. This page documents features of the upcoming PasiChart WP plugin. All of these features are not yet implemented, and this page doubles as a to-do list for myself. It’s a good preview for you folks out there as well. Comments are welcome.
Post & Page Filters
PasiChart plugin filters the posts and pages you create and replaces properly formatted strings with appropriate chart images. A few examples of this functionality can be seen on the test page.
All PasiChart strings begin with double opening brackets and string “pasichart”, and end with double closing brackets. In simplest form you get an empty chart by writing
[[pasichart]], as shown below.
Before the first closing bracket you can give parameters for the chart. The following table illustrates the available options.
|[[pasichart db X]]||Draw chart data from database table, which has ID X. Tables can be managed through administration interface.||No other tags allowed.|
|[[pasichart normal]]||Generate chart image from value given in following tags. This is the default, not necessary to explicitly specify.||The following tags specify the data.|
|[[pasichart blog]]||Generate chart image from number of posts and comments in this blog.||Some of the other tags can be used to customize, but not to add data.|
These tags can be used to customize the chart image, and are valid with all the chart types, except the db type. The tags are enclosed within their own single brackets after the main tag, and before the final closing bracket.
Caption tag allows you to specify caption for the image. If caption is not specified, the space is freed for the chart. For example, you could write
[[pasichart]], which results in the following chart image.
… To be continued…
For inserting charts into sidebars and any other places than the actual posts and pages, you need to use PHP functions. Actually, there’s only two functions available. Below are their descriptions.
mixed pasichart_insert_graph ( [ int chart_id [, bool echo_tag ] ] )
This function draws chart data from database with the chart ID number. If no ID number is given, it defaults to lowest ID number in database. If echo_tag is TRUE (as it is by default), the generated image tag is echoed directly to output; otherwise, it’s given as return value. If return value is FALSE, something went wrong, which usually means that the chart ID was not correct/found.
bool pasichart_insert_blog_stats ( [ int data [, int type [, int days [, int width [, int height [, string caption [, bool echo_tag ] ] ] ] ] ] ])
Generates graph from this blog’s post and comment history. Parameters:
|data||0 – Posts and comments
1 – Only posts
2 – Only comments
|type||0 – Daily
1 – Weekly
2 – Monthly
3 – Yearly
|days||0 – Entire blog history
Other – Amount of days backwards from today
|width||0 – Default width (300px)
Other – Width of graph image
|height||0 – Default height (200px)
Other – Height of graph image
|caption||Title text of the chart||empty|
|echo_tag||TRUE – Echo proper image tag to output
FALSE – Return proper image tag
Function returns TRUE on success, and FALSE otherwise. Reasons for possible failure remain undefined.