如何更改主要轴Axis的颜色?我没有看到任何默认颜色,我不知道如何更改它。
public LineChartModel getLineChartModel() {
LineChartModel model = new LineChartModel();
model.addSeries(getData());;
model.setTitle(televotingQuestion.getQuestion());
model.setSeriesColors("black");
Axis yAxis = model.getAxis(AxisType.Y);
yAxis.setMin(0);
yAxis.setTickInterval("1");
yAxis.setLabel("Anzahl");
Axis xAxis = model.getAxis(AxisType.X);
xAxis.setMin(televotingQuestion.getMinValue());
xAxis.setMax(televotingQuestion.getMaxValue());
xAxis.setTickInterval("100");
return model;
}
<p:chart id="votes" type="line" model="#{televotingNumericManagementBean.lineChartModel}" style="height:700px;"/>
我的扩展器:
<script>
function colorAxes() {
this.cfg.axes.yaxis.tickOptions = {
textColor : '#ffffff'
};
this.cfg.axes.yaxis.labelOptions = {
textColor : '#ffffff'
};
this.cfg.axes.xaxis.tickOptions = {
textColor: '#ffffff'
};
}
</script>
这就是我在我的bean中使用它的方式:
LineChartModel model = new LineChartModel();
model.addSeries(getData());;
model.setTitle(televotingQuestion.getQuestion());
model.setSeriesColors("black");
model.setExtender("colorAxes");