Javascript 当同一视图中有两个图表时,如何独立显示或隐藏Primefaces图表图例?
我在同一页上有两张图表。我希望在一个图表中显示图例,而不是两个图表,但我只有一个全局解决方案。这是我的javascript代码:Javascript 当同一视图中有两个图表时,如何独立显示或隐藏Primefaces图表图例?,javascript,jsf,charts,primefaces,jqplot,Javascript,Jsf,Charts,Primefaces,Jqplot,我在同一页上有两张图表。我希望在一个图表中显示图例,而不是两个图表,但我只有一个全局解决方案。这是我的javascript代码: $.jqplot.preDrawHooks.push(function () { this.legend.show = true;}); 还有我的xhtml: <p:chart id="chart17" responsive="true" type="bar" model="#{chart17Bean.barModel}" /> <p:char
$.jqplot.preDrawHooks.push(function () {
this.legend.show = true;});
还有我的xhtml:
<p:chart id="chart17" responsive="true" type="bar" model="#{chart17Bean.barModel}" />
<p:chart id="chart18" responsive="true" type="bar" model="#{chart18Bean.barModel}" />
编辑:我正在使用Primefaces 6.1在第页添加此JS函数
function removeLegend()
{
this.cfg.legend = {
show: false
};
}
然后在托管bean中添加
barModel.setExtender("removeLegend");
其中barModel是要隐藏图例的图表模型。解决了我的问题
yourChart.options = {
legend: {
display: false,
}
};
Primefaces 8,Chart Js,您可以将图例显示设置为false
Legend legend = new Legend();
legend.setDisplay(false);
options.setLegend(legend);
“你的图表”来自哪里?这在PrimeFaces中不起作用