Extension talk:PChart4mw

Version compatibility
Hi there, we're using the pchart4mw extension to display scrum/sprint information. Our Software Development department displays its release progress and bug solving statistics. Until last week we had older versions of php, mysql and MW 1.15 so I updated a lot of things and it still works properly:
 * MW: 1.18.1
 * PHP: 5.3.9 (cgi-fcgi)
 * MySQL: 5.5.20
 * (Ms Server 2003 R2 x86, IIS 6.0)

incompatibility with extensions
Since I installed the Extension:Discussion we see an extra line: The name starts with UNIQ followed by some crypt characters (e.g. 28e2fd2a7ea). But everything else is displayed correctly. The rest of our environment is mentioned above.

Integration with Semantic MediaWiki (SMW)
Hi Thank you for this extension, really nice. I want to ask if there's a plan of integrating this to SMW? This is way better than the Semantic result format graph format (google)  printer

Gérard 18:58, 2 December 2009 (UTC) We're glad to hear from you and that you're pleased with the extension. We have no plans in that direction, at least not yet.


 * I'd also appreciate efforts towards integration with SMW!! - Bernhard

pchart4mw version 1.1.0
We have released a new version of pchart4mw (version 1.1.0 on June 11th 2010). This version of pchart4mw can now be used as parser function. This enables integrating pchart4mw's charting capabilities with other extensions like Semantic MediaWiki (SMW).

Now we have a question (request) to you. Could you share your experience integrating pchart4mw with SMW? Both here and if possible with the SMW community to direct others to these new possibilities? Gérard 08:10, 11 June 2010 (UTC)
 * This is an awesome release, I haven't tried it yet but I was using Pchart4mw w/SMW since its first release by setting the query result to a variable:

 ,, savings: , 

Now this will be more easier and more better.

cheers Msevero

Thank you for your response, please let us know if this new version works as expected with SMW. If your site is a public site we'd appreciate a link as well. Gérard 05:12, 13 June 2010 (UTC)

Large Dataset Line Graphs
Nice extension, thanks for adding it. Using the pChart classes gives much more swishy renders than using GnuPlot. There is one problem I have not been able to solve for my planned implementation though. When trying to create a line graph with a large amount of data, e.g.:

the x-axis labels become overlaid on top of each other until all you get is a grey line - i.e. there is no setting to say "show 5 x labels", giving me just "0, 100, 200, 300, 400, 500", on the x-axis. The extension seems to be hardwired to show every x-label as it has been entered in to the data.

This is a bit of a show-stopper for me as I need to plot 500+ point datasets as line graphs with useable x-axis ticks. At the moment I am going to have to stick with GnuplotBasic as it has the configuration to do that. Have I missed some obvious control parameter or is this not yet possible with PC4MW? MLCT 15:36, 6 June 2010 (UTC)

pchart4mw version 1.2.0
Hello, We've looked in to it. Indeed it was a missing feature in pchart4mw. We've added this feature for you. We just released a new version of pchart4mw version 1.2.0. This version now has a new parameter skiplabel=x where x is the number of labels to skip. We hope this will work for you. Gérard 16:04, 3 July 2010 (UTC)

Decimals ignored in axis labels
Hi, I'm having a problem where the labels for the y-axis are not showing up properly when I use floating point values.

 0.1 0.2 0.3 0.4 0.5 

With the specified code above, the labels for the y-axis come out like this: http://img15.imageshack.us/f/33312048.png/

pchart4mw version 1.2.0
Hello, This problem is also solved in the new version 1.2.0 of pChart4mw. We've added a parameter decimals=x specifying the number of decimals to show on the y-axis. We hope this will work for you.

Scalable for very large wikis?
This extension can use a web service as an external resource for charting. Does it make this extension scalable for very large wikis?--almaghi 17:36, 1 July 2010 (UTC)

Yes it does. This configuration option is available for situations where many charts change often. These situations can consume a lot of processing power from the server in creating chart images.

Creating chart images is a CPU intensive process. Depending on the charting intensity on the wiki a site might require more powerful server processing capacity. pchart4mw's web service option is specifically created to enable separating the processing for creating chart images from processing for the main wiki site.

However, any site with moderate changes of its charts should have no problem and should run perfectly well without a pchart4mw web service configuration. Make sure you really need this.

If you decide using pchart4mw's web service configuration option you might be the first user using this. We would appreciate if you'd share your experience and how to's. You could create a sub-page of this talk page for it. Gérard 05:24, 2 July 2010 (UTC)

Cleanup
Does the extension clean up the image files which are no longer in use (like after you edit a graph, or after you remove a graph code from your page)? Huji 12:22, 10 July 2010 (UTC)

No, see manual: http://code.google.com/p/pchart4mw/wiki/SiteMaintenance or extensions page under 'maintenance of your site'. Gérard 13:33, 10 July 2010 (UTC)

Colors
Do we have the option to chose the line colors in a line graph? --Huji 12:22, 10 July 2010 (UTC)

Yes, see manual: http://code.google.com/p/pchart4mw/wiki/Parameters#Colors and http://code.google.com/p/pchart4mw/wiki/ColorSchemes Gérard 13:34, 10 July 2010 (UTC)

Clarification
Just to clarify, this extension doesn't use any online services (like Google Chart APIs, etc); everything is done locally?

For example, if I have a network outage, mw can still generate graphs? 202.167.15.162 02:51, 4 August 2010 (UTC)


 * Indeed: This extension doesn't use any online services, it does everything locally on your MediaWiki installation. You don't need an external network connection to generate graphs. This way your chart data from the wikipage is not send to any online service. Gérard 14:41, 5 August 2010 (UTC)


 * Excellent! Keep up the good work. 202.167.15.161 05:18, 6 August 2010 (UTC)

pChart4mw + External Data extensions
Hehe, I've been experimenting with pChart4mw and Extension:External_Data because that's naturally what you'd want to do, right?

So I've made a csv file and read it in with External Data: {{#for_external_table: ,, } which produces Jan,6748,4301Feb,3911,5019Mar,3019,3941Apr,4810,6412May,2203,4823Jun,4510,4110Jul,3918,5510Aug,8810,2930Sep,7182,3504Oct,6911,3881Nov,6749,4761Dec,7184,4918 Not really good when I wrap pChart4mw tags around it

http://i38.tinypic.com/15zquir.png

OK, no real issues; the canonical solution to this is {{#for_external_table: {{{month}}},{{{US}}},{{{EU}}} } which produces (in the html source) Jan,6748,4301 Feb,3911,5019 Mar,3019,3941 Apr,4810,6412 May,2203,4823 Jun,4510,4110 Jul,3918,5510 Aug,8810,2930 Sep,7182,3504 Oct,6911,3881 Nov,6749,4761 Dec,7184,4918 Looking great, but now pChart4mw does this:

http://i33.tinypic.com/34pb71c.png

Now, I don't know if it's a pChart4mw or an External Data issue, but is it possible that pChart4mw is not parsing the tag correctly? If it is not supposed to, can it be something to be added in the future?

For the time being, I'm using this workaround: {{#pLines: ymin=0|ymax=10000|axiscolor=888888|cubic|filled|angle=90|plots|legend|data= {{#for_external_table: ,US,EU {{{month}}},{{{US}}},{{{EU}}} }} }}

http://i34.tinypic.com/2ij2hok.png

Other workarounds include using a different delimiter (eg ';') and hacking the pChart4mw source (but I don't really wanna do that. I've also tried various ways of putting newline characters with no luck. 202.167.15.161 03:08, 9 August 2010 (UTC)

L.S., I am not familiar with the external data extension. (It seems you're trying to accomplish something that is outside  the design of pchart4mw.) I struggle understanding what the syntax is you want to see work in combination with pchart4mw. Can you provide an example of what you ideally would like to see work? Gérard 10:26, 15 August 2010 (UTC)
 * After some investigation, I don't think there's an issue with either extension. The correct raw input is being passed into pchart2mw (I checked by returning the raw input) so I think something far sinister is happening. The workaround is fine for now since I'm using these extensions for internal purposes. All the recommendations for parsing you are already using, so I'm not really sure why it's causing the errors. I think the effort required is not worth the outcome, so I'm gonna leave it until I find some time. All in all, great extension!202.167.15.163 05:06, 30 August 2010 (UTC)
 * Thank you for the follow-up and the compliment, we're glad our extension works for you. Gérard 13:12, 03 September 2010 (UTC)

Font Name is Case Sensitive
For those with font not found issues, you will also need to rename the "Fonts\tahoma.ttf" to "Fonts\Tahoma.ttf" - Zinthose 18:13, 8 December 2010 (UTC)
 * Thanks Zinthose! That was really bugging me, directly after installation. Also, the bogus error message didn't make it much clearer to me, what to do: "Warning: imageftbbox [function.imageftbbox]: Could not find/open font in /mediawiki/extensions/pChart4mw/library.inc.php on line 45" --Kebap 11:43, 10 December 2010 (UTC)
 * And also, I think the "Fonts" directory itself is referred to as "fonts" in some places. I would like to offer pre-release testing on a case-sensitive file system before future releases. That would probably save you lots of complaints. :-) --Bytesmiths 19:42, 14 February 2012 (UTC)

View ploted datas
Hi all, is possible to show the ploted datas in a table? The data source is an table ...

tx Gerhard.


 * I am sorry, we're sticking to pchart4mw's basic function, just drawing charts. Gérard 08:45, 16 December 2010 (UTC)

Bug: no graph shown, only white box
Hi all! I have just installed this nice extension, solved all obvious errors, but still can't seem to get my first chart drawn. All I get is a white box of 500x300 pixels. An image file is indeed created in the images folder, but it is completely white. What may I be missing here? Thanks in advance! --Kebap 11:52, 10 December 2010 (UTC)


 * My best guess at this point is to re-check your installation of the extension and the phart library. The preferred installation is:

../extensions/pChart4mw/*.php                The extensions php files ../extensions/pChart4mw/colorschemes/*.txt   The extensions colorschemes ../extensions/pChart4mw/pChart/pCache.class  A pchart-library php class ../extensions/pChart4mw/pChart/pChart.class  A pchart-library php class ../extensions/pChart4mw/pChart/pData.class   A pchart-library php class ../extensions/pChart4mw/pChart/Fonts/*.ttf   The pchart-library fonts


 * Also double check case-sensitivity and make sure your PHP has GD library and freetype extension enabled. Hope this solves it. Gérard 08:16, 16 December 2010 (UTC)


 * We have not heard from you anymore so probably your problem is solved. If not: try the new version of pChart4mw version 1.3.0, its installation is made a lot easier. Gérard 18:29, 28 December 2010 (UTC)

Hello Gérard, thanks for your reply! I now tested with the new version and double-checked your comments. I have the exact same folder structure, and my PHP has GD library and freetype extension enabled. However still I receive white transparant images with no charts. Is there any debug log or other info I could show you to help solving this issue? --Kebap 12:02, 4 February 2011 (UTC)

Seems like we solved this bug. I tested quite a lot and am not sure, but maybe this is the explanation. When I copy/pasted the code for my first chart, it accidentally dropped all line-breaks. So the code on your page looked like this:

5345 3452 7843

After copy/pasting this into my wiki page, it looked like this: 5345 3452 7843

This would create the above problem. I don't know why copy/paste would drop line-breaks, but would probably make sense to include a note about this on your page. Thanks again and keep up the good work! :) --Kebap 13:49, 21 February 2011 (UTC)


 * Thanks for following up on this. Good to hear it is working now. pChart4mw does indeed depend on line-breaks in the data to be displayed. This is a normal, intentional practice not a bug in pChart4mw. This 'losing line-breaks' can happen, depending on your text-editor. Enjoy pChart4mw. Gérard 04:04, 23 February 2011 (UTC)

Excel 2k7 ColorScheme
Here is a new color scheme that matches that of the charts in Excel 2007. Create a text file and save it to:

excel.txt
69,114,167 170,70,67 137,165,78 113,88,143 65,152,175 219,132,61 147,169,207 209,147,146

Example
-- Zinthose 19:26, 10 December 2010 (UTC)


 * Thank you for your contribution, very nice. I'll add this colorscheme to pchart4mw's distribution files. -- In fact I just did add it to pchart4mw version 1.2.1 Gérard 08:47, 16 December 2010 (UTC)

example
It would be really nice if there was a page where users could try this out before they install it. Is there an example page which can be added? Igottheconch 02:12, 23 March 2011 (UTC)
 * No I am sorry we do not have a test or trail site. Installing (and uninstalling) this extension is pretty straightforward just like any other extension and detailed configuration settings aren't required. So to try this extension you have to add it to your wiki. Gérard 06:30, 28 March 2011 (UTC)

Available Parameters
I love the extension! :) However, is there a list of the available parameters for the different graph types. Specifically, I would like to create a stacked line graph. --Mr Minchin 18:34, 28 April 2011 (UTC)
 * Our parameter documentation describes first the general parameters that are available for all chart types and then the chart specific parameters. pChart4mw supports filled line charts. The stacked parameter is only available for bar charts. See our examples.... Gérard 05:43, 29 April 2011 (UTC)

Thanks!
I just want to thank and congratulate you on having the most thoroughly documented extension I have ever seen. I hope others will use it as an example and will try to live up to the standard you have set. Mickeyf 19:59, 29 June 2011 (UTC)
 * Thank you for the compliment. We believe that quality (and usability) of a software product is determined by the whole package, including good documentation. Gérard 05:47, 1 July 2011 (UTC)

Command line tool?
I wonder if anyone has managed to run Pchart4mw as a command line tool? I.e. I would like to run something like:

php pchart.php -o mychart.png mychart.txt

I would then be able to use pchart with the emacs org-mode and at the same time easily transfer the result to our mediawiki server. --Dov Grobgeld 08:53, 5 July 2011 (UTC)

Print Values on Chart(s)
Is there an parameter that will print the value of the data points on the Pchart4mw created chart? I have seen examples of this on the http://pchart.sourceforge.net/ but can't figure out how to do it with Pchart4mw.
 * Sorry, this feature is not implemented in pChart4mw even tough pChart is able to do it. Gérard 09:40, 13 July 2011 (UTC)

I would be interested in this feature if it could be made available. Thank you for the great extension!

Possible Defect in pLines with Filled Parameter
I have been attempting to create charts with the filled parameter; however, I have not be able to create a successful chart without the use of "cubic" with conjunction of "filled".

for example,

 ,US,EU Jan,6748,4301 Feb,3911,5019 Mar,3019,3941 Apr,4810,6412 May,2203,4823 Jun,4510,4110 Jul,3918,5510 Aug,8810,2930 Sep,7182,3504 Oct,6911,3881 Nov,6749,4761 Dec,7184,4918 

does not produce what I am expecting. Is this an issue, or works as designed? --Mcdaniel 02:23, 6 July 2011 (UTC)


 * Thank you for reporting this. Is was a missed feature. A new release (version 1.3.1) is now available for download that solves this issue. Gérard 05:47, 13 July 2011 (UTC)

Why no graphics when using the slide extension?
I'm have just been trying out the S5-based slide extension for mediawiki at m:User:BR/S5 slide for mediawiki documentation/en. Unfortunately it does not work with pchart4mw and the pchart "source code" appears in the slides instead of the generated graphics. In contrast, it works as it should for the graphviz extension, which does show graphs. This is confusing as both graphviz and pchart4mw appear to do the same thing, i.e. taking text descriptions and generates images. I tried to see if there was some callback function that p4chart4mw is missing, but I didn't see anything. Does anybody else have any idea of what might be missing? --Dov Grobgeld 07:33, 12 July 2011 (UTC)


 * I found the reason for this bug today. It turns out that the hook associated with ParserFirstCallInit should use the parser object passed in as a variable instead of using $wgParser. The slidy extension uses a private instance of a fileparser object and not the $wgParser. Therefore the registering of the slidy object in $wgParser doesn't work. By using the $parser object which in any case is passed on to the ParserFirstCallInit hook you solve this problem. Dov Grobgeld 12:07, 15 July 2011 (UTC)


 * I have patched pChart to solve the problem above. My patched version is available at
 * https://github.com/dov/pchart
 * Please incorporate these changes, or alternatively give me svn access, and I will commit them myself. Dov Grobgeld 19:24, 17 July 2011 (UTC)


 * - Thank you for following up on this. The suggested code changes have been adopted and are now part of the pChart4mw code repository. After review it will be made available in the next release. Gérard 10:19, 18 July 2011 (UTC)
 * - This fix is made available in public release version 1.3.3. Make sure your cloned copy of pChart4mw is not causing confusion with the original. Gérard 8:22, 21 July 2011 (UTC)
 * Thanks! I deleted my repo to avoid any potential confusion. Dov Grobgeld 18:48, 31 July 2011 (UTC)

Installation request on English Wikipedia
FYI, an installation request for en.wikipedia was filled under enhancement #29806.--Kozuch 17:58, 12 July 2011 (UTC)
 * Please respond to the critiques offered there; you may also wish to consult our guide to getting your extension deployed on Wikimedia Foundation sites. Thanks! Sumana Harihareswara, Wikimedia Foundation Volunteer Development Coordinator (talk) 01:39, 25 April 2012 (UTC)

pChart 2.x
pChart 2.x is born, you can start moving your script to this new version. The new website is at www.pchart.net.
 * We are aware of this new version of the pChart library. It is a major release and moving pChart4mw to use this new library is a major task. We have no plans yet to update pChart4mw to pChart 2.x, pChart4mw will remain using the old version 1.27 of the pChart library for some time. Gérard 08:00, 15 July 2011 (UTC)
 * Gérard, I would like to use features of pChart 2, and am willing to help with the port if that would be useful. --Bytesmiths 19:59, 14 February 2012 (UTC)

Max execution time - pChart.class on line 467
I sometimes get errors where editing a page with pChart4MW on it, where the page hangs.

If you look at the apache logs, it says. [error] [client x.x.x.x] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /usr/src/mediawiki-1.17.0/extensions/pchart4mw/pChart/pChart.class on line 467, referer: https://your.host/index.php/Main_Page

This is an old issue with 1.x pChart, and related to scaling. The scaling is done in a loop which can sometimed never exit.

See http://sourceforge.net/projects/pchart/forums/forum/822590/topic/3112244

A few solutions are also listed here, though all are really hacks.


 * It seems that this is - as you already mentioned - an old issue in pChart 1.x. Is doesn't seem to occur very often and only in very specific cases. If you provide testdata to reproduce this issue we'll have a look at it. Then, if the solution is obvious we'll patch the original pChart 1.x code. Gérard 19:10, 25 August 2011 (UTC)

How to check the PHP settings of your server
pChart4mw requires PHP with GD Library and freetype extension enabled. To check if your PHP installation matches these requirements do the following: <?php // Show all information, defaults to INFO_ALL phpinfo; ?>
 * Create a text file named phpinfo.php</tt> with content:
 * Save the text file on your webserver http:\\...\phpinfo.php</tt>, ...</tt> being the URL to your webserver
 * Then, with your browser, browse to the page: http:\\...\phpinfo.php</tt>

You will see a lot of PHP info as output. Search for "freetype". Under the header gd you'll see if GD and freetype are enabled. Gérard 09:36, 2 September 2011 (UTC)

No text!
When I past the examples in, I get lovely graphics, but no text!

I am on a case-sensitive file system, and I renamed fonts/ to Fonts/, to no avail.

Any clue why there would be no text showing up?

--Bytesmiths 06:23, 29 January 2012 (UTC)


 * I think is is best to check your installation's PHP, GD and Freetype settings first (for how-to see above point). Also you do not need the #tag syntax, pChart4mw supports tags. Gérard 06:00, 1 February 2012 (UTC)


 * I fixed it by changing all instances of "tahoma" in the pChart4mw code to "Tahoma." Now I get text with charts. I'm willing to test future releases on a case-sensitive file system before you release them. --Bytesmiths 19:57, 14 February 2012 (UTC)

percentage decimals
Can you please tell me how to display and select the number of decimal places in the pie percentages?
 * Sorry, pChart library (and therefore pChart4mw) doesn't support decimals. Gérard 06:00, 15 February 2012 (UTC)

Mediawiki 1.18?

 * 1) Does this extension work with 1.18? I'm getting an error message after install.
 * 2) I'm not sure if my PHP 5.2.17 has the Freetype and GD thingy's. Here's the "Configure Command" output - './configure' '--enable-fastcgi' '--prefix=/usr/local/php5' '--with-config-file-path=/web/conf' '--disable-posix' '--enable-bcmath' '--enable-calendar' '--with-curl=/usr/bin/curl' '--with-gdbm' '--enable-exif' '--enable-ftp' '--with-gd' '--with-freetype-dir=/usr' '--with-jpeg-dir=/usr' '--with-png-dir=/usr/bin/libpng-config' '--enable-gd-native-ttf' '--with-gettext' '--with-mcrypt=/usr/bin/libmcrypt-config' '--with-mhash' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl' '--with-pdo-mysql=/usr' '--with-pspell' '--enable-soap' '--enable-wddx' '--with-xsl' '--with-zlib' '--enable-mbstring' '--enable-zip'

I see "freetype" and "gd" in there but not sure if it means I have what you are talking about?

If it's yes to both above then I'll have to figure out why I get error message.

MW 1.18, PHP 5.2.17, MYSQL 5.0.92, SMW 1.7.1, Semantic Bundle 20120308 DaveL (talk) 23:14, 12 April 2012 (UTC)
 * I Haven't actually tested pChart4mw with MediaWiki 1.18 yet but from its release notes I see no reason why it shouldn't work. If you did the phpinfo.php test described above you should see a long page with tables with PHP info, one of them is called "gd". In that table you should see labels GD Support and Freetype Support both on 'enabled'. Gérard (talk) 05:15, 13 April 2012 (UTC)
 * Thanks Gerard, I have GD & Freetype and figured out why I got the error message. FYI, after extracting the install it created the extension directory as "pchart4mw" but the require once call asked for "pChart4mw" (capitol "C") ??? Anyway, thank you for the quick response. It is so very much appreciated to get support on an extension! And I'm excited to use this one. You made a fan here. DaveL (talk) 12:48, 13 April 2012 (UTC)

Threshold paramenter
Hi all. First of all, thank you for this awesome extension. It really helps me!

I've just written simple patch for pChart4mw. It allows to draw threshold line (with specified color) (see details here drawTreshold method) on the chart. BTW, I submitted new Issue on project site and attached sources there. It would be great, if you commit my patch.

Here is simple example of my patch usage:

<pbars size=500x350 title="Site Visitors" ymin=0 ymax=10000 legend threshold=6000 thcolor=#8AB800> , Europe,United States,Asia Dec,342,36,190 ASDc,502,3,133

And you'll got something like this.

Again, thanks from Russia! --Vladimir
 * Thank you Vladimir for this nice initiative and the documentation. It is added to pChart4mw. Gérard (talk) 04:18, 8 May 2012 (UTC)
 * This feature is now part of pChart4mw 1.4+. Gérard (talk) 12 May 2012 (UTC)

Inline Linking
Hi. I love this extension already and I've been very impressed by the clean and concise documentation that accompanies it. One thing I haven't been able to do so far is to add inline wiki links to the chart labels. I don't suppose this is possible?

It would also be very impressive if the chart areas could also be clickable, perhaps through integrating some form of image map system to each chart.--Mqbpjdj2 (talk) 11:39, 16 May 2012 (UTC)