How to put options into pie chart

26 views
Skip to first unread message

newbie

unread,
Jul 29, 2013, 2:58:37 AM7/29/13
to tapestry...@googlegroups.com
Hi,
My pie chart is displayed in percentages and the legend is outside the pie chart, at the bottom. I would like the label of pie chart to be in numbers and the legend to be inside the pie chart, to the east. I would like to change the color of the pie chart as well. I tried using "params=pieOptions" but it is not working. The params is being displayed in the div element. It shouldn't be. Here is what I have tried.
 

public JSONObject getPieOptions() 
{
JSONObject json = new JSONObject();
 JSONObject legend =new JSONObject();
 legend.put("show", new JSONLiteral("true"));
 legend.put("location", "e");
 json.put("legend", legend);


 JSONObject options = new JSONObject();
 options.put("options", json);
return options;
 }

 

 

Any help would be much appreciated. Thanks.

 

 

 

 

 

Emmanuel DEMEY

unread,
Jul 29, 2013, 4:01:00 AM7/29/13
to tapestry...@googlegroups.com
I can not reproduce your issue with the JSON directly inside the DIV. With the sample I sent to you few weeks ago, do you have the problem ? if not, you can reuse it for example. 


2013/7/29 newbie <codeh...@gmail.com>

 

 

 

 

 

--
You received this message because you are subscribed to the Google Groups "tapestry5-jquery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tapestry5-jque...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.e...@gmail.com

Twitter : @EmmanuelDemey

newbie

unread,
Jul 29, 2013, 4:24:02 AM7/29/13
to tapestry...@googlegroups.com
Hi,
The sample you sent me the last time was for stacked bar chart. I tried using the sample on pie chart but it is not working. Somehow it doesn't seem to capture the params. I have this same issue with bar chart the last time using my old tapestry5-jqplot.jar file. When I downloaded the new project from github and use the new jar file, the problem disappears.
 
 
 
 

 

 
 
 

 

 

 

 

 

newbie

unread,
Jul 29, 2013, 11:52:24 PM7/29/13
to tapestry...@googlegroups.com
The solution I use is to directly change the JqPlotPie.java file in the tapestry5-jqplot project. There seems to be no params parameter in the pie component.
Here is the code fragment of changes I have done.
 
@Parameter(name = "seriesColor", required = false, defaultPrefix = BindingConstants.PROP)
private List<String> seriesColor;


renderer.put("rendererOptions",new JSONLiteral("{showDataLabels: true, dataLabels:'value'}"));

options.put("legend", new JSONObject("{ show:true,
                    rendererOptions: { numberRows: 3 }, location: 'e' }")); //Remove placement

if(seriesColor != null && seriesColor.size()>0)
{
     JSONArray series = new JSONArray();
    for(String currentLabel: seriesColor)
    {
       series.put(currentLabel);
    }

    options.put("seriesColors",series);
}
 
 
 
 
 
 

 

 

 

 

 

Reply all
Reply to author
Forward
0 new messages