Primefaces 5.1:条形图和饼图不显示图例
Primefaces 5.1 : Bar and pie charts display no legends
我的条形图和饼图中没有图例。
我为 setLegendPlacement
和 setLegendPosition
方法尝试了几个参数,但没有结果。
我哪里错了?
这是我的条形图配置:
BarChartModel model = new BarChartModel();
model.setZoom(true);
model.setLegendPlacement(LegendPlacement.INSIDE);
model.setLegendPosition("ne");
model.setAnimate(true);
model.setMouseoverHighlight(true);
model.setShowPointLabels(true);
ChartSeries myChartSeries = new ChartSeries();
bank.setLabel("myChatSeries");
for (String key : datas.keys()) {
bank.set(key, datas.get(key));
}
model.addSeries(myChartSeries);
Axis yAxis = model.getAxis(AxisType.Y);
yAxis.setLabel(status.name());
yAxis.setMin(0);
yAxis.setMax(maxCount+1);
yAxis.setTickInterval("2");
Axis xAxis = model.getAxis(AxisType.X);
xAxis.setTickAngle(-20);
这是我的饼图配置:
PieChartModel model = new PieChartModel();
model.setLegendPosition("ne");
model.setLegendPlacement(LegendPlacement.INSIDE);
model.setTitle("Informations général");
model.setMouseoverHighlight(true);
model.setShowDataLabels(true);
model.set("type1", 3);
model.set("type2", 6);
model.set("type3", 8);
我的堆栈:java8,jsf 2.1.28,primefaces 5.1,primefaces-themes 1.0.10
通过在绘图前将 属性 legend.show
设置为 true
来解决:
$.jqplot.preDrawHooks.push(function () {
this.legend.show = true;
});
有点无用的 hack,Primefaces 5.1 似乎没有默认设置 属性。
我的条形图和饼图中没有图例。
我为 setLegendPlacement
和 setLegendPosition
方法尝试了几个参数,但没有结果。
我哪里错了?
这是我的条形图配置:
BarChartModel model = new BarChartModel();
model.setZoom(true);
model.setLegendPlacement(LegendPlacement.INSIDE);
model.setLegendPosition("ne");
model.setAnimate(true);
model.setMouseoverHighlight(true);
model.setShowPointLabels(true);
ChartSeries myChartSeries = new ChartSeries();
bank.setLabel("myChatSeries");
for (String key : datas.keys()) {
bank.set(key, datas.get(key));
}
model.addSeries(myChartSeries);
Axis yAxis = model.getAxis(AxisType.Y);
yAxis.setLabel(status.name());
yAxis.setMin(0);
yAxis.setMax(maxCount+1);
yAxis.setTickInterval("2");
Axis xAxis = model.getAxis(AxisType.X);
xAxis.setTickAngle(-20);
这是我的饼图配置:
PieChartModel model = new PieChartModel();
model.setLegendPosition("ne");
model.setLegendPlacement(LegendPlacement.INSIDE);
model.setTitle("Informations général");
model.setMouseoverHighlight(true);
model.setShowDataLabels(true);
model.set("type1", 3);
model.set("type2", 6);
model.set("type3", 8);
我的堆栈:java8,jsf 2.1.28,primefaces 5.1,primefaces-themes 1.0.10
通过在绘图前将 属性 legend.show
设置为 true
来解决:
$.jqplot.preDrawHooks.push(function () {
this.legend.show = true;
});
有点无用的 hack,Primefaces 5.1 似乎没有默认设置 属性。