On Feb 19, 2009, at 5:14 PM, Dan Miron wrote:
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.
So do you agree that we shouldn't wrap the jfreechart API into our
xwiki-chart module?
Are you now saying that the xwiki-chart module will actually be a
xwiki-jfreechart module and that it'll contain some JFreechart-
specific PlotFactory classes?
If so then I agree.
How is this going
to interact with any graphing framework?
Are you asking the question? Or is it rethoretical?
Assuming it's rethoretical does it mean you think the xwiki-chart
module can be generic WRT graphing frameworks? If you can without
making it complex then fine but you'd need to implement at least with
2 graphing fwk to ensure this is true. I'm just not sure this is worth
the effort. I'd go with a xwiki-jfreechart module but then I don't
know much. In any case you'd need xwiki-graph and xwiki-graph-
jfreechart and I think for now a simple xwiki-jfreechart module is
good enough.
WDYT?
Thanks
-Vincent
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,