Pārlūkot izejas kodu

柱状图渐变

zpf 1 gadu atpakaļ
vecāks
revīzija
212d4be872
1 mainītis faili ar 53 papildinājumiem un 7 dzēšanām
  1. 53 7
      src/views/cockpitNew1/tdsc.vue

+ 53 - 7
src/views/cockpitNew1/tdsc.vue

@@ -77,7 +77,7 @@ export default {
         },
         legend: {
           orient: legendType === 'center' ? 'horizontal' : 'vertical',
-          bottom:"80%",
+          bottom: "80%",
           right: legendType === 'center' ? 'center' : '2%',
           // data: ['2023/06/08', '2023/10/07','2023/10/11'],
           data: ['征收', '回收', '收购'],
@@ -156,8 +156,23 @@ export default {
             silent: true,
             itemStyle: {
               normal: {
-                color: 'rgb(53,120,197)',
-              },
+                color: function (params) {
+                  let colorItem = ['#3b93e3', '#186bb8'];
+                  return new echarts.graphic.LinearGradient(0, 0, 0, 1, //y->y2
+                    [
+                      {
+                        offset: 0,
+                        color: colorItem[0]
+                      },
+                      {
+                        offset: 1,
+                        color: colorItem[1]
+                      }
+                    ],
+                    false
+                  );
+                }
+              }
             },
             data: [120, 75, 90, 100],
           },
@@ -168,8 +183,24 @@ export default {
             silent: true,
             itemStyle: {
               normal: {
-                color: 'rgb(236,159,32)',
-              },
+                color: function (params) {
+
+                  let colorItem = ['#efc943', '#ec9a1b'];
+                  return new echarts.graphic.LinearGradient(0, 0, 0, 1, //y->y2
+                    [
+                      {
+                        offset: 0,
+                        color: colorItem[0]
+                      },
+                      {
+                        offset: 1,
+                        color: colorItem[1]
+                      }
+                    ],
+                    false
+                  );
+                }
+              }
             },
             data: [120, 75, 90, 100],
           },
@@ -180,8 +211,23 @@ export default {
             silent: true,
             itemStyle: {
               normal: {
-                color: 'rgb(27,117,123)',
-              },
+                color: function (params) {
+                  let colorItem = ['#4ee1ac', '#12a972'];
+                  return new echarts.graphic.LinearGradient(0, 0, 0, 1, //y->y2
+                    [
+                      {
+                        offset: 0,
+                        color: colorItem[0]
+                      },
+                      {
+                        offset: 1,
+                        color: colorItem[1]
+                      }
+                    ],
+                    false
+                  );
+                }
+              }
             },
             data: [102, 130, 80, 100],
           },