@bandow It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗 TRANSLATED
TITLE
[Feature] Can the line chart make different gradient colors according to the interval of the data?
3条答案
按热度按时间fnx2tebb1#
@bandow It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED
TITLE
[Feature] Can the line chart make different gradient colors according to the interval of the data?
9w11ddsr2#
Can the line chart support different gradient colors based on the data range?
bcs8qyzn3#
// areaStyle: {
// color: function(params) {
// // const value = params.value[1]; // 假设您正在处理的是折线图中的第二个数据点(索引为1)
// const value = params[params.length-1]; // 假设您正在处理的是折线图中的第二个数据点(索引为1)
// if (value > 26) {
// // 对于大于26的值,使用从红色到深红色的渐变
// return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {offset: 0, color: 'rgb(255, 0, 0)'}, // 红色
// {offset: 1, color: 'rgb(128, 0, 0)'} // 深红色
// ]);
// } else if (value >= 22) {
// // 对于大于等于22且小于等于26的值,使用从绿色到深绿色的渐变
// return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {offset: 0, color: 'rgb(0, 255, 0)'}, // 绿色
// {offset: 1, color: 'rgb(0, 128, 0)'} // 深绿色
// ]);
// } else {
// // 对于小于22的值,使用从蓝色到深蓝色的渐变
// return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {offset: 0, color: 'rgb(0, 0, 255)'}, // 蓝色
// {offset: 1, color: 'rgb(0, 0, 128)'} // 深蓝色
// ]);
// }
// }
// }为什么不生效呢?