Hi Devs I want to make a graph with a given table, but i don`t want to see the table in the xwiki page, so i`m trying to make the graph inside my function: Map data = new HashMap(); data.put("x", "1"); data.put("y", "110"); ChartingPlugin chartplugin = new ChartingPlugin("chartingplugin", ChartingPlugin.class.toString(), context); chartplugin.init(context); // ChartingPluginApi chart = new ChartingPluginApi(chartplugin,context); ChartParams chartParams = new ChartParams(); try { chartParams = new ChartParams(data, DefaultChartParams.getInstance(), true); chartParams.addParam(new MapChartParam("source=type:table", false)); chartParams.addParam(new MapChartParam("type=pie", false)); // chartParams.set("SOURCE", "type:table"); // chartParams.set("TYPE", "pie"); chartParams.check(); } catch (ParamException e) { } * Chart chart = new ChartImpl(chartParams,null,null); try { chart = chartplugin.generateChart(chartParams, context); } catch (GenerateException ge) { }* String title = chartParams.getString( ChartParams.TITLE_PREFIX+ChartParams.TITLE_SUFFIX); Integer height = chartParams.getInteger(ChartParams.HEIGHT); Integer width = chartParams.getInteger(ChartParams.WIDTH); Map imageAttr = chartParams.getMap(ChartParams.IMAGE_ATTRIBUTES); Map linkAttr = chartParams.getMap(ChartParams.LINK_ATTRIBUTES); // output the image links StringBuffer sbuffer = new StringBuffer(); sbuffer.append("<a href=\""+ chart.getPageURL() + "\" "); if (title != null) { sbuffer.append("title=\"" + title + "\""); } if (linkAttr != null) { Iterator it = linkAttr.keySet().iterator(); while (it.hasNext()) { String name = (String)it.next(); String value = (String)imageAttr.get(name); sbuffer.append(name+"=\"" + value + "\" "); } } sbuffer.append(">"); sbuffer.append("<img src=\""); sbuffer.append(chart.getImageURL()); sbuffer.append("\" "); if (title != null) { sbuffer.append("alt=\""+ title + "\" "); } sbuffer.append("height=\"" + height + "\" "); sbuffer.append("width=\"" + width + "\" "); if (imageAttr != null) { Iterator it = imageAttr.keySet().iterator(); while (it.hasNext()) { String name = (String)it.next(); if (name != ChartParams.HEIGHT && name != ChartParams.WIDTH) { String value = (String)imageAttr.get(name); sbuffer.append(name + "=\"" + value + "\" "); } else { } } } sbuffer.append("/>"); sbuffer.append("</a>"); return sbuffer.toString(); I get some problems in : * Chart chart = new ChartImpl(chartParams,null,null); try { chart = chartplugin.generateChart(chartParams, context); } catch (GenerateException ge) { } *I think is some problem with the source, Any ideas? Thanks in advance :)
Bruno Amaro Almeida wrote:
Hi Devs
I want to make a graph with a given table, but i don`t want to see the table in the xwiki page, so i`m trying to make the graph inside my function:
If you don't want the table to be visible, you can just put it inside a <div class="hidden"> -- Sergiu Dumitriu http://purl.org/net/sergiu/
Hi I`ve tryed that, but seems that when i have more than one chart/table, they all messed up Sergiu Dumitriu wrote:
Bruno Amaro Almeida wrote:
Hi Devs
I want to make a graph with a given table, but i don`t want to see the table in the xwiki page, so i`m trying to make the graph inside my function:
If you don't want the table to be visible, you can just put it inside a <div class="hidden">
Bruno Amaro Almeida wrote:
Hi
I`ve tryed that, but seems that when i have more than one chart/table, they all messed up
No, they should be working fine. Make sure you're using the source chart parameter correctly, see http://code.xwiki.org/xwiki/bin/view/Macros/ChartMacro Alternatively, you can put the tables in different documents, as the chart macro can work with tables from any document, not just the current one.
Sergiu Dumitriu wrote:
Bruno Amaro Almeida wrote:
Hi Devs
I want to make a graph with a given table, but i don`t want to see the table in the xwiki page, so i`m trying to make the graph inside my function:
If you don't want the table to be visible, you can just put it inside a <div class="hidden">
-- Sergiu Dumitriu http://purl.org/net/sergiu/
I forgot to say The main objective is in a page i call $xwiki.myplugin.MakeATable(params) $xwiki.myplugin.MakeATable(params) $xwiki.myplugin.MakeAGraph(params) //Table Hidden here With different tables/data in any of this Thanks for the quick response :) Bruno Amaro Almeida wrote:
Hi
I`ve tryed that, but seems that when i have more than one chart/table, they all messed up
Sergiu Dumitriu wrote:
Bruno Amaro Almeida wrote:
Hi Devs
I want to make a graph with a given table, but i don`t want to see the table in the xwiki page, so i`m trying to make the graph inside my function:
If you don't want the table to be visible, you can just put it inside a <div class="hidden">
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Your solution may work if i specified the table number, but that is one way that i`m trying to avoid :s Bruno Amaro Almeida wrote:
I forgot to say The main objective is in a page i call
$xwiki.myplugin.MakeATable(params)
$xwiki.myplugin.MakeATable(params)
$xwiki.myplugin.MakeAGraph(params) //Table Hidden here
With different tables/data in any of this
Thanks for the quick response :)
Bruno Amaro Almeida wrote:
Hi
I`ve tryed that, but seems that when i have more than one chart/table, they all messed up
Sergiu Dumitriu wrote:
Bruno Amaro Almeida wrote:
Hi Devs
I want to make a graph with a given table, but i don`t want to see the table in the xwiki page, so i`m trying to make the graph inside my function:
If you don't want the table to be visible, you can just put it inside a <div class="hidden">
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Bruno Amaro Almeida -
Sergiu Dumitriu