How to plot multiple colour traces in time series graph using plotly.js

I am new to plotly and I want to plot a graph with multiple traces each having multiple colours using javascript. I have gone through their documentations and could not find anything relevant.

Here is what I have tried, basically I could achieve multiple colour plot by plotting two traces, but is there anyway of achieving it with only one trace which can have more than one colour?

below is the javascript for the code.

    var trace1 = {
  x: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 
  y: [10, 11, 12, 13, 14, null, null, 14, 13, 12], 
  type: 'scatter'
};
var trace2 = {
  x: [5, 6, 7, 8], 
  y: [14, 14, 14, 14], 
  type: 'scatter'
};
var data = [trace1, trace2];
Plotly.newPlot('myDiv', data);

Jsfiddle link: https://jsfiddle.net/Shivin15/s9mv0hxw/1/

No, don’t allow multi-color lines at the moment. See Support for line width/color array? · Issue #147 · plotly/plotly.js · GitHub for more info on the topic.

1 Like

Thankyou @etienne for the insight, so now my question is plotly ever gonna support multi-color lines?