在 google 图表中添加列时如何更改文本颜色
How to change color of text when added column in google chart
enter image description here
我尝试将图片中用箭头指向的文本颜色更改为白色,尝试 annotations.style,但没有成功。我做错了什么?
let dataTemperatures = google.visualization.arrayToDataTable([]);
dataTemperatures.addColumn('datetime', 'Date');
dataTemperatures.addColumn('number', 'External Temperature');
dataTemperatures.addColumn('number', 'Dew Point');
dataTemperatures.addRows(temperature_data);
let temperature_options = {
backgroundColor: chartBackgroundColor,
titleTextStyle: {
color: textChartColor,
fontName: fontNameChart
},
annotations: {
textStyle: {color: 'white'}
},
hAxis: {
textStyle: { color: textChartColor },
},
vAxis: {
title: "Temperatures (°C)",
titleTextStyle: {
color: textChartColor,
fontName: fontNameChart
},
textStyle: { color: textChartColor },
},
series: {
0: { type: 'line', color: '#1CACDC' },
1: { type: 'line', color: '#00ffff' }
}
};
使用以下选项更改 图例
的文本颜色
legend: {
textStyle: {
color: textChartColor
}
}
enter image description here
我尝试将图片中用箭头指向的文本颜色更改为白色,尝试 annotations.style,但没有成功。我做错了什么?
let dataTemperatures = google.visualization.arrayToDataTable([]);
dataTemperatures.addColumn('datetime', 'Date');
dataTemperatures.addColumn('number', 'External Temperature');
dataTemperatures.addColumn('number', 'Dew Point');
dataTemperatures.addRows(temperature_data);
let temperature_options = {
backgroundColor: chartBackgroundColor,
titleTextStyle: {
color: textChartColor,
fontName: fontNameChart
},
annotations: {
textStyle: {color: 'white'}
},
hAxis: {
textStyle: { color: textChartColor },
},
vAxis: {
title: "Temperatures (°C)",
titleTextStyle: {
color: textChartColor,
fontName: fontNameChart
},
textStyle: { color: textChartColor },
},
series: {
0: { type: 'line', color: '#1CACDC' },
1: { type: 'line', color: '#00ffff' }
}
};
使用以下选项更改 图例
的文本颜色legend: {
textStyle: {
color: textChartColor
}
}