我有一个 html 文件可以在图表中显示一些 CSV 数据。
这是有效的,但图例文本是黑色的。如果文本颜色可以适合线条/轴颜色,那就太好了。
我已尝试更改它,但所有示例看起来都与我拥有的 html 不同。
所以请你看一下并帮我改变颜色?
我把 html 和 csv 放到了 plnkr
<http://plnkr.co/edit/HKgWYInINlVEl5lM?preview>
答案 0 :(得分:0)
要更改标签的颜色(图例的标签),只需使用
#labelID {
color: red; /* the color you would like to fill the label */
}
在你的情况下,我会为每个标签添加一个 id
var label = document.createElement('label');
label.htmlFor = 'legnd_chk' + idx;
label.id = 'label_legend' + idx;
label.appendChild(document.createTextNode(title));
并为标签添加css
#label_legend0 {
color: blue;
}
#label_legend1 {
color: red;
}
#label_legend2 {
color: green;
}
#label_legend3 {
color: yellow;
}