import * as echarts from '../ec-canvas/echarts' import { mergeOptions } from '../ec-canvas/defaultOption' import CensusApi from '../../../apis/census' Component({ /** * 组件的属性列表 */ properties: { sceneNum: { type: String, observer: function (val) { if (!this.properties.date || !this.properties.sceneNum) return; CensusApi.getSceneCensus({date: this.properties.date, sceneNum: val}) } }, date: { type: String, observer: function (val) { if (!this.properties.date || !this.properties.sceneNum) return; CensusApi.getSceneCensus({date: val, sceneNum: this.properties.sceneNum}) } }, }, /** * 组件的初始数据 */ data: { ec: { onInit: initChart }, dataNumList: [ { value: 20, label: '展位浏览量', key: 'goods_num', bgColor: 'rgba(115,142,254,0.1)', color: '#738EFE' }, { value: 20, label: '客户访问量', key: 'video_num', bgColor: 'rgba(77,174,255,0.1)', color: '#4DAEFF' }, { value: 20, label: '商务询盘量', bgColor: 'rgba(23,210,210,0.1)', color: '#17D2D2' }, { value: 20, label: '展位商品数', bgColor: 'rgba(246,151,88,0.1)', color: '#F69758' } ] }, lifetimes: { }, ready () { }, methods: { } }) function initChart(canvas, width, height, dpr) { const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr // new }); canvas.setChart(chart); var option = { title: { text: '场景浏览数据' }, series: [ { data: [[0, 1000], [3, 500], [6, 750], [9, 1400], [12, 1250], [15, 1600], [18, 1800]], type: 'line', smooth: true, name: '主页访问量', symbolSize: 0 }, ] }; chart.setOption(mergeOptions(option)); return chart; }