Explorar el Código

feat: echarts完善 添加渐变曲线图2

Grnetsky hace 1 año
padre
commit
f6c5591989
Se han modificado 1 ficheros con 349 adiciones y 2 borrados
  1. 349 2
      src/services/echarts.ts

+ 349 - 2
src/services/echarts.ts

@@ -855,7 +855,7 @@ export const charts = [
       },
 
       {
-        name: '渐变单曲线图',
+        name: '渐变单曲线图1',
         icon: 'l-quxian',
         data: {
           name: 'echarts',
@@ -930,7 +930,7 @@ export const charts = [
                       colorStops: [{
                         offset: 0, color: 'rgba(69,131,255,0.0)' // 0% 处的颜色
                       },  {
-                        offset: 0.5, color: 'rgba(69,131,255,0.50)' // 100% 处的颜色
+                        offset: 0.5, color: 'rgba(69,131,255,1.0)' // 100% 处的颜色
                       },
                         {
                           offset: 1, color: 'rgba(69,131,255,0.0)' // 100% 处的颜色
@@ -1010,6 +1010,353 @@ export const charts = [
           },
         },
       },
+      {
+        name: '渐变单曲线图2',
+        icon: 'l-quxian',
+        data: {
+          name: 'echarts',
+          width: 366,
+          height: 206,
+          externElement: true,
+          disableAnchor: true,
+          echarts: {
+            option: {
+              grid: {
+                bottom: 8,
+                left: 8,
+                right: 8,
+                top: 40,
+                containLabel: true,
+              },
+              fontSize: 10,
+              xAxis: {
+                type: 'category',
+                data: ['0', '6', '12', '18', '24'],
+                axisLabel: {
+                  fontSize: 12,
+                  fontFamily:'PingFang SC, PingFang SC-Regular',
+                  fontWeight:400,
+                  margin: 10,
+                  color:'#b3d1ff'
+                },
+                axisTick:{
+                  show: false
+                },
+                axisLine:{
+                  lineStyle:{
+                    color:'rgba(255,255,255,0.2)'
+                  }
+                },
+                axisPointer:{
+                  show: true,
+                  type: 'line',
+                  label:{
+                    show:false
+                  },
+                  snap: true,
+                  lineStyle:{
+                    type: 'solid',
+                    color:'rgba(255,255,255,0.30)'
+                  }
+                }
+              },
+              yAxis: {
+                type: 'value',
+                name: '单位:A ',
+                nameGap:15,
+                min:0,
+                max:100,
+                interval:25,
+                nameTextStyle: {
+                  fontSize: 12,
+                  padding:[0,6,0,6],
+                  color:'rgba(179,209,255,0.6)',
+
+                },
+                minInterval: 50,
+                axisLabel: {
+                  fontSize: 12,
+                  fontFamily:'PingFang SC, PingFang SC-Regular',
+                  fontWeight:400,
+                  margin:10,
+                  color: 'rgba(179,209,255,0.5)',
+                },
+              },
+              series: [
+                {
+                  type: 'line',
+                  smooth: true,
+                  data: [50, 40, 80, 50, 60, 30],
+                  lineStyle:{
+                    width: 2,
+                    color: {
+                      type: 'linear',
+                      x: 0,
+                      y: 0,
+                      x2: 1,
+                      y2: 0,
+                      colorStops: [{
+                        offset: 0, color: 'rgba(69,131,255,0.0)' // 0% 处的颜色
+                      },  {
+                        offset: 0.5, color: 'rgba(69,131,255,1.0)' // 100% 处的颜色
+                      },
+                        {
+                          offset: 1, color: 'rgba(69,131,255,0.0)' // 100% 处的颜色
+                        }],
+                      global: false // 缺省为 false
+                    }
+                  },
+                  areaStyle:{
+                    color: {
+                      type: 'linear',
+                      x: 0,
+                      y: 0,
+                      x2: 1,
+                      y2: 0,
+                      colorStops: [{
+                        offset: 0, color: 'rgba(69,131,255,0.0)' // 0% 处的颜色
+                      },  {
+                        offset: 0.5, color: 'rgba(69,131,255,0.50)' // 100% 处的颜色
+                      },
+                        {
+                          offset: 1, color: 'rgba(69,131,255,0.0)' // 100% 处的颜色
+                        }],
+                      global: false // 缺省为 false
+                    }
+                  },
+                  itemStyle:{
+                    color:'rgb(69,131,255)'
+                  },
+                  symbol: 'emptyCircle',
+                  showSymbol:false,
+                  symbolSize: 3,
+                },
+              ],
+            },
+            max: 30,
+          },
+          realTimes: [
+            {
+              key: 'echarts.option.series.0.data.0',
+              label: '0',
+              type: 'float',
+              enableMock: true,
+              mock: '10-40',
+            },
+            {
+              key: 'echarts.option.series.0.data.1',
+              label: '6',
+              type: 'float',
+              enableMock: true,
+              mock: '0-50',
+            },
+            {
+              key: 'echarts.option.series.0.data.2',
+              label: '12',
+              type: 'float',
+              enableMock: true,
+              mock: '0-50',
+            },
+            {
+              key: 'echarts.option.series.0.data.3',
+              label: '18',
+              type: 'float',
+              enableMock: true,
+              mock: '20-60',
+            },
+            {
+              key: 'echarts.option.series.0.data.4',
+              label: '24',
+              type: 'float',
+              enableMock: true,
+              mock: '0-80',
+            },
+          ],
+          props: {
+            custom: [
+              {
+                key: 'echarts',
+                label: 'echarts配置',
+                type: 'code',
+              },
+            ],
+          },
+        },
+      },
+      {
+        name: '渐变单曲线图3',
+        icon: 'l-quxian',
+        data: {
+          name: 'echarts',
+          width: 366,
+          height: 206,
+          externElement: true,
+          disableAnchor: true,
+          echarts: {
+            option: {
+              grid: {
+                bottom: 8,
+                left: 8,
+                right: 8,
+                top: 40,
+                containLabel: true,
+              },
+              fontSize: 10,
+              xAxis: {
+                type: 'category',
+                data: ['0', '6', '12', '18', '24'],
+                axisLabel: {
+                  fontSize: 12,
+                  fontFamily:'PingFang SC, PingFang SC-Regular',
+                  fontWeight:400,
+                  margin: 10,
+                  color:'#b3d1ff'
+                },
+                axisTick:{
+                  show: false
+                },
+                axisLine:{
+                  lineStyle:{
+                    color:'rgba(255,255,255,0.2)'
+                  }
+                },
+                axisPointer:{
+                  show: true,
+                  type: 'line',
+                  label:{
+                    show:false
+                  },
+                  snap: true,
+                  lineStyle:{
+                    type: 'solid',
+                    color:'rgba(255,255,255,0.30)'
+                  },
+                  triggerTooltip:false
+                }
+              },
+              yAxis: {
+                type: 'value',
+                name: '单位:V',
+                nameGap:15,
+                min:0,
+                max:100,
+                interval:25,
+                nameTextStyle: {
+                  fontSize: 12,
+                  padding:[0,6,0,6],
+                  color:'rgba(179,209,255,0.6)',
+
+                },
+                minInterval: 50,
+                axisLabel: {
+                  fontSize: 12,
+                  fontFamily:'PingFang SC, PingFang SC-Regular',
+                  fontWeight:400,
+                  margin:10,
+                  color: 'rgba(179,209,255,0.5)',
+                },
+              },
+              series: [
+                {
+                  type: 'line',
+                  smooth: true,
+                  data: [50, 40, 80, 50, 60, 30],
+                  lineStyle:{
+                    width: 2,
+                    color: {
+                      type: 'linear',
+                      x: 0,
+                      y: 0,
+                      x2: 1,
+                      y2: 0,
+                      colorStops: [{
+                        offset: 0, color: 'rgba(50,167,192,0.0)' // 0% 处的颜色
+                      },  {
+                        offset: 0.5, color: 'rgba(50,167,192,1.0)' // 100% 处的颜色
+                      },
+                        {
+                          offset: 1, color: 'rgba(50,167,192,0.0)' // 100% 处的颜色
+                        }],
+                      global: false // 缺省为 false
+                    }
+                  },
+                  areaStyle:{
+                    color: {
+                      type: 'linear',
+                      x: 0,
+                      y: 0,
+                      x2: 1,
+                      y2: 0,
+                      colorStops: [{
+                        offset: 0, color: 'rgba(50,167,192,0.0)' // 0% 处的颜色
+                      },  {
+                        offset: 0.5, color: 'rgba(50,167,192,0.50)' // 100% 处的颜色
+                      },
+                        {
+                          offset: 1, color: 'rgba(50,167,192,0.0)' // 100% 处的颜色
+                        }],
+                      global: false // 缺省为 false
+                    }
+                  },
+                  itemStyle:{
+                    color:'#37B3CC'
+                  },
+                  symbol: 'emptyCircle',
+                  showSymbol:false,
+                  symbolSize: 3,
+                },
+              ],
+            },
+            max: 30,
+          },
+          realTimes: [
+            {
+              key: 'echarts.option.series.0.data.0',
+              label: '0',
+              type: 'float',
+              enableMock: true,
+              mock: '10-40',
+            },
+            {
+              key: 'echarts.option.series.0.data.1',
+              label: '6',
+              type: 'float',
+              enableMock: true,
+              mock: '0-50',
+            },
+            {
+              key: 'echarts.option.series.0.data.2',
+              label: '12',
+              type: 'float',
+              enableMock: true,
+              mock: '0-50',
+            },
+            {
+              key: 'echarts.option.series.0.data.3',
+              label: '18',
+              type: 'float',
+              enableMock: true,
+              mock: '20-60',
+            },
+            {
+              key: 'echarts.option.series.0.data.4',
+              label: '24',
+              type: 'float',
+              enableMock: true,
+              mock: '0-80',
+            },
+          ],
+          props: {
+            custom: [
+              {
+                key: 'echarts',
+                label: 'echarts配置',
+                type: 'code',
+              },
+            ],
+          },
+        },
+      },
 
       {
         name: '阶梯折线图',