After working out how to plot time-based data using Google charts API, I created a WordPress plugin to plot values stored in a custom field against the published-on date of WordPress blog posts that use the field.
I use this plugin to keep a track of my weight. I have a private WordPress journal with a custom field called “Weight (kgs)” and each week when I make my journal entry I fill in my weight in this custom field. I have page called “My Weight” which is empty but uses the Fotherplot Template.
The plugin outputs a image and a list of the relevant data, example:
- January 17, 2009: 110.67kgs
- January 10, 2009: 113.4kgs
- January 3, 2009: 116.1kgs
- November 5, 2008: 110kgs
- October 18, 2008: 109.7kgs
- October 8, 2008: 112.9kgs
- August 30, 2008: 110.5kgs
- July 17, 2008: 103.4kgs
- April 8, 2008: 98.9kgs
- March 10, 2008: 99.3kgs
- February 11, 2008: 100.9kgs
- February 4, 2008: 102.3kgs
- January 28, 2008: 102.9kgs
- January 20, 2008: 103.4kgs
Imagens de tela
- Download the fotherplot plugin and you will get a directory called “fotherplot” when you unzip the downloaded file. Upload the “fotherplot” directory to your WordPress plugins directory (e.g.
- Activate the plugin through the ‘Plugins’ menu in the WordPress dashboard.
- Do you already have some data that you want to chart contained in a custom field? If so, go to the Fotherplot settings page and specify the custom field name in the dropdown. If not, decide what the name of the custom field that you want to plot is going to be and create a couple of posts (with different publish dates) first.
- To display the graph on your blog see https://wordpress.org/extend/plugins/fotherplot/faq/
- How do I display the fotherplot chart on my blog?
By default the fotherplot chart is only non-publically displayed in the settings page in the WordPress dashboard. You have three options to display the fotherplot chart on the public side of your blog:
- To display the chart on any post or page, simple embed the text “[fotherplot]” into the content. The tag will be replaced with the chart image.
- If you want to display the chart on a page:
- Copy the
page_fotherplot.phppage template from the plugin directory to the folder of the theme you’re currently using (
- From the WordPress dashboard, create a new page.
- From the “Template” dropdown in the sidebar, select “Fotherplot”.
- Use preview to check it works (remember you need to have a couple of values input before you’ll see a chart).
- Copy the
- An alternative method to display the chart somewhere specific (e.g. in a post):
- Install the phpexec.php plugin so you can run PHP code from pages and posts. Activate this plugin from the dashboard.
- To plot the chart, in one of your pages or posts, put the following:
<phpcode><?php echo plotDataAgainstTime(); ?></phpcode>. You can just display the chart or just the data list (or both). See the parameter options below.
- What are the parameters that can be passed to the “plotDataAgainstTime()” function?
- Optional Parameter 1: Name of custom field. This is not necessary because by default the custom field specified in the settings page is used but you can use this if you want to override the default (i.e. Only really useful if you want to chart more than one custom field).
- Optional Parameter 3: Whether to show chart image. 1=yes, 0=no. Defaults to yes.
- Optional Parameter 4: Whether to show list of custom values. 1=yes, 0=no, Defaults to yes.
- You can also use the same parameters in the shortcode:
[fotherplot customfieldname="mycustomfield" showgraph=1 showlist=1].
There are no reviews for this plugin.
Contribuidores e desenvolvedores
“Fotherplot” é um software com código aberto. As seguintes pessoas contribuíram para este plugin.Contribuidores
Traduzir “Fotherplot” para o seu idioma.
Interessado no desenvolvimento?
Navegue pelo código, dê uma olhada no repositório SVN ou assine o registro de desenvolvimento via RSS.
Registro de alterações
- Modified code to use the shortcode API in order to allow parameters. Now we can use
[fotherplot showlist=1]to show the list of posts that contain the data we’re plotting.
- Fixed bug where the plugin settings page wasn’t showing the chart. I was missing a “echo” statement.
- Fixed bug encountered when plugin is first installed and only 2 data items exist in posts published on the same day. Now gives an error message (instead of going into a infinite loop, i.e. crashing).
- No code change – just updated to new Changelog format and fixed broken screenshot images.
- Added “[fotherplot]” WordPress shortcode.
- Fixed date bug.
- Added a fotherplot settings page in the WordPress dashboard where you can specify the custom field you want to chart (Yay! no need to touch PHP code anymore).
- Added some error messages: e.g. displays error if non-numeric custom field values are used, or if not enough data is input or if no custom fields are available.
- Added a fotherplot page template so it’s possible to use the plugin without installing the `phpexec’ plugin. No functionality change in this release.
- First WordPress plugin version. Two features: 1) Draw chart of custom field value over time. 2) Display list of values in time order.
- Inital draft version (Not in proper WordPress plugin format)