Vincent Massol wrote:
Hi Dan,
On Feb 18, 2009, at 5:46 PM, Dan Miron wrote:
Thomas Mortagne wrote:
On Thu, Feb 5, 2009 at 14:34, Dan Miron
<dan.miron(a)xwiki.com> wrote:
Hi guys,
In order to implement the chart macro
(
http://jira.xwiki.org/jira/browse/XWIKI-2883) , i propose the
following:
- Create a new TableBlockDataSource which implements the
com.xpn.xwiki.plugin.charts.source.DataSource and which will take
data
from a table contained within a Wiki2.0 document.
- Use the existing ChartPlugin for aquiring this new data source and
generate the graph.
IMO macro should not use old api/plugins, if a chart component is
needed that the chart macro would used we should create it. In a
general manner I are trying to never use anything from pmd xxwiki-
core
in component but translate and redesign useful xwiki-core code into
new components (like observationmanager, the rendering it self,
etc.).
I'm thinking of creating a new component responsible for generating
the
actual chart as PNG image which to replace the ChartPlugin. It would
be
similar to the old plugin but it will not use the ChartParams class
for
passing the parameters. I'm thinking of placing it platform/core and
calling it XWiki-Chart.
Jerome also suggests using this new component for the old radeox chart
macro.
Can you explain in detail what will be the role of the xwiki-chart
module?
If it's about generating PNG doesn't jfreechart do this already? Is it
about wrapping jfreechart with an xwiki api? If so then how do you
provide a generic api that'll work with any graphing framework?
Thanks
-Vincent
The Jfreechart doesn't do all the job alone. It describes only the
presentation. The data is handled by the Plot class - whose construction
needs to be handled by a PlotFactory, one for each chart type (e.g, for
pie, line, bar etc.). The purpose of our component is to bind together
the PNG generation with several custom PlotFactories. How is this going
to interact with any graphing framework?
The input:
- a custom datasource which will comply some predefined
specifications (like in the old plugin)
- a Map of parameters regarding the chart type and display options
The output:
- a String, or an URL pointing to the generated image file, which
will be used, further, in our macro to embed it within our page.
>>> This new datasource, in order to be
compatible with the chartPlugin,
>>> gets its parameters via a Map<String, String>. So I'm thinking of
>>> passing the current document and the table number as strings
>>> encoded in
>>> such a Map and then, in the datasource parsing the document and
>>> getting
>>> its DOM tree and then extracting the data from it.
>>>
>>> What do you think about this approach?
>>>
Tnx,
Dan