[Phpmyadmin-devel] Table charting pChart replacement

Tyron Madlener tyronx at gmail.com
Thu Jun 9 17:04:30 CEST 2011


Wasn't sure of whether to mail this to Michal or the mailing list, but
I guess a bigger audience also means more feedback :)

I am in the process of replacing pChart in pma and finishing on the
table charting feature. Since the pChart-Version was rather difficult
to use I thought I'd offer the user some choice about which column
data is used for what.
While implementing, I was orienting in the examples given by
http://wiki.phpmyadmin.net/pma/Charts#Data_formats_for_query_results_chart
where I was slightly surprised by the odd data format of the examples.
It doesn't allow any graph with more than 2 series.
So I thought the most logical of way representing table data is by
selecting one column as x-axis and let the other columns be different
series within the graph.

So looking at the examples, the logical continuation of example 2 would be:

SELECT
  225       AS 'Value1',
  653       AS 'Value2',
  '2009-11' AS 'Month' UNION
SELECT 1157, 855, '2009-12' UNION
SELECT  569, 253, '2010-01' UNION
SELECT  282, 455, '2010-02' UNION
SELECT 2960, 3552, '2010-03'

...which will display the date on the X-Axis and 2 series (Value1 and
Value2) in the graph.

However, in order to allow data like in the original example3 I've
added a select list where one can select what the series types should
be. The default selection is to use all columns  except the selected
xaxis but you can also select a specific column from where it should
read all possible types (so this column should probably be a ENUM or
similar).

So when charting the original example3 with Type set to Column,
Series=Operator, X-Axis=Month and Stacking on we get the same result
again. I'm not quite sure whether such solution will make sense for
everyone so I'm asking here if it is :-)

Current differences over the pChart implementation:
- Everything updates as you type/select. No more Redraw button is required
- New charting types: (Horizontal-)Bar and Spline
- No editable Area/Legend Margins (who needs that?)
- Have as many Series (=Columns-1) as you want, not only 3
- Select the column you want to be the x-axis, so you don't need to
know by heart where in your query result the x-axis column is supposed
to be.
- If a column contains the word date or time it will be pre-selected as xaxis
- No width/height selection, instead just mouse-drag the chart to the
right size.

Please check it out at http://demo.phpmyadmin.net/gsoc-tyron/

P.S.: There seems to be a problem when using the sql statements given
on the wiki within the db links SQL page. Once the query is executed
and you click on display chart or export it just redirects you to the
main page again.




More information about the Developers mailing list