Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.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 jQplot实现在单个系列上禁用堆叠_Javascript_Primefaces_Jqplot - Fatal编程技术网

Javascript 如何使用Primefaces jQplot实现在单个系列上禁用堆叠

Javascript 如何使用Primefaces jQplot实现在单个系列上禁用堆叠,javascript,primefaces,jqplot,Javascript,Primefaces,Jqplot,我使用Primefaces 6来满足公司的图表需求,这依赖于jQplot。 对于一个项目,我尝试将折线图叠加在具有负值的堆叠条形图上,以获得如下结果: 问题是,当我尝试将一个linechartseries添加到与两个barchartseries相同的模型时,当设置setStacked(true)时,该线条图成为堆栈的一部分,因为Primefaces似乎不允许单独禁用系列上的堆叠,仅允许每个模型。因此,在使用 <p:chart type="bar" model="#{backingBean

我使用Primefaces 6来满足公司的图表需求,这依赖于jQplot。 对于一个项目,我尝试将折线图叠加在具有负值的堆叠条形图上,以获得如下结果:

问题是,当我尝试将一个
linechartseries
添加到与两个
barchartseries
相同的模型时,当设置
setStacked(true)时,该线条图成为堆栈的一部分,因为Primefaces似乎不允许单独禁用系列上的堆叠,仅允许每个模型。因此,在使用

<p:chart type="bar" model="#{backingBean.cartesianChartModel}"/>

经过一些调查,我发现jQplot能够通过在JS选项中传递
disableStack:true
来禁用单个序列上的堆栈,所以问题是,是否可以通过PF或一些JS hack在呈现页面上以某种方式覆盖它?我觉得使用扩展器只适用于整个模型


相关问题:

通过查阅文档,我找到了问题的解决方案,如果不是问题的话:

似乎Primefaces允许在这个版本的系列创建中通过传递从堆栈中排除单个系列

LineChartSeries.setDisableStack(true);

就这么简单。

我想这是可能的。过去,我在一些jqPlot黑客中使用了扩展程序功能

例如,在我的例子中,我使用扩展函数定义了一个圆环图,如下所示:

    private void createDonutModel() {
       donutModel = new DonutChartModel();
       donutModel.setLegendPosition("s");
       donutModel.setLegendPlacement(LegendPlacement.OUTSIDE);
       donutModel.setSliceMargin(4);
       donutModel.setDataFormat("value");
       donutModel.setShadow(false);
       donutModel.setExtender("donutExtender");
       donutModel.setSeriesColors("B81C40, FFA600, 79B54A");
    }
相应的javascript正在对jqPlot进行一些更改:

/**
 * Customized jqPlot JQuery layout of the Donut Chart for Status Dashboard.
 */
function donutExtender() {
   this.cfg.seriesDefaults = {
      // make this a donut chart.
      renderer:$.jqplot.DonutRenderer,
      rendererOptions:{          
          thickness: 26,
          ringMargin: 0,
          fill: true,
          padding: 0,
        sliceMargin: 4,
        // Pies and donuts can start at any arbitrary angle.
        startAngle: -90,
        showDataLabels: false,
        // By default, data labels show the percentage of the donut/pie.
        // You can show the data 'value' or data 'label' instead, or 'percent'
        dataLabels: 'value',
            shadow: false
      }
   }                

   this.cfg.gridPadding = { 
        top: 0, right: 0, bottom: 0, left: 0                
   }

   this.cfg.legend = {
        show: false
   }

   this.cfg.grid = { drawBorder: false,
        shadow: false,        
        background: "transparent"
   };
}
所以你可以在你的情况下试试这样的东西? 将系列的扩展配置保留为空,您感兴趣的扩展配置除外

function chartExtender() {
   this.cfg.series = [
   { //...
   },
   { // ...
   },
   {
      disableStack: true          
   }
   ]
}
值得一试……

“我觉得使用扩展器只适用于整个型号?”试试。。。看看例子。。。不要预先下结论。