我試圖從link實施Primefaces圖表。在Primefaces圖表中更改顏色
我設法創建這個例子:
<div id="datachart" style="margin: 0 auto; width:850px; height:400px; position:relative">
<h:form prependId="false">
<p:growl id="growl" showDetail="true" />
<p:barChart id="basic" value="#{bean.categoryModel}"
title="Accounts and Groups" min="0" max="#{DashboardController.chartMaxSize}" style="height:400px"
shadow="true" barMargin="40" barPadding="90" seriesColors="4D94FF, 1975FF"
yaxisLabel="Size" zoom="true">
<p:ajax event="itemSelect" listener="#{bean.itemSelect}" update="growl" />
</p:barChart>
</h:form>
</div>
我爲了改變圖表顏色標籤創建這個CSS:
<style type="text/css">
.jqplot-title{
color:#FFFFFF;
}
.jqplot-xaxis-label{
color:#FFFFFF;
}
.jqplot-yaxis-label{
color:#FFFFFF;
}
.jqplot-xaxis-tick{
color:#FFFFFF;
}
jqplot-yaxis-tick{
color:#FFFFFF;
}
</style>
但由於某些原因的顏色沒有改變。你能幫我找到我失蹤的東西嗎?
我提示你在開啓應用程式Chrome(或Firefox,只是給予我的例子,因爲我會解決這個問題),並右鍵點擊你的圖表。選擇檢查元素(或者只需點擊F12)。在檢查器的右邊部分,您可以查看應用的樣式,以及您的css是否真的被使用,或者(使用Primefaces時容易發生的情況)您的css是否被更高優先級的styleclasses覆蓋。 – devnomore