更改X和Y轴值的颜色。 chart.js之 [英] Change color of X and Y axis values. Chart.js
问题描述
我正在使用v2。* ...但是,我似乎无法设置折线图的默认颜色。我主要想设置x / y图表值的颜色。认为下面可能会这样做 - 但它对图表完全没有任何作用。
I'm using v2.*... However, I can't seem to set the default color for a line chart. I'm mainly looking to set the color of the x/y chart values. figured the below might do it - but it does nothing to the chart at all.
Chart.defaults.global.defaultColor ='orange',
更新:这里有一个实时图表的jsfiddle
总之,我'我希望改变标签的颜色,即2016年2月7日等等。
Update: here's a jsfiddle with live chart In short, I'm looking to change the color of the labels i.e. Feb 7, 2016, etc etc.
https://jsfiddle.net/o534w6jj/
帮助? :)
推荐答案
好的,我明白了。这是我正在寻找的 ticks
属性...请参阅下面的代码。
Okay, so I figured it out. It's the ticks
property I'm looking for...see code below.
请参阅更新的jsfiddle: https://jsfiddle.net/o534w6jj/1/
See updated jsfiddle: https://jsfiddle.net/o534w6jj/1/
var ctx = $("#weekly-clicks-chart");
var weeklyClicksChart = new Chart(ctx, {
type: 'line',
data: data,
scaleFontColor: 'red',
options: {
scaleFontColor: 'red',
responsive: true,
tooltips: {
mode: 'single',
},
scales: {
xAxes: [{
gridLines: {
display: false,
},
ticks: {
fontColor: "#CCC", // this here
},
}],
yAxes: [{
display: false,
gridLines: {
display: false,
},
}],
}
}
});
这篇关于更改X和Y轴值的颜色。 chart.js之的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!