fangmingyue пре 2 година
родитељ
комит
71e9f73c34

+ 1
- 0
config/index.js Прегледај датотеку

@@ -17,6 +17,7 @@ const config = {
17 17
   copy: {
18 18
     patterns: [
19 19
       { from: 'src/assets/tabbar/', to: 'dist/assets/tabbar/' },
20
+      { from: 'src/assets/ec-canvas/', to: 'dist/assets/ec-canvas/' }, // 指定需要 copy 的目录
20 21
     ],
21 22
     options: {
22 23
     }

+ 1
- 1
config/prod.js Прегледај датотеку

@@ -3,7 +3,7 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
-    HOST: '"http://192.168.89.147:9087"'
6
+    HOST: '"http://localhost:9087"'
7 7
   },
8 8
   mini: {},
9 9
   h5: {

+ 4
- 2
jsconfig.json Прегледај датотеку

@@ -2,7 +2,9 @@
2 2
   "compilerOptions": {
3 3
     "baseUrl": ".",
4 4
     "paths": {
5
-      "@/*": ["./src/*"]
5
+      "@/*": [
6
+        "./src/*"
7
+      ]
6 8
     }
7 9
   }
8
-}
10
+}

+ 36
- 0
package-lock.json Прегледај датотеку

@@ -7226,6 +7226,27 @@
7226 7226
         "safer-buffer": "^2.1.0"
7227 7227
       }
7228 7228
     },
7229
+    "echarts": {
7230
+      "version": "5.4.1",
7231
+      "resolved": "https://registry.npmmirror.com/echarts/-/echarts-5.4.1.tgz",
7232
+      "integrity": "sha512-9ltS3M2JB0w2EhcYjCdmtrJ+6haZcW6acBolMGIuf01Hql1yrIV01L1aRj7jsaaIULJslEP9Z3vKlEmnJaWJVQ==",
7233
+      "requires": {
7234
+        "tslib": "2.3.0",
7235
+        "zrender": "5.4.1"
7236
+      },
7237
+      "dependencies": {
7238
+        "tslib": {
7239
+          "version": "2.3.0",
7240
+          "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
7241
+          "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
7242
+        }
7243
+      }
7244
+    },
7245
+    "echarts-for-weixin": {
7246
+      "version": "1.0.2",
7247
+      "resolved": "https://registry.npmmirror.com/echarts-for-weixin/-/echarts-for-weixin-1.0.2.tgz",
7248
+      "integrity": "sha512-cEk4yFMCJDQpvAgVRKbGvMjXvuW965iEUootJffRFHwJwCq0/GIeoRTTAEuj50PKMMtLTW4DmBPmvPja3sH2jQ=="
7249
+    },
7229 7250
     "ee-first": {
7230 7251
       "version": "1.1.1",
7231 7252
       "resolved": "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz",
@@ -19017,6 +19038,21 @@
19017 19038
       "resolved": "https://registry.npmmirror.com/yocto-queue/-/yocto-queue-0.1.0.tgz",
19018 19039
       "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
19019 19040
       "dev": true
19041
+    },
19042
+    "zrender": {
19043
+      "version": "5.4.1",
19044
+      "resolved": "https://registry.npmmirror.com/zrender/-/zrender-5.4.1.tgz",
19045
+      "integrity": "sha512-M4Z05BHWtajY2241EmMPHglDQAJ1UyHQcYsxDNzD9XLSkPDqMq4bB28v9Pb4mvHnVQ0GxyTklZ/69xCFP6RXBA==",
19046
+      "requires": {
19047
+        "tslib": "2.3.0"
19048
+      },
19049
+      "dependencies": {
19050
+        "tslib": {
19051
+          "version": "2.3.0",
19052
+          "resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
19053
+          "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
19054
+        }
19055
+      }
19020 19056
     }
19021 19057
   }
19022 19058
 }

+ 3
- 1
package.json Прегледај датотеку

@@ -48,9 +48,11 @@
48 48
     "@tarojs/taro": "3.5.7",
49 49
     "@tarojs/taro-h5": "3.5.7",
50 50
     "@zjxpcyc/react-tiny-store": "^2.0.1",
51
+    "echarts-for-weixin": "^1.0.2",
51 52
     "md5": "^2.3.0",
52 53
     "react": "^18.0.0",
53
-    "react-dom": "^18.0.0"
54
+    "react-dom": "^18.0.0",
55
+    "echarts": "5.4.1"
54 56
   },
55 57
   "devDependencies": {
56 58
     "@babel/core": "^7.8.0",

+ 1
- 0
src/app.config.js Прегледај датотеку

@@ -25,6 +25,7 @@ export default defineAppConfig({
25 25
     'pages/notice/edit/index',
26 26
     'pages/my/index',
27 27
     'pages/my/edit/index',
28
+    'pages/statistics/index'
28 29
   ],
29 30
   window: {
30 31
     // backgroundColor: '#1A7565',

+ 265
- 0
src/assets/ec-canvas/ec-canvas.js Прегледај датотеку

@@ -0,0 +1,265 @@
1
+import WxCanvas from './wx-canvas';
2
+import * as echarts from './echarts';
3
+
4
+let ctx;
5
+
6
+function compareVersion(v1, v2) {
7
+  v1 = v1.split('.')
8
+  v2 = v2.split('.')
9
+  const len = Math.max(v1.length, v2.length)
10
+
11
+  while (v1.length < len) {
12
+    v1.push('0')
13
+  }
14
+  while (v2.length < len) {
15
+    v2.push('0')
16
+  }
17
+
18
+  for (let i = 0; i < len; i++) {
19
+    const num1 = parseInt(v1[i])
20
+    const num2 = parseInt(v2[i])
21
+
22
+    if (num1 > num2) {
23
+      return 1
24
+    } else if (num1 < num2) {
25
+      return -1
26
+    }
27
+  }
28
+  return 0
29
+}
30
+
31
+Component({
32
+  properties: {
33
+    canvasId: {
34
+      type: String,
35
+      value: 'ec-canvas'
36
+    },
37
+
38
+    ec: {
39
+      type: Object
40
+    },
41
+
42
+    forceUseOldCanvas: {
43
+      type: Boolean,
44
+      value: false
45
+    }
46
+  },
47
+
48
+  data: {
49
+    isUseNewCanvas: false
50
+  },
51
+
52
+  ready: function () {
53
+    // Disable prograssive because drawImage doesn't support DOM as parameter
54
+    // See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
55
+    echarts.registerPreprocessor(option => {
56
+      if (option && option.series) {
57
+        if (option.series.length > 0) {
58
+          option.series.forEach(series => {
59
+            series.progressive = 0;
60
+          });
61
+        }
62
+        else if (typeof option.series === 'object') {
63
+          option.series.progressive = 0;
64
+        }
65
+      }
66
+    });
67
+
68
+    if (!this.data.ec) {
69
+      console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" '
70
+        + 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>');
71
+      return;
72
+    }
73
+
74
+    if (!this.data.ec.lazyLoad) {
75
+      this.init();
76
+    }
77
+  },
78
+
79
+  methods: {
80
+    init: function (callback) {
81
+      const version = wx.getSystemInfoSync().SDKVersion
82
+
83
+      const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0;
84
+      const forceUseOldCanvas = this.data.forceUseOldCanvas;
85
+      const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas;
86
+      this.setData({ isUseNewCanvas });
87
+
88
+      if (forceUseOldCanvas && canUseNewCanvas) {
89
+        console.warn('开发者强制使用旧canvas,建议关闭');
90
+      }
91
+
92
+      if (isUseNewCanvas) {
93
+        // console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>');
94
+        // 2.9.0 可以使用 <canvas type="2d"></canvas>
95
+        this.initByNewWay(callback);
96
+      } else {
97
+        const isValid = compareVersion(version, '1.9.91') >= 0
98
+        if (!isValid) {
99
+          console.error('微信基础库版本过低,需大于等于 1.9.91。'
100
+            + '参见:https://github.com/ecomfe/echarts-for-weixin'
101
+            + '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82');
102
+          return;
103
+        } else {
104
+          console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能');
105
+          this.initByOldWay(callback);
106
+        }
107
+      }
108
+    },
109
+
110
+    initByOldWay(callback) {
111
+      // 1.9.91 <= version < 2.9.0:原来的方式初始化
112
+      ctx = wx.createCanvasContext(this.data.canvasId, this);
113
+      const canvas = new WxCanvas(ctx, this.data.canvasId, false);
114
+
115
+      echarts.setCanvasCreator(() => {
116
+        return canvas;
117
+      });
118
+      // const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr
119
+      const canvasDpr = 1
120
+      var query = wx.createSelectorQuery().in(this);
121
+      query.select('.ec-canvas').boundingClientRect(res => {
122
+        if (typeof callback === 'function') {
123
+          this.chart = callback(canvas, res.width, res.height, canvasDpr);
124
+        }
125
+        else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
126
+          this.chart = this.data.ec.onInit(canvas, res.width, res.height, canvasDpr);
127
+        }
128
+        else {
129
+          this.triggerEvent('init', {
130
+            canvas: canvas,
131
+            width: res.width,
132
+            height: res.height,
133
+            canvasDpr: canvasDpr // 增加了dpr,可方便外面echarts.init
134
+          });
135
+        }
136
+      }).exec();
137
+    },
138
+
139
+    initByNewWay(callback) {
140
+      // version >= 2.9.0:使用新的方式初始化
141
+      const query = wx.createSelectorQuery().in(this)
142
+      query
143
+        .select('.ec-canvas')
144
+        .fields({ node: true, size: true })
145
+        .exec(res => {
146
+          const canvasNode = res[0].node
147
+          this.canvasNode = canvasNode
148
+
149
+          const canvasDpr = wx.getSystemInfoSync().pixelRatio
150
+          const canvasWidth = res[0].width
151
+          const canvasHeight = res[0].height
152
+
153
+          const ctx = canvasNode.getContext('2d')
154
+
155
+          const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode)
156
+          echarts.setCanvasCreator(() => {
157
+            return canvas
158
+          })
159
+
160
+          if (typeof callback === 'function') {
161
+            this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr)
162
+          } else if (this.data.ec && typeof this.data.ec.onInit === 'function') {
163
+            this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr)
164
+          } else {
165
+            this.triggerEvent('init', {
166
+              canvas: canvas,
167
+              width: canvasWidth,
168
+              height: canvasHeight,
169
+              dpr: canvasDpr
170
+            })
171
+          }
172
+        })
173
+    },
174
+    canvasToTempFilePath(opt) {
175
+      if (this.data.isUseNewCanvas) {
176
+        // 新版
177
+        const query = wx.createSelectorQuery().in(this)
178
+        query
179
+          .select('.ec-canvas')
180
+          .fields({ node: true, size: true })
181
+          .exec(res => {
182
+            const canvasNode = res[0].node
183
+            opt.canvas = canvasNode
184
+            wx.canvasToTempFilePath(opt)
185
+          })
186
+      } else {
187
+        // 旧的
188
+        if (!opt.canvasId) {
189
+          opt.canvasId = this.data.canvasId;
190
+        }
191
+        ctx.draw(true, () => {
192
+          wx.canvasToTempFilePath(opt, this);
193
+        });
194
+      }
195
+    },
196
+
197
+    touchStart(e) {
198
+      if (this.chart && e.touches.length > 0) {
199
+        var touch = e.touches[0];
200
+        var handler = this.chart.getZr().handler;
201
+        handler.dispatch('mousedown', {
202
+          zrX: touch.x,
203
+          zrY: touch.y,
204
+          preventDefault: () => {},
205
+          stopImmediatePropagation: () => {},
206
+          stopPropagation: () => {}
207
+        });
208
+        handler.dispatch('mousemove', {
209
+          zrX: touch.x,
210
+          zrY: touch.y,
211
+          preventDefault: () => {},
212
+          stopImmediatePropagation: () => {},
213
+          stopPropagation: () => {}
214
+        });
215
+        handler.processGesture(wrapTouch(e), 'start');
216
+      }
217
+    },
218
+
219
+    touchMove(e) {
220
+      if (this.chart && e.touches.length > 0) {
221
+        var touch = e.touches[0];
222
+        var handler = this.chart.getZr().handler;
223
+        handler.dispatch('mousemove', {
224
+          zrX: touch.x,
225
+          zrY: touch.y,
226
+          preventDefault: () => {},
227
+          stopImmediatePropagation: () => {},
228
+          stopPropagation: () => {}
229
+        });
230
+        handler.processGesture(wrapTouch(e), 'change');
231
+      }
232
+    },
233
+
234
+    touchEnd(e) {
235
+      if (this.chart) {
236
+        const touch = e.changedTouches ? e.changedTouches[0] : {};
237
+        var handler = this.chart.getZr().handler;
238
+        handler.dispatch('mouseup', {
239
+          zrX: touch.x,
240
+          zrY: touch.y,
241
+          preventDefault: () => {},
242
+          stopImmediatePropagation: () => {},
243
+          stopPropagation: () => {}
244
+        });
245
+        handler.dispatch('click', {
246
+          zrX: touch.x,
247
+          zrY: touch.y,
248
+          preventDefault: () => {},
249
+          stopImmediatePropagation: () => {},
250
+          stopPropagation: () => {}
251
+        });
252
+        handler.processGesture(wrapTouch(e), 'end');
253
+      }
254
+    }
255
+  }
256
+});
257
+
258
+function wrapTouch(event) {
259
+  for (let i = 0; i < event.touches.length; ++i) {
260
+    const touch = event.touches[i];
261
+    touch.offsetX = touch.x;
262
+    touch.offsetY = touch.y;
263
+  }
264
+  return event;
265
+}

+ 4
- 0
src/assets/ec-canvas/ec-canvas.json Прегледај датотеку

@@ -0,0 +1,4 @@
1
+{
2
+  "component": true,
3
+  "usingComponents": {}
4
+}

+ 4
- 0
src/assets/ec-canvas/ec-canvas.wxml Прегледај датотеку

@@ -0,0 +1,4 @@
1
+<!-- 新的:接口对其了H5 -->
2
+<canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
3
+<!-- 旧的 -->
4
+<canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>

+ 4
- 0
src/assets/ec-canvas/ec-canvas.wxss Прегледај датотеку

@@ -0,0 +1,4 @@
1
+.ec-canvas {
2
+  width: 100%;
3
+  height: 100%;
4
+}

+ 45
- 0
src/assets/ec-canvas/echarts.js
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку


+ 111
- 0
src/assets/ec-canvas/wx-canvas.js Прегледај датотеку

@@ -0,0 +1,111 @@
1
+export default class WxCanvas {
2
+  constructor(ctx, canvasId, isNew, canvasNode) {
3
+    this.ctx = ctx;
4
+    this.canvasId = canvasId;
5
+    this.chart = null;
6
+    this.isNew = isNew
7
+    if (isNew) {
8
+      this.canvasNode = canvasNode;
9
+    }
10
+    else {
11
+      this._initStyle(ctx);
12
+    }
13
+
14
+    // this._initCanvas(zrender, ctx);
15
+
16
+    this._initEvent();
17
+  }
18
+
19
+  getContext(contextType) {
20
+    if (contextType === '2d') {
21
+      return this.ctx;
22
+    }
23
+  }
24
+
25
+  // canvasToTempFilePath(opt) {
26
+  //   if (!opt.canvasId) {
27
+  //     opt.canvasId = this.canvasId;
28
+  //   }
29
+  //   return wx.canvasToTempFilePath(opt, this);
30
+  // }
31
+
32
+  setChart(chart) {
33
+    this.chart = chart;
34
+  }
35
+
36
+  addEventListener() {
37
+    // noop
38
+  }
39
+
40
+  attachEvent() {
41
+    // noop
42
+  }
43
+
44
+  detachEvent() {
45
+    // noop
46
+  }
47
+
48
+  _initCanvas(zrender, ctx) {
49
+    zrender.util.getContext = function () {
50
+      return ctx;
51
+    };
52
+
53
+    zrender.util.$override('measureText', function (text, font) {
54
+      ctx.font = font || '12px sans-serif';
55
+      return ctx.measureText(text);
56
+    });
57
+  }
58
+
59
+  _initStyle(ctx) {
60
+    ctx.createRadialGradient = () => {
61
+      return ctx.createCircularGradient(arguments);
62
+    };
63
+  }
64
+
65
+  _initEvent() {
66
+    this.event = {};
67
+    const eventNames = [{
68
+      wxName: 'touchStart',
69
+      ecName: 'mousedown'
70
+    }, {
71
+      wxName: 'touchMove',
72
+      ecName: 'mousemove'
73
+    }, {
74
+      wxName: 'touchEnd',
75
+      ecName: 'mouseup'
76
+    }, {
77
+      wxName: 'touchEnd',
78
+      ecName: 'click'
79
+    }];
80
+    eventNames.forEach(name => {
81
+      this.event[name.wxName] = e => {
82
+        const touch = e.touches[0];
83
+        this.chart.getZr().handler.dispatch(name.ecName, {
84
+          zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
85
+          zrY: name.wxName === 'tap' ? touch.clientY : touch.y,
86
+          preventDefault: () => {},
87
+          stopImmediatePropagation: () => {},
88
+          stopPropagation: () => {}
89
+        });
90
+      };
91
+    });
92
+  }
93
+
94
+  set width(w) {
95
+    if (this.canvasNode) this.canvasNode.width = w
96
+  }
97
+  set height(h) {
98
+    if (this.canvasNode) this.canvasNode.height = h
99
+  }
100
+
101
+  get width() {
102
+    if (this.canvasNode)
103
+      return this.canvasNode.width
104
+    return 0
105
+  }
106
+  get height() {
107
+    if (this.canvasNode)
108
+      return this.canvasNode.height
109
+    return 0
110
+  }
111
+}

+ 2
- 1
src/layouts/TabBar.jsx Прегледај датотеку

@@ -54,7 +54,8 @@ const mine = {
54 54
   label: '我的',
55 55
   icon: mineIcon,
56 56
   activeIcon: mineActiveIcon,
57
-  page: '/pages/my/index'
57
+  // page: '/pages/my/index'
58
+  page: '/pages/statistics/index'
58 59
 }
59 60
 
60 61
 export default (props) => {

+ 3
- 3
src/pages/my/components/Notice.jsx Прегледај датотеку

@@ -13,9 +13,9 @@ export default (props) => {
13 13
   }
14 14
 
15 15
   return (
16
-    <View className="wrapper-middle-box" onClick={onClick}>
17
-      <Image className="wrapper-middle-img" src={smallbell} />
18
-      <View className="wrapper-middle-text3">消息通知</View>
16
+    <View className={style['wrapper-middle-box']} onClick={onClick}>
17
+      <Image className={style['wrapper-middle-img']} src={smallbell} />
18
+      <View className={style['wrapper-middle-text3']}>消息通知</View>
19 19
     </View>
20 20
   )
21 21
 }

+ 9
- 8
src/pages/my/components/notice.module.less Прегледај датотеку

@@ -4,12 +4,13 @@
4 4
   display: grid;
5 5
   place-items: center;
6 6
   margin-bottom: 20px;
7
-}
8
-.wrapper-middle-img {
9
-  width: 120px;
10
-  height: 120px;
11
-}
12
-.wrapper-middle-text3 {
13
-  font-size: 32px;
14
-  margin-bottom: 34px;
7
+
8
+  .wrapper-middle-img {
9
+    width: 120px;
10
+    height: 120px;
11
+  }
12
+  .wrapper-middle-text3 {
13
+    font-size: 32px;
14
+    margin-bottom: 36px;
15
+  }
15 16
 }

+ 6
- 0
src/pages/statistics/index.config.js Прегледај датотеку

@@ -0,0 +1,6 @@
1
+export default definePageConfig({
2
+  navigationBarTitleText: '数据统计',
3
+  usingComponents: {
4
+    'ec-canvas': '../../assets/ec-canvas/ec-canvas'
5
+  }
6
+})

+ 95
- 0
src/pages/statistics/index.jsx Прегледај датотеку

@@ -0,0 +1,95 @@
1
+import React from 'react';
2
+import Page from '@/layouts/index';
3
+import { Cell, CellGroup } from '@antmjs/vantui'
4
+import { View } from '@tarojs/components';
5
+// import * as echarts from "echarts"
6
+import * as echarts from '@/assets/ec-canvas/echarts';
7
+import './index.less';
8
+
9
+export default (props) => {
10
+
11
+  function initChart (canvas, width, height, dpr) {
12
+
13
+    console.log('---------->', canvas, width, height)
14
+
15
+    const chart = echarts.init(canvas, null, {
16
+      width: width,
17
+      height: height,
18
+      devicePixelRatio: dpr // new
19
+    });
20
+    canvas.setChart(chart);
21
+
22
+    var option = {
23
+      title: {
24
+        text: '上报统计'
25
+      },
26
+      grid: {
27
+        containLabel: true
28
+      },
29
+      tooltip: {
30
+        show: true,
31
+        trigger: 'axis'
32
+      },
33
+      xAxis: {
34
+        type: 'category',
35
+        boundaryGap: false,
36
+        data: ['12/01', '12/02', '12/03', '12/04', '12/05', '12/06', '12/07'],
37
+        // show: false
38
+      },
39
+      yAxis: {
40
+        x: 'center',
41
+        type: 'value',
42
+        // show: false
43
+      },
44
+      series: [
45
+        {
46
+          name: 'Line 1',
47
+          type: 'line',
48
+          stack: 'Total',
49
+          smooth: true,
50
+          lineStyle: {
51
+            width: 0
52
+          },
53
+          showSymbol: false,
54
+          areaStyle: {
55
+            opacity: 0.8,
56
+            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
57
+              {
58
+                offset: 0,
59
+                color: 'rgb(128, 255, 165)'
60
+              },
61
+              {
62
+                offset: 1,
63
+                color: 'rgb(1, 191, 236)'
64
+              }
65
+            ])
66
+          },
67
+          emphasis: {
68
+            focus: 'series'
69
+          },
70
+          data: [180, 332, 191, 294, 210, 151, 230]
71
+        }
72
+      ]
73
+    };
74
+
75
+    chart.setOption(option);
76
+    return chart;
77
+  }
78
+
79
+  const ec = {
80
+    onInit: initChart
81
+  };
82
+
83
+  return (
84
+    <Page>
85
+      <View>
86
+        <CellGroup>
87
+          <Cell title="时间维度" isLink value="本周" />
88
+        </CellGroup>
89
+      </View>
90
+      <view class="container" style={{ height: '500px' }}>
91
+        <ec-canvas canvasId="mychart-bar" ec={ec}></ec-canvas>
92
+      </view>
93
+    </Page>
94
+  )
95
+}

+ 0
- 0
src/pages/statistics/index.less Прегледај датотеку