2014-11-04 60 views
1

我在创建自定义p:chart type =“pie”画布时遇到了问题。Primefaces 5.0图表自定义

我必须将饼图的背景颜色从白色更改为另一种颜色。

我尝试了几乎所有我发现的东西。我试图覆盖Prime Faces图表类的CSS资源,但它不起作用。它将所有画布/框架变成一种颜色,并使图表消失。

.xhtml文件

<p:chart type="pie" 
model="#{dashboardController.model}" 
style="width:500px;height:250px; margin: 0 auto;" /> 

bean.java文件

model= new PieChartModel(); 
model.setDataFormat("value"); 
model.setShowDataLabels(true); 
model.setFill(true); 
model.setTitle("States"); 
model.setSeriesColors("62656a,a5a5a5,929397"); 
model.setShowDataLabels(true); 
model.setDiameter(200); 

这是我需要改变画布的背景的组件。你可以从这里看到相同的图表:http://www.primefaces.org/showcase/ui/chart/pie.xhtml

**我怎样才能改变背景? **

在此先感谢。

回答

2

这个类更改bg

.jqplot-series-canvas { 
    background:blue; 
} 
+0

这一工程!谢谢。 – COvayurt 2014-11-04 13:16:32

+0

我不得不修改'.jqplot-series-shadowCanvas',因为整个系列类都隐藏了我的一些酒吧。 – 2018-02-20 10:18:12