Chart.js根据值设置折线图borderColor

时间:2019-11-10 13:33:56

标签: javascript charts chart.js chart.js2

我正在使用chart.js绘制折线图以显示系统状态(向上或向下)。

我要使用相同的系列,当状态为“ down”时显示为红色,状态为“ up”时显示为绿色。

图表小提琴here

数据集选项:

"datasets": [
      {
        "label": "System",
        "borderColor": "#66ff00",
        "backgroundColor": "#66ff00",
        "data": data,
        "fill": false,
        "tooltipName": "System",
        "negative": false,
        "pointRadius": 0,
        "lineTension": 0
      }
    ]

输出: enter image description here

预期:

enter image description here

我该如何实现?我可以添加任何数据集borderColor来基于值设置每个点颜色的回调吗?

0 个答案:

没有答案
相关问题