Tom
Tom

Reputation: 53

Echarts change color for type: pie

I use this kind of chart - https://echarts.apache.org/examples/en/editor.html?c=dataset-link If I add to the first item for series color red (line:22), so the code looks like:

{ type: 'line', color: 'red', smooth: true, seriesLayoutBy: 'row', emphasis: { focus: 'series' } },

It changes the color only in the chart but not in the pie, thank you for solution

Upvotes: 0

Views: 1291

Answers (1)

A mere dev
A mere dev

Reputation: 1810

Change the global color palette instead of changing colors for each series.

Here is an example based on the one you gave.

option = {
  ...
  //Set the global color palette
  color: ['#c23531','#2f4554','#61a0a8','#d48265','#91c7ae',
  '#749f83','#ca8622','#bda29a','#6e7074','#546570','#c4ccd3'],
  series : [ 
    ...
  ]
}

Upvotes: 1

Related Questions