Kaynağa Gözat

feat_echarts-realtimes

ananzhusen 1 yıl önce
ebeveyn
işleme
c74c7b2a70
2 değiştirilmiş dosya ile 130 ekleme ve 71 silme
  1. 129 70
      src/services/echarts.ts
  2. 1 1
      src/views/components/View.vue

+ 129 - 70
src/services/echarts.ts

@@ -64,13 +64,17 @@ export const charts = [
           realTimes: [
             {
               key: 'echarts.option.series.0.data.0',
-              label: '一月数据',
-              type: 'object',
+              label: '一月',
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
             },
             {
               key: 'echarts.option.series.0.data.1',
-              label: '二月数据',
-              type: 'object',
+              label: '二月',
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
             },
           ],
           props: {
@@ -126,30 +130,43 @@ export const charts = [
           },
           realTimes: [
             {
-              key: 'echarts.option.series.0.data',
-              label: '数据1',
-              type: 'object',
-            },
-            {
-              key: 'echarts.option.series.1.data',
-              label: '数据2',
-              type: 'object',
-            },
-            {
-              key: 'echarts.option',
-              label: 'echarts',
-              type: 'object',
+              key: 'echarts.option.series.0.data.0',
+              label: '折线一1月',
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
             },
             {
-              key: 'echarts.max',
-              label: '最大数量',
-              type: 'number',
-            },
+              key: 'echarts.option.series.1.data.0',
+              label: '折线二1月',
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
+            },
+            // {
+            //   key: 'echarts.option',
+            //   label: 'echarts',
+            //   type: 'object',
+            // },
+            // {
+            //   key: 'echarts.max',
+            //   label: '最大数量',
+            //   type: 'number',
+            // },
           ],
+          props: {
+            custom: [
+              {
+                key: 'echarts',
+                label: 'echarts',
+                type: 'code',
+              },
+            ],
+          },
         },
       },
       {
-        name: '时间动态数据折线图',
+        name: '动态趋势折线图',
         icon: 'l-line-chart',
         data: {
           name: 'echarts',
@@ -167,7 +184,7 @@ export const charts = [
               },
               xAxis: {
                 type: 'category',
-                data: ['1月', '2月', '3月', '4月', '5月', '6月'],
+                data: [],
               },
               yAxis: {
                 type: 'value',
@@ -175,7 +192,7 @@ export const charts = [
               series: [
                 {
                   type: 'line',
-                  data: [40, 20, 90, 60, 70, 80],
+                  data: [],
                 },
               ],
             },
@@ -183,27 +200,38 @@ export const charts = [
             max: 100,
           },
           realTimes: [
-            {
-              key: 'echarts.option',
-              label: 'echarts',
-              type: 'object',
-            },
+            // {
+            //   key: 'echarts.option',
+            //   label: 'echarts',
+            //   type: 'object',
+            // },
             {
               key: 'echarts.option.series.0.data',
               label: '实时数据',
-              type: 'object',
-            },
-            {
-              key: 'echarts.max',
-              label: '最大数量',
-              type: 'number',
-            },
-            {
-              key: 'echarts.replaceMode',
-              label: '模式',
-              type: 'number',
-            },
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
+            },
+            // {
+            //   key: 'echarts.max',
+            //   label: '最大数量',
+            //   type: 'number',
+            // },
+            // {
+            //   key: 'echarts.replaceMode',
+            //   label: '模式',
+            //   type: 'number',
+            // },
           ],
+          props: {
+            custom: [
+              {
+                key: 'echarts',
+                label: 'echarts',
+                type: 'code',
+              },
+            ],
+          },
         },
       },
     ],
@@ -267,21 +295,39 @@ export const charts = [
           },
           realTimes: [
             {
-              key: 'echarts.option.series.0.data',
-              label: '数据',
-              type: 'object',
-            },
-            {
-              key: 'echarts.option',
-              label: 'echarts',
-              type: 'object',
+              key: 'echarts.option.series.0.data.0',
+              label: '一月',
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
             },
             {
-              key: 'echarts.max',
-              label: '最大数量',
-              type: 'number',
-            },
+              key: 'echarts.option.series.0.data.0',
+              label: '二月',
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
+            },
+            // {
+            //   key: 'echarts.option',
+            //   label: 'echarts',
+            //   type: 'object',
+            // },
+            // {
+            //   key: 'echarts.max',
+            //   label: '最大数量',
+            //   type: 'number',
+            // },
           ],
+          props: {
+            custom: [
+              {
+                key: 'echarts',
+                label: 'echarts',
+                type: 'code',
+              },
+            ],
+          },
         },
       },
       {
@@ -326,26 +372,39 @@ export const charts = [
           },
           realTimes: [
             {
-              key: 'echarts.option.series.0.data',
-              label: '数据1',
-              type: 'object',
-            },
-            {
-              key: 'echarts.option.series.1.data',
-              label: '数据2',
-              type: 'object',
-            },
-            {
-              key: 'echarts.option',
-              label: 'echarts',
-              type: 'object',
+              key: 'echarts.option.series.0.data.0',
+              label: '柱状一1月',
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
             },
             {
-              key: 'echarts.max',
-              label: '最大数量',
-              type: 'number',
-            },
+              key: 'echarts.option.series.1.data.0',
+              label: '柱状二1月',
+              type: 'float',
+              enableMock: true,
+              mock: '0-100',
+            },
+            // {
+            //   key: 'echarts.option',
+            //   label: 'echarts',
+            //   type: 'object',
+            // },
+            // {
+            //   key: 'echarts.max',
+            //   label: '最大数量',
+            //   type: 'number',
+            // },
           ],
+          props: {
+            custom: [
+              {
+                key: 'echarts',
+                label: 'echarts',
+                type: 'code',
+              },
+            ],
+          },
         },
       },
     ],

+ 1 - 1
src/views/components/View.vue

@@ -830,7 +830,7 @@ const open = async (flag: boolean = false) => {
       meta2d.open(JSON.parse(data));
     }
   } else if (!sessionStorage.getItem('opening')) {
-    meta2d.open({ name: '新建项目', pens: [] } as any);
+    meta2d.open({ name: '新建项目', pens: [], enableMock: true } as any);
   }
   sessionStorage.removeItem('opening');
   !meta2d.store.data.x && (meta2d.store.data.x = meta2d.store.options.x || 0);