xieziyu / ngx-echarts

An angular (ver >= 2.x) directive for ECharts (ver >= 3.x)
https://xieziyu.github.io/ngx-echarts/
MIT License
1.11k stars 197 forks source link

ngx-echarts pie custom colors #280

Open jcschmittmouts opened 3 years ago

jcschmittmouts commented 3 years ago

Hello, I have a pie chart with 3 values. There's a way to set 3 default colors to my chart?

peder1001 commented 3 years ago

Try something like this:

const colors = [ '#6C88C4', '#C05780', '#4DD091', ];

Then when creating your series fetch the color you want.

pieChartSeries.push({ data: data[i], type: 'pie', name: name[i], color: colors[i], animation: true, });

then in your options..

series: pieChartSeries,