我正在使用chart.js绘制折线图以显示系统状态(向上或向下)。
我要使用相同的系列,当状态为“ down”时显示为红色,状态为“ up”时显示为绿色。
图表小提琴here
数据集选项:
"datasets": [
{
"label": "System",
"borderColor": "#66ff00",
"backgroundColor": "#66ff00",
"data": data,
"fill": false,
"tooltipName": "System",
"negative": false,
"pointRadius": 0,
"lineTension": 0
}
]
预期:
我该如何实现?我可以添加任何数据集borderColor来基于值设置每个点颜色的回调吗?