This commit is contained in:
姚宇浩 2024-05-13 11:56:19 +08:00
parent b9bda9413c
commit d899a6c6b2
3 changed files with 49 additions and 126 deletions

View File

@ -32,7 +32,7 @@ const option = {
tooltip: {
show: true, //---,true
trigger: "axis",
formatter: "{b0}:{c0}" + "人",
formatter: "{b0}:{c1}" + "人",
},
xAxis: [
{

View File

@ -116,18 +116,8 @@ const getOption = () => {
itemStyle: {
normal: {
color: function (params) {
let colorList = [
["rgba(23, 237, 255, 1)", "rgba(23, 237, 255, 0.20)"],
["rgba(142, 187, 255, 1)", "rgba(142, 187, 255, 0.20)"],
["rgba(255, 243, 119, 1)", "rgba(255, 242, 142, 0.20)"],
];
if (params.dataIndex == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
var colorList = [
new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
@ -137,33 +127,8 @@ const getOption = () => {
color: "rgba(23, 237, 255, 0.20)",
},
],
false
);
} else if (params.dataIndex % 3 == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
},
{
offset: 1,
color: "rgba(23, 237, 255, 0.20)",
},
],
false
);
} else if (params.dataIndex % 2 == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
false),
new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(255, 243, 119, 1)",
@ -173,15 +138,8 @@ const getOption = () => {
color: "rgba(255, 242, 142, 0.20)",
},
],
false
);
} else {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
false),
new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(142, 187, 255, 1)",
@ -191,9 +149,10 @@ const getOption = () => {
color: "rgba(142, 187, 255, 0.20)",
},
],
false
);
}
false),
];
return colorList[params.dataIndex % colorList.length];
},
},
},

View File

@ -123,13 +123,8 @@ data.option = {
itemStyle: {
normal: {
color: function (params) {
if (params.dataIndex == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
var colorList = [
new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
@ -139,33 +134,8 @@ data.option = {
color: "rgba(23, 237, 255, 0.20)",
},
],
false
);
} else if (params.dataIndex % 3 == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
{
offset: 0,
color: "rgba(23, 237, 255, 1)",
},
{
offset: 1,
color: "rgba(23, 237, 255, 0.20)",
},
],
false
);
} else if (params.dataIndex % 2 == 0) {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
false),
new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(255, 243, 119, 1)",
@ -175,15 +145,8 @@ data.option = {
color: "rgba(255, 242, 142, 0.20)",
},
],
false
);
} else {
return new echarts.graphic.LinearGradient(
0,
0,
0,
1, //y->y2
[
false),
new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgba(142, 187, 255, 1)",
@ -193,9 +156,10 @@ data.option = {
color: "rgba(142, 187, 255, 0.20)",
},
],
false
);
}
false),
];
return colorList[params.dataIndex % colorList.length];
},
},
},