在 Morris.js 中是否可以更改一行中每个点的颜色?

Naj*_*nus 0 jquery charts linechart morris.js

我正在使用 Morris.js 绘制折线图。

是否可以在一行中更改每个点的颜色?

krl*_*zlx 5

您可以使用 更改点的颜色pointFillColors
以及带 的点周围圆圈的颜色pointStrokeColors

例如:

pointFillColors: ['grey', 'red'],
pointStrokeColors: ['black', 'blue'],
Run Code Online (Sandbox Code Playgroud)

如果要更改特定点,则必须修改 Morris。
您还可以设置goals为特定值绘制一条线。

我扩展了 Morris 并添加了以下参数:checkYValues, yValueCheck, yValueCheckColor.

用法:

checkYValues: "eq" // Possible values: eq (equal), gt (greater than), lt (lower than)
yValueCheck: 3 // A value to check
yValueCheckColor: "pink" // A color to draw the point
Run Code Online (Sandbox Code Playgroud)

pointFillColors: ['grey', 'red'],
pointStrokeColors: ['black', 'blue'],
Run Code Online (Sandbox Code Playgroud)
checkYValues: "eq" // Possible values: eq (equal), gt (greater than), lt (lower than)
yValueCheck: 3 // A value to check
yValueCheckColor: "pink" // A color to draw the point
Run Code Online (Sandbox Code Playgroud)