如何更改同一系列中每列的primefaces条形图中的颜色?

Mar*_*vić 2 java xhtml charts primefaces

我在更改条形图中列的颜色时遇到问题.如果我有更多系列,我知道如何更改它们

<p:barChart id="outboxOfferChart" value="#{offerStatisticsBean.outboxOfferStatistics}" 
xaxisAngle="-70" datatipFormat="#{offerStatisticsBean.datatipFormat}" min="0" 
max="#{offerStatisticsBean.maxYAxis}" **seriesColors="FB5E09, CA04F1, 5EDD03, 04F655, 13FBC1, FC5560, FBFB18, B7FB09, 04C1FB, 034ED8, E704C1, FB0467, FC211D"** 
style="height:370px; width:380px;"/>
Run Code Online (Sandbox Code Playgroud)

,但如果我只有1个系列,并希望将每列的颜色更改为同一系列怎么办?非常感谢帮助!

ste*_*eve 5

使用扩展程序属性完成您的primefaces图表:

<h:outputScript>
function ext() {
  this.cfg.seriesDefaults.rendererOptions.varyBarColor = true;
}                               
</h:outputScript>       

<p:barChart ... extender="ext"/>
Run Code Online (Sandbox Code Playgroud)

默认情况下,单个系列中的条形图将使所有条形颜色相同.但是您可以使用varyBarColor属性为每个条形使用不同的颜色:

http://www.jqplot.com/deploy/dist/examples/multipleBarColors.html