at present, a certain module in the project uses a pie chart, which is mainly divided into positive, negative and neutral.
requirements are positive green, negative red, and neutral blue.
but the color in ECharts is assigned according to the area of the pie chart. Can
determine the color of the pie block according to its name?
Thank you for your answer first. I tried it in everyone"s way at work today, but there is still a problem that is not quite the same as what you have described.
the data of the chart is given in the background. The code is as follows. Although I know that the color is controlled by color, the data is given in chartData []. There are name and value attributes in chartData. How do you associate it with color?
var self = this;
option = {
backgroundColor: "",
tooltip: {
...
}
},
legend:{
orient:"vertical",
data:self.legendData,
icon: "rect",
right: "5%",
top:"80%",
textStyle:{
color:"-sharp888",
fontSize:"14"
},
itemWidth: 12,
itemHeight: 12
},
grid:{
...
},
color:["-sharp45ba59","-sharp5b8de0","-sharpee6d61"],
series : [
{
type:"pie",
param:self.param,
data:self.chartData
...
}
]
};