Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当同一视图中有两个图表时,如何独立显示或隐藏Primefaces图表图例?_Javascript_Jsf_Charts_Primefaces_Jqplot - Fatal编程技术网

Javascript 当同一视图中有两个图表时,如何独立显示或隐藏Primefaces图表图例?

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

我在同一页上有两张图表。我希望在一个图表中显示图例,而不是两个图表,但我只有一个全局解决方案。这是我的javascript代码:

$.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中不起作用