Tags:
graphing1Add my vote for this tag create new tag
, view all tags

ChartPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on ChartPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Development discussion for ChartPlugin

This is the first version of the plugin. The plugin was needed at work for a web based application and is realized by TaitCyrus.

Planned enhancements:

  • Possible to specify a cell range bigger then the actual table, e.g. "R2:C2..R5:C999". In this case the chart will show data of the actual table size.
  • Smart calculation to have a "nice grid" for the y-axis. Currently we have a fixed grid of 10 marks. ymin and ymax should be expanded and the number of marks should change automagically to get a "nice grid" like 4, 6, 8, 10, 12.... instead of 3.75, 7, 9.25, 11.5...
  • Prevent legend text from overlapping each other by bubbling text up / down.
  • Make plugin more robust.
Feedback appreciated.

-- PeterThoeny - 21 Jun 2002

Very cool plugin!!

From what I understand this plugin was built on GD.pm, was there any reason/rationale for not using GDGraph?? Or are there plans to expand this module in that direction??

-- JohnCavanaugh - 22 Jun 2002

We first intended to base this plugin on GDGraph but backed out because it was not that flexible. For example, the start point and end point of the x-axis is always empty (aka data points start with the second marker and end with the second last); there is no support for dotted grids etc. We have no plans to use GDGraph, however more features in GDGraph can be implemented over time in the plugin.

-- PeterThoeny - 22 Jun 2002

This was a pleasant surprise smile After installing the GD module (for which you need to get the old version if you want GIF's), installation was a piece of cake on our Solaris box.

Some real-world examples would help in understanding how this could best be used. By examples, I don't mean the actual charts (your examples are great), but how the data (tables) might be populated. Is the intent to be able to hand code a table and see the resulting data in the form of a plot? Or are you using a process to generate the table?

-- MartyBacke - 24 Jun 2002

Monthly topic updates At work we built a Balanced Scorecard application where we have many topics that show measure data of initiatives graphically. New measure topics are based on a template, they contain a table with target and actual values of measures over time. The tables are maintained manually by the owners of the initiatives.

I also maintain a TWiki deployment statistics table, updated monthly. I used to do that in Excel, grab a screen capure of the chart, save it as a GIF and attach it to the statistics table in TWiki. Now I only need to add a row to the table in TWiki and get an updated chart. At the right is a sample chart with monthly topic update statistics.

You could also generate a chart from a table that is populated automatically, for example based on the DatabasePlugin.

-- PeterThoeny - 24 Jun 2002

Updated plugin:

  • Data range specified is clipped to actual table size
  • More forgiving data parsing by extracting first numeral from a table cell, e.g. extract 25 from <u>25%</u>
-- PeterThoeny - 27 Jun 2002

The dependencies are kind of heavy. Check the readme of the GD Perl library. You need to have the gd ANSI C library installed and tested before you install the GD Perl library. http://www.boutell.com/gd has all the docs on the gd ANSI C library (it in turn depends on yet some other libs).

-- PeterThoeny - 02 Jul 2002

Thanks for the clarification. It might be worth giving a more detailed step-by-step installation instruction regarding these dependencies in the ChartPlugin topic?

I managed to get this all to work with TWiki on Windows by the following steps:

  1. Relied on libpng, zlib, and libjpeg from cygwin.
  2. According to http://www.boutell.com/gd the stable version is 1.8.4, which in turn means that GD 1.33 from Stein must be used (not the version available from CPAN).
  3. Patched gd 1.8.4 with the patches from GD 1.33 ( patch_gd.pl) to allow dynamic linking. Many of the patches did not work and I needed to apply them by hand. The Makefile also had to be adjusted regarding CFLGAGS, INCLUDEDIRS, LIBDIRS, and TEST_PROGRAMS. I did not include support for freetype and X11.
  4. Built and installed libgd
  5. The Makefile for GD did not build either; had to finish this by hand. In addition, had to add -lgd into EXTRALIBS and LDLOADLIBS.
  6. Built and installed GD.pm
  7. Installed ChartPlugin (and GaugePlugin)
-- ThomasWeigert - 15 Jul 2002, 17 Aug 2002

Cool plugin! I too am trying to use this to display the usage stats graphically but how do I get it to display in the right order (ie current month on right)? Since TWiki puts the current month first in the WebStatistics table. I tried reversing the cell ranges in the plugin call but that gives an error "Error number of datapoints needs to be > 1".

-- MartinFuzzey - 09 Aug 2002

Bar charts would be great.... sorry for being greedy.... This plugin is phantastic!

-- ThomasWeigert - 17 Aug 2002

Here's another vote for being able to chart WebStatistics. See attachment.

FWIW, I'm using GD.pm 2.041 and [lib]gd 2.0.9. The tests for GD.pm (i.e., make test) fail, but I suspect this is due to bug fixes in the latest version of gd.

-- AnthonPang - 05 Jan 2003

I really love the ChartPlugin but would like to see the following enhancements:

  • Handling of Date/Time data types (ie 45:20 for 45 mins, 20 secs etc)
  • 2 diff. y-axis units (and ranges of values) for diff. datasets to overlay (eg time 00:00 - 2h and speed 0 km/h - 50 km.h) in the same chart
  • The ability to refer to the last row, whatever it is, so that one does not have to adjust ranges all the time on growing tables (SpreadSheetPlugin' s $ROW(-1) only refers to the current row, so cannot be used in %CHART% as that is outside the table, $MAXROW(-n) or something and $MAXCOL(-n) woudl be nice to skip footers)
  • Ability to specify disjunct ranges in lists. Currently only one range seems to be allowed, so that charting columns (or rows) which are not next to each other in one chart is impossible w/o also including the in-between columns/rows. The current syntax also is specific as to whether the specified range is to be evaluated row-by-row or column-by-column. The following examples show what should be doable:
    • legend="R1:C4,R1:C6,R1:C2" if only those columns are to be charter in that sequence.
    • data="R2:C4..R6:C4,R2:C6..R6:C6,R2:C2..R6:C2"
  • bar data type
  • stacking area and bar types
-- MathiasKoerber - 10 Jan 2003

A minor bug: if you refer to a table located in another topic, and that table happens to be at the end of the topic, the plugin complains that the table doesn't exist. (See quickfix: moreTableDiffs.txt)

-- AnthonPang - 21 Jan 2003

In order to have SpreadSheetPlugin pre-render table cells, so the ChartPlugin can plug %CALC{}% values into a chart -- set a veriable in TWikiPreferences:

set INSTALLEDPLUGINS = DefaultPlugin SpreadSheetPlugin ChartPlugin

FWIW, I've got it up on a FreeBSD 4.5-ish system without issues (used p5-GD from ports; CPAN wouldn't build clean)

-- AustinDavid - 20 Mar 2003

How about merging it with http://www.presicient.com/dbdchart/ - that can do some really cool things - like Gannt charts (I'm thinking ActionTrackerPlugin).

-- MartinCleaver - 13 Jun 2003

I just uploaded V1.1 of the ChartPlugin. The main update is ability to specify reversed tables so you can now specify rows/columns from N to N-1. There are also three new optins that have been added. The added optinos are:

Option Description
xaxisangle Allows you to specify the angle of the X-axis labels. Previously the angle was 0 degrees which is OK for most charts, but if there is a LOT of data, the X-Axis labels can get drawn on top of each other such that they are not readable. Currently the only supported values are 0 and 90 (eventually I would like to support any user defined angle, but that is not a high priority for me right now)
numxgrids This option was needed in conjuntion with the xaxisangle option. If there is a LOT of data, then even if the X-axis angle is set to 90 degrees it is possible that the X-axis labels get drawn on top of each other. This option allows you to eliminate this over-drawing by specifying the number of X-axis grids (and X-axis labels) drawn
defaultdata I added this option since I have table data (generated from a database) that is sparse. Many values don't exist. Previously the code defaulted these missing values to zero. This unnecessarily cluttered up charts as lines would drop down to zero and then go back up to their normal values. This option allows a user to specify the default value. In most cases people will just let the default of zero be used, but they can also specify non-zero values. Also, a special case of none can be specified as a value. In this case, there is no default value use. This results in only REAL data being drawn on the chart. If there is sparse data, then points are drawn if there isn't enough data to draw a line.

Now a few comments on comments from other users above:

  • This plugin allows you to specify rows or column values like R9999 even if there are not that many rows. If you specify more rows/columns than exist in the table, this plugin will assume that you want to use ALL of the data from your starting point to the end of the table. I will look at incorporating the changes listed on this page to a future version
  • It is a known 'bug' that if a table ends a page that this plugin won't find it. You need to at a minimum have an empty line at the end of your table before this plugin will see it.
  • If time permits, I'll look at adding some of the other functionality mentioned above, but it probably won't get added unless I need it to accomplish my job.
-- TaitCyrus - 17 Jun 2003

FYI The examples syntax and graphs on the ChartPlugin topic appear to be messed up. No sample syntax is displayed - at least for me!

-- TylerMitchell - 17 Jun 2003

Fixed. I had cut-n-pasted from another window using the ?raw=on option and I assumed that raw mode was really raw, but obviously, raw mode doesn't exactly show the raw content and that is why there was a problem. In this case, the command %<nop>CHART.... had the <nop> removed making the % CHART command live and not just displayed.

-- TaitCyrus - 18 Jun 2003

Has anyone ever looked at implementing logarithmic axis support in ChartPlugin? I've got some data sets that will require a logarithmic vertical axis. I had thought that ChartPlugin used some high level functionality that the GD library provided for charting but after looking at the Chart.pm file it is clear that the plugin really does "draw" the chart using the GD primitives.

-- BradDixon - 03 Jul 2003

Great plugin! For what its worth, I'd also like to see logarithmic axis support!

-- AlbertBeuscher - 23 Jul 2003

TaitCyrus prodded me to actually distribute the logarithmic vertical axis plot patch I made. See attachement. It works on the data sets that I tested it with. smile

-- BradDixon - 13 Oct 2003

Brad, I hope you don't mind, but I just uploaded a new version of the ChartPlugin adding semilogirithmic graphing support. I didn't realize you had your own changes when I started working on my changes and I was all but done except for testing when you posted your changes.

The update adds two new options. The first is scale, which accepts values of base10, which is the default, or semilog to produce a semilogirithmic (Y-Axis) graph. The second is ytics which defines how many tic marks to draw between Y grid lines. The default value is 0 except in the case where scale is semilog in which case the default value is 8.

Does anyone want a full loglog graph or is semilog OK?

-- TaitCyrus - 16 Oct 2003

This is a really nice piece of code. Its very clear.

It'd be nice if this worked for Pie charts. I think http://www.cpan.org/authors/id/S/SM/SMORTON/Chart-Plot-0.11.readme would be the way to go.

-- MartinCleaver - 01 Mar 2004

> The DatabasePlugin zip file as well as my other plugins zip files should
> be the latest code so please feel free to check it into CVS.
> ++Tait

DatabasePlugin and ChartPlugin cvs have been updated to match the zip versions; Thanks Tait!

-- MattWilkie - 01 Apr 2004

New version 1.300 posted on ChartPlugin topic. Enhancements and fixes:

  • Added support for type="scatter"; renamed type="arealine" to "combo" (arealine is undocumented)
  • Renamed datatype to subtype (datatype is undocumented)
  • Added subtype options "point" and "pline"
  • Added new settings GRIDCOLOR, POINTSIZE
  • Fixed bug with how the number of grids were drawn
Spec my me (to needs of Wind River), implementation by Tait Cyrus. Thanks Tait smile

-- PeterThoeny - 15 May 2004

New Plugin version 1.400 (30 Aug 2004) posted with these enhancements:

  • New "bar" chart type (includes various global bar settings)
  • Updated gridcolor to not only define the grid color but allowing the user to define the line style (for drawing user defined dotted lines)
  • New LINEWIDTH setting and linewidth parameter to set the line width
  • New pointsize parameter to set the size of a data point
  • Changed drawing order: areas, grid lines and X/Y axis labels, bars, lines/points/plines, rectangle around chart, data point labels, chart title/X/Y labels, and finally the legends
Implemented by Tait Cyrus to spec of Wind River, with some minor fixes and enhancements by me.

-- PeterThoeny - 31 Aug 2004

We've just begun using this plugin at our site - and we're very impressed with it. But we encountered some little quirks, we would like to be enlightened on:

We are a bit puzzled why we can't use just a single row for bar graphs, i.e.:

| m1 | m2 | m3 | m4 |
| 2  | 3  | 4  | 9  |

%CHART{data="R2:C1..R2:C4" name="bar_1" table="1" type="bar"}% 

which gives us "ChartPlugin error: chart error: name=bar_1: Error: Number of data points needs to be > 1".

  • That is actually spec. You need to specify the xaxis parameter to make it work. It could be done more forgiving to automatically assume horizontal orientation if xaxis is missing and data set is only one row high. -- PTh
Rotating the table a bit helps:

| m1 | 2 |
| m2 | 3 |
| m3 | 4 |
| m4 | 9 |

%CHART{data="R1:C2..R4:C2" name="bar_2" table="2" type="bar"}% 

This is apparently better, the chart is drawn as expected.

Second, we encountered a problem catching some live data with the DatabasePlugin - if all cells carry the same value, ChartPlugin can stall with an error, i.e.:

| m1 | 5 |
| m2 | 5 |
| m3 | 5 |
| m4 | 5 |

%CHART{data="R1:C2..R4:C2" name="bar_3" table="3" type="bar"}% 

which gives us: "ChartPlugin error: chart error: name=bar_1: Chart height = 0 (ymin(5) == ymax(5))".

Of course, setting values for the y-axis will avoid this, but for the occasional user popping by just when the values are all equal, getting this error looks a bit strange.

- All in all, just minor quirks .. looking forward to the ability to generate piecharts soon! wink

-- SteffenPoulsen - 16 Sep 2004

Thanks for reporting. These are bugs that should be fixed. Piecharts? Sounds good to me. Waiting for a quality patch wink

-- PeterThoeny - 17 Sep 2004

Posted new version with PluginBenchmarks numbers. (no code change)

-- PeterThoeny - 16 Nov 2004

I got a problem with CHART in combination with SEARCH. Whenever I use a search (i.e. at the top of a page) and a chart (i.e. at the bottom), the chart plugin fails. The following error message is given.

Can't locate object method "setScale" via package "TWiki::Plugins::ChartPlugin::Chart" at ../lib/TWiki/Plugins/ChartPlugin.pm line 337.

I build a testcase and tested it on twiki.org. It works there. frown Other invocations of the chart plugin work fine on my installation, only those in combination with SEARCH fail.

CDot found out: "You probably just need a "use TWiki::Plugins::ChartPlugin::Chart" at the top of ChartPlugin.pm". That helped. smile

  • That is not good performance wise since that module will be loaded for every page, also if there is no chart. You need to set an absolute library path in twiki/bin/setlib.cfg -- PTh
-- OliverKrueger - 23 Nov 2004

Wouldn't it be great if the xaxis and yaxis would resolve TWiki-ML so that one could, for example, use links as kind of abbreviations for long descriptions (01, where 01 means 'long description'), etc.

-- FranzJosefSilli - 22 Dec 2004

Has anyone gotten this to work on windows platforms? See ChartPluginHangsRlog for my experiences.

-- SteveAnthony - 29 Mar 2005

Bug: If vertically-aligned x-axis labels are used, they don't get allocated enough Y space. The iteration over the array of labels is incorrect; it is iterating over the array of label indices, instead of the actual labels.

-- CrawfordCurrie - 16 Jun 2005

Thanks Crawford for the fix. Here is the patch Crawford is referring to:

--- Chart.pm.20040830   2004-08-30 21:48:59.000000000 -0700
+++ Chart.pm    2005-06-09 01:08:21.000000000 -0700
@@ -860,7 +860,7 @@
                    $xaxis += $labelInc;
                }
            } else {
-               for my $x (values %xAxisIndex) {
+               for my $x (@xAxis) {
                    $len = length($x);
                    $maxLen = $len if ($len > $maxLen);
                }

-- PeterThoeny - 16 Jun 2005

I have installed ChartPlugin into my Fedora Core3 with Sep 04 Production release version, and i have found error message as below after run the test scripts. Kindly help and advice, thanks.

"ChartPlugin error: chart error: name=combo_12: Error: Can't mix 'area' and 'bar' subtypes on the same chart"

-- DonChai - 16 Aug 2005

Please ignore my previous message as i found the above error message is alright and suppose to be display as it is. Cheers and thanks for the hardwork.

-- DonChai - 16 Aug 2005

Is it possible to make the lines smoother using the anti-aliasing functionality from GD? For some reasons the following code does not work:

$im->setAntiAliased($color);
$im ->line( $x1, $y1, $x2, $y2, GD::gdAntiAliased );

(on line 1279 in Chart.pm). The GD documentation seems to indicate that this is how it is supposed to be. Any ideas?

-- ChristopherOezbek - 17 Aug 2005

There is discussion on SupportSparklines about how ChartPlugin could be adapted to display Sparklines.

  • The GaugePlugin is better suited for this type of application -- PTh
-- SamHasler - 30 Nov 2005

When plotting a chart using data from a different topic, the table will not be found (and an error message displayed by the plugin) if there is no text after the table. The workaround is simply to add some junk text after the table.

-- PeterWeatherdon - 13 Jan 2006

This could be a bug inherited from the table parser of EditTablePlugin.

-- PeterThoeny - 13 Jan 2006

Refreshed the zip with a fresh build from SVN. No code has changed. Only some copyright messages. No need to update if you already have it installed.

-- KennethLavrsen - 11 Mar 2007

Wondering if there has been any progress in developing Pie Charts to use on the TWIKI. We have some data that is better suited to be displayed in a pie chart instead of a bar or line chart.

Thanks.

-- ChristopherKelly - 10 Apr 2007

The PloticusPlugin adds some some support for pie charts.

-- SteffenPoulsen - 10 Apr 2007

can anyone help with ChartPluginSemilogProblem ??

-- SvenDowideit - 30 Apr 2007

Hi, I'd like to show national characters (in utf-8) in the graph labels. As I understood the code, calling of the $im->string() methods would have to be replaced by calling the $im->stringFT() methods and using some true type font. Is it true? Thanks, Petr

-- PetrKlika - 15 May 2007

I do not know. Worth a try.

-- PeterThoeny - 16 May 2007

Feature request: I would like to plot decades of time along the x-axis for some of the charts I need to do.

It would be nice to have the capability to specify which axis is going to be the log axis of a semilog chart.

-- GerryThompson - 10 Jul 2007

Above feature request is moved over from the Codev web.

-- PeterThoeny - 20 Jul 2007

Small bug in the xaxis labels when angled this diff will let it print the full text label

--- old 2007-09-04 15:34:33.000000000 -0400
+++ Chart.pm    2007-09-04 15:30:43.000000000 -0400
@@ -863,7 +863,8 @@
                    $xaxis += $labelInc;
                }
            } else {
-               for my $x (values %xAxisIndex) {
+               #for my $x (values %xAxisIndex) {
+               for my $x (@xAxis) {
                    $len = length($x);
                    $maxLen = $len if ($len > $maxLen);
                }

-- MosheHyzon - 04 Sep 2007

I was wondering if anyone can help with this problem - TWiki 4.1.2, Sat, 03 Mar 2007, build 13046 using the ChartPlugin and the EditRowPlugin. Within the one topic, if I have a table with an EDITTABLE tag and then on the same line the TABLE tag with a name in it, then a Chart works fine...finds the table and graphs. However, if I then refer to this table in another topic (using the web= and topic= settings for the Chart), then it can't find the table --

parameter *table* is not valid table; the specified table '$tableName' does not exist.

.

The only workaround I've got for this is to remove the EDITTABLE completely. (I've tried disabling the EditRowPlugin for both topics and no joy there either.)

Does anyone have any ideas why the table name would not be coming up when the Chart plugin refers to the separate topic?

-- SallyHoughton - 03 Oct 2007

%TABLE{name="blah"}%
I'm going to ask this question in the EditRowPluginDev area as when I disable the plugin entirely from my twiki and move the tag to the beginning of the line ie.

instead of

%TABLE{name="blah"}

, then it works okay.

-- SallyHoughton - 03 Oct 2007

I got this feedback via email:

Found a bug in the Chart Plugin.

If a column has identical data in all rows, Twiki throws an error: ChartPlugin error: chart error: name=GDXVSZ: Chart height = 0 (ymin(113.609) == ymax(113.609))

A work around we found was to add a row of all 0.000 to get around this error. While I understand charting this will be a straight line, it should still handle the condition without throwing an error.

Current state which throws errors:

%TABLE{name="GDXModServerTable"}%
|Time_(sec)|Mem_RSS(MB)|Mem_VSZ(MB)|%_Memory|%_CPU|Num_Threads|Process_ID|
|0|2.191|113.609|0.2|0.0|13|24943|
|0|2.191|113.609|0.2|0.0|13|24943|
|60|2.191|113.609|0.2|0.0|13|24943|

Workaround:

%TABLE{name="GDXModServerTable"}%
|Time_(sec)|Mem_RSS(MB)|Mem_VSZ(MB)|%_Memory|%_CPU|Num_Threads|Process_ID|
|0|0.000|0.000|0.000|0.000|0.000|0.000|
|0|0.000|113.609|0.2|0.0|13|24943|
|60|2.191|113.609|0.2|0.0|13|24943|

Thanks for your time,

Sean Saxon

-- PeterThoeny - 11 Mar 2008

I moved IvanSassi question to ChartPluginWithInsecureDependencies.

-- PeterThoeny - 20 Mar 2008

Hi, there is a bug on Tables.pm, if a table is a the bottom of a topic, the code never detect when this table ends and drop the table. Try it, put some table at the bottom of a topic, and create a chart.

Whit this patch the bug can be solved:

--- Table.pm.orig       2008-04-03 10:29:00.270624068 -0500
+++ Table.pm    2008-04-03 10:28:53.798625612 -0500
@@ -148,6 +148,7 @@

     $topic =~ s/\r//go;
     $topic =~ s/\\\n//go;  # Join lines ending in "\"
+    $topic = "$topic\n "; # Add a last newline with a space, to detect the end of a table at the bottom of a topic.
     foreach( split( /\n/, $topic ) ) {

         # change state:

This just add a last \n and a space, whit this the code can detect a last line without the pattern |.*| and save the data of the table.

-- MariaDelCarmenHuertas - 03 Apr 2008

I got below feedback from Pawel Jewstafjew via e-mail:

There is a minor bug in Chart plugin for TWiki.

If X Axis labels are strings (not strict numbers) and they are displayed vertically

(xaxisangle != 0)
they are cut and only the last part of the label is displayed.

I've looked through the code, and in Chart.pm I found that when the maximum string length is calculated (around line 866 in Chart.pm) xAxisIndex is used

the problem with that is that xAxisIndex for non-numerical labels is set to a sequence number not the value (string) of the label itself

the fix is to replace lines:

               for my $x (values %xAxisIndex) {
                   $len = length($x);
                    $maxLen = $len if ($len > $maxLen);
                }
            }
with:
                foreach my $index (0..$#xAxis) {
                    $len = length($xAxis[$index]);
                    $maxLen = $len if ($len > $maxLen);
                }
            }
the latter is using the original strings, and produces graphs with full labels

Thanks pawel!

-- PeterThoeny - 10 Apr 2008

What would be needed in order for this plugin to support pie charts?

PloticusPlugin does it but it is not under active development and looks like it needs quite the code cleanup before I'd consider using it...

-- WoutMertens - 04 Jun 2008

An independent consultant can help you out, I'll contact you separately.

-- PeterThoeny - 04 Jun 2008

I've discovered a problem in the semilog scaling. The yaxis labels do not match the data correctly. The following example demonstrates the problem

Labels Values
1 2 3
line1 14 75 300
line2 25 89 530

At least on my server with the July 4th, 2008 version of the plugin, the graph shows the data covering 8 orders of magnitude instead of the correct 2.

The problem is that in Chart.pm in the makeChart method there is a call to computeYMinMaxLog which resets this->{NUM_Y_GRIDS} but the local variable $numYGrids never gets reset. The fix is to set $numYGrids immediately after calling computeYMinMaxLog. Here is the context diff between my version of Chart.pm and the standard

*** Chart.pm.OLD   2008-07-21 15:54:29.642576000 -0400
--- Chart.pm   2008-07-21 16:42:59.069423000 -0400
***************
*** 661,666 ****
--- 661,667 ----
      if (! defined($yAxisMin) && ! defined($yAxisMax)) {
     if ($scale eq "semilog") {
         $this->computeYMinMaxLog();
+        $numYGrids = $this->getNumYGrids();
     } else {
         my ($newYmin, $newYmax, $newNumYGrids, $newNumYDecimalDigits) = $this->computeLinearMinMax($this->getYminOfData(), $this->getYmaxOfData(), $numYGrids);
         $this->setYminOfData($newYmin);
***************
*** 1665,1674 ****
      my $ymax = $this->getYmaxOfData();
      my $yMinLog10 = log10($ymin);
      my $yMaxLog10 = log10($ymax);
!     my $newYmin = pow(10.0,floor($yMinLog10));
!     my $newYmax = pow(10.0,ceil($yMaxLog10));
  
!     my $numYGrids = log10($newYmax) - log10($newYmin);
  
      $this->setYminOfData($newYmin);
      $this->setYmaxOfData($newYmax);
--- 1666,1678 ----
      my $ymax = $this->getYmaxOfData();
      my $yMinLog10 = log10($ymin);
      my $yMaxLog10 = log10($ymax);
!     my $newYMinLog10 = floor($yMinLog10);
!     my $newYMaxLog10 = ceil($yMaxLog10);
!     my $newYmin = pow(10.0,$newYMinLog10);
!     my $newYmax = pow(10.0,$newYMaxLog10);
  
! #    my $numYGrids = log10($newYmax) - log10($newYmin);
!     my $numYGrids = $newYMaxLog10 - $newYMinLog10;
  
      $this->setYminOfData($newYmin);
      $this->setYmaxOfData($newYmax);

The second part of the diff is a change to make sure there are no rounding problems arising from taking log10(pow(10.0,$x).

Final comment, this does not fix the ChartPluginSemilogProblem.

-- MalcolmDavis - 21 Jul 2008

Is it possible to combine DATABASE_SQL with CHART? I want to generate charts that are based on data in the database.

If not currently possible how can I hack/whack/crack it?

-- KevinYeung - 05 Sep 2008

Kevin,

just create a table and use ChartPlugin to create a chart from the table data

-- MatthiasThullner - 11 Sep 2008

with bar style there is no reason for changing the order of the legend entries. This is useful for line to place the name next to the line, but this does not work with bar.

The order in the legend seems to be random for bar-style. Is there any way to fix this? I require a defined order for comprehensiveness.

-- MatthiasThullner - 11 Sep 2008

In continuous effort to push Web2.0 sexiness, it'd be good to have replace the backend of this Web1.0 ChartPlugin to XML/SWF Charts. wink

-- KwangErnLiew - 13 Sep 2008

Matthias, how to create a table and use the ChartPlugin, bearing in mind that the data is in an RDBMS. I can use &DATABASE_SQL% to pull the data out, but ChartPlugin doesn't seem to integrate with the table generated. If using the pipe format (eg, | Name | Age |), the data is not from the RDBMS. I'm loss, please help. Thanks.

-- KevinYeung - 15 Sep 2008

I have a plugin that generates table data using %{TABLE }% but I'm having trouble getting the Chart plugin to see the generated data. Anyone got a working example?

-- MatthewDoar - 03 Oct 2008

I found the problem - I had to configure TWiki to explicitly run the data generating plugin before the chart plugin is run. Might be worth noting this somewhere?

-- MatthewDoar - 03 Oct 2008

I agree, that the charts could be more interactive. But how much effort would be needed to do that? Can anybody oversee this?

-- MartinSeibert - 06 Oct 2008

We have a couple of customers, that we run Dashboards with this plugin with. We might want to enhance that in the near future. Peter: What about the "ask first" policy? What do you want to be asked for? Only if we have new code?

-- MartinSeibert - 06 Oct 2008

Martin, please feel free to enhance the plugin as long as it:

  • stays compatible (that includes older TWiki releases)
  • does not add a laundry list of dependencies
  • performs adequately
-- PeterThoeny - 07 Oct 2008

On interactivity, charts can be driven by URL parameters, e.g. no need to enhance the plugin. For inspiration study the WebSearch form.

-- PeterThoeny - 07 Oct 2008

I got this feedback by e-mail from Swapnajit:

I think I have found a problem with the Twiki Chart plugin. I am using it do draw a bar chart, but probably it does not matter. The plugin works great if I use a simple table:

|Pivot|Col1|Col2|Col3|
|Row1|1|2|3|
|Row2|2|3|1|
|Row3|3|1|2|

However, it does not work if I have links embedded into the number. For example:

|Pivot|Col1|Col2|Col3|
|Row1|[[http://somecompany.com][1]]|[[http://somecompany.com][2]]|[[http://somecompany.com][3]]|
|Row2|2|3|1|
|Row3|3|1|2|

Can you please take a look?

-- PeterThoeny - 07 Jan 2009

Here’s an easy win which I think will add major functionality to CHART plug-in for minimal effort.

Consider adding new chart parameter "usemap".

The usage would be "usemap=#map1" (or conceivably OtherTopic#map1) and would work exactly as you would expect.

That is, it would expect to find a <map> tag with the given name, containing <area> tags which could be used to define hot spots in the generated chart image according to normal HTML standards.

I plan to use this with line graphs to place hot spots over my data points.

Ought to work fine cross-browser if the line/height params are respected in the generated image, but I wouldn't stress too much about it if there were some cross-browser weirdness in placement of the areas--would be nice just to have it at all, and eager users will tweak it to work for their set-up.

Plus, this ought to be an easy win--you just pass through the "usemap" from the CHART param right into your generated IMG tag, and you don't have to do anything else, and it just works.

  %CHART{title="my chart" topic="ThatTopic" type="line" subtype="pline" name="chart" table="1" usemap="ThatTopic#map1" data="R2:C4..R999:C5" ...}%

becomes:

 <img src="https://wiki.mydotcom.com/pub/Main/SomeTopic/_ChartPlugin_line_chart.png?t=1234567890" usemap="ThatTopic#map1"  alt="..."  />

User provides <map> and <area> tags., all the rest just happens through HTML, you don’t have to do a thing.

-- PeterCzukor - 11 Mar 2009

Cool idea!

-- PeterThoeny - 11 Mar 2009

Has anybody been able to use this plugin successfully on Windows (Vista)? I am getting the following error while trying to load the ChartPlugin page on my personal twiki. I have the latest version of ChartPlugin, and GD 2.43. I use ActivePerl and Apache.

| 2009-06-27 - 16:24 | Insecure dependency in eval while running with -T switch at C:/Perl/lib/GD.pm line 95. at C:/Perl/lib/GD.pm line 95 GD::AUTOLOAD() called at C:/www/twiki/lib/TWiki/Plugins/ChartPlugin/Chart.pm line 1040 TWiki::Plugins::ChartPlugin::Chart::makeChart('TWiki::Plugins::ChartPlugin::Chart=HASH(0x349fafc)') called at C:/www/twiki/lib/TWiki/Plugins/ChartPlugin.pm line 531 TWiki::Plugins::ChartPlugin::_makeChart('TWiki::Plugins::ChartPlugin=HASH(0x349fa2c)', undef, 'ChartPlugin', 'TWiki') called at C:/www/twiki/lib/TWiki/Plugins/ChartPlugin.pm line 592 TWiki::Plugins::ChartPlugin::commonTagsHandler('<!--\x{a} * Set SHORTDESCRIPTION = Create PNG or GIF charts to...', 'ChartPlugin', 'TWiki', 0, 'TWiki::Meta=HASH(0x30a9e9c)') called at C:/www/twiki/lib/TWiki/Plugin.pm line 266

-- DipuDeshmukh - 2009-06-28

I was able to get around this problem, by removing the -wT on the first line of twiki/bin/view

-- DipuDeshmukh - 2009-07-07

horizontal bar charts would be oh-so-appreciated

-- VickiBrown - 2010-05-05

Would your company fund this project? Open source is about taking and giving back. I find it unfortunate that some large companies just do the former, e.g. profiting from hard work of open source contributors and not giving back.

-- PeterThoeny - 2010-05-05

Thank you Tait for making so many enhancements to the ChartPlugin. TWiki now supports sparklines, cool!!!

-- PeterThoeny - 2011-05-12

I know that pie charts are an often requested enhancement. At this point I probably don't have time to add this, but I'm wondering what people think of possibling adding support for pie charts by using a 100% Javascript solution like http://code.google.com/p/flot/ instead of this plugin creating an actual image file. An obvious negative to doing this is loosing the ability to access plugin created image files in other topics/applications.

Might be better to create a new plugin called JSChartPlugin which would provide charting abilities via Javascript.

Or is this still a requirement given PloticusPlugin and GnuPlotPlugin seem to provide this functionality?

-- TaitCyrus - 2011-05-23

A new JSChartPlugin would be an option. Flot looks nice out of the box.

The PloticusPlugin is not that easy to install due to dependencies.

My take: It makes sense to add a pie chart feature to the ChartPlugin at some point. For existing ChartPlugin admins it is easier to upgrade the plugin once the feature is available than to switch to a different plugin.

-- PeterThoeny - 2011-05-24

Is there a way to create scacked bar charts with chart plugin?

-- DeepanwitaBagchi - 2011-09-13

You mean stacked bar charts? Not at the moment, but you could fund the enhancement. TWiki is open source software where you take and give back.

-- PeterThoeny - 2011-09-13

Please ask support questions in the Support web.

-- PeterThoeny - 2012-03-21

I have installed last ChartPlugin on twiki-current from configure and it didn't draw anything until I change /ChartPlugin and ChartPlugin.pm to old version from twiki5.0. after change all is work

-- PavelPatcheptsov - 2012-09-25

Pavel, I am not sure what is wrong. I just updated TWiki.org with the latest plugin and it works as expected. Check the permissions and file ownership.

-- PeterThoeny - 2012-09-25

I am having issue with the datalabel or datalabel2 parameters. I believe it would apply to all the datasets from data or data2. But if, then there is a bug as it's using the dataset index instead of data serie index:

*** Chart.pm    2013-12-10 08:56:59.000000000 +0800
--- Chart.pm.20131210       2011-09-13 12:19:26.000000000 +0800
***************
*** 1741,1747 ****
            my $numDataSets = $this->_getNumDataSets($yAxisLoc);
            my @data = $this->_getData($yAxisLoc);
            for my $dataSet (0 .. $numDataSets - 1) {
!               my $dataLabel = $dataLabels[($yAxisLoc-1) % $numDataLabels];
                $dataLabel =~ s/\s//g;
                my $row       = $data[$dataSet];
                my @row       = @{$data[$dataSet]};
--- 1741,1747 ----
            my $numDataSets = $this->_getNumDataSets($yAxisLoc);
            my @data = $this->_getData($yAxisLoc);
            for my $dataSet (0 .. $numDataSets - 1) {
!               my $dataLabel = $dataLabels[$dataSet % $numDataLabels];
                $dataLabel =~ s/\s//g;
                my $row       = $data[$dataSet];
                my @row       = @{$data[$dataSet]};

Or it could be that you can specify the datalabel option for each dataset using datalabel="on,off,on". I don't think that works either, but I am not sure what was intended by the Author.

-- Jean-Francois Macaud - 2013-12-10

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch logplot.patch r1 manage 5.3 K 2003-10-13 - 21:27 BradDixon Vertical axis logarithmic plotting patch
Texttxt moreTableDiffs.txt r2 r1 manage 0.4 K 2003-01-21 - 10:44 AnthonPang Quick fix to Table.pm
Texttxt tableDiffs.txt r1 manage 1.6 K 2003-01-05 - 04:37 AnthonPang Diffs to 11 Oct 2002 ChartPlugin/Table.pm
Edit | Attach | Watch | Print version | History: r97 < r96 < r95 < r94 < r93 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r97 - 2013-12-10 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.