0

Is it possible to draw a line similar to the example below and color it based on the previous value?

So to have the color red when the line is moving down and green when it goes up.

Can this be done with line type? Or does it need to be drawn with markLine or something else?

Any help is much appreciated!

https://echarts.apache.org/examples/en/editor.html?c=dynamic-data2

Rares P
  • 303
  • 3
  • 15

1 Answers1

1

I don't think it is possible with the line chart, as the whole line uses the same color for all points. I suggest you use a scatter type chart where each point can have a different color. By setting symbol size to a small value and drawing values close together you can emulate visual line. Here is an example based on the regression sample from echarts site:

enter image description here

Simon
  • 368
  • 1
  • 4
  • 9