Tapestry:如何将选项放入jqplot饼图
“我的饼图”以百分比显示,图例位于饼图外部的底部。我希望饼图的标签是数字,图例是在饼图内,向东。我也想更改饼图的颜色。我尝试使用“params=pieOptions”,但它不起作用。参数显示在div元素中。不应该这样。这是我试过的Tapestry:如何将选项放入jqplot饼图,jqplot,tapestry,pie-chart,Jqplot,Tapestry,Pie Chart,“我的饼图”以百分比显示,图例位于饼图外部的底部。我希望饼图的标签是数字,图例是在饼图内,向东。我也想更改饼图的颜色。我尝试使用“params=pieOptions”,但它不起作用。参数显示在div元素中。不应该这样。这是我试过的 public JSONObject getPieOptions() { JSONObject json = new JSONObject(); JSONObject legend =new JSONObject(); legend.put("sho
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;
}
任何帮助都将不胜感激。谢谢。我使用的解决方案是直接更改tapestry5 jqplot项目中的JqPlotPie.java文件。正如Nathan提到的,pie组件中似乎没有params参数。 下面是我所做更改的代码片段
@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);
}
@参数(name=“seriesColor”,required=false,defaultPrefix=BindingConstants.PROP)
私有列表系列颜色;
put(“rendererOptions”,新的JSONLiteral({showDataLabels:true,dataLabels:'value'}”);
options.put(“图例”,新JSONObject({show:true,
渲染器选项:{numberRows:3},位置:'e'})//移除位置
if(seriesColor!=null&&seriesColor.size()>0)
{
JSONArray系列=新的JSONArray();
用于(字符串currentLabel:seriesColor)
{
系列。放置(当前标签);
}
期权。看跌期权(“系列颜色”,系列);
}
您正在使用tapestry5 jqPlot库吗?因为组件上似乎没有“params”参数。也许您可以在库的github上提出一个问题,并要求内置这种可能性。