簡體   English   中英

如何更改Primefaces / jqPlot折線圖的標簽顏色?

[英]How to change the label color of a Primefaces/jqPlot line chart?

我有一個簡單的JSF折線圖,它使用PrimeFaces(通過jqPlot)庫:

<p:lineChart id="linear"
             value="#{team.chart}" 
             title="Lap Times" 
             xaxisLabel="Lap"
             yaxisLabel="Time (sec)"
             style="height:300px;width:600px" /> 

但是,我想更改圖表的標題和X / Y標簽顏色。 我似乎無法找到合適的CSS組合來實現這一目標。 例如,以下操作不起作用:

.jqplot-xaxis {
     /* skin */
     font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; 
     color: white ! important;
     font-size: 90%;
 }

有什么想法嗎?

這正是我用於圖表的標題和X / Y標簽的內容:

.jqplot-title{
    color: #eeffdd;
}
.jqplot-xaxis-label{
    color: #eeccaa; 
}
.jqplot-yaxis-label{
    color: #eeccaa;
}

.jqplot-xaxis類的設置工作正常,只會更改xaxis的刻度。 你可以通過設置例如font-size: 20px;來快速測試它font-size: 20px;

正如Boro在上述答案的評論中所說,使用CanvasAxisLabelRenderer時,您需要使用:

labelOptions: {textColor: '#eeccaa'}

在xaxis或yaxis對象塊中(您引用labelRenderer的位置相同):

yaxis:{
  label: 'Your Label'
  labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
  labelOptions: {textColor: '#eeccaa'},
  etc...
}

只是認為強調這一點而不是將其隱藏在評論中會很好。

謝謝Boro!

為了我的工作這段代碼

 axes: {
     xaxis: {
          borderColor: "#aa2626",
          tickOptions: {
             textColor: '#aa2626'
             }
          }
        }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM