榆山数据端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.5 KiB

// @ts-ignore
import * as echarts from '../../../../../../components/ec-canvas/echarts.js'
import {PeopleChart1,getPeopleChart2} from '../../../../utils/echarts'
Component({
/**
*
*/
properties: {
},
/**
*
*/
data: {
ecA: {
lazyLoad: true
},
ecB: {
lazyLoad: true
},
colorData: ["#FFC600", "#29B9A5"],
chartsData:[{ name: '好好', value: '20' }, { name: '好', value: '30' }],
colorData2:['#AD6DFE', '#FFA270'],
chartsData2: [{ name: '好好', value: '20' }, { name: '好', value: '30' }]
},
lifetimes: {
attached() {
// @ts-ignore
this.ecComponentA = this.selectComponent('#mychart-dom-bar')
// @ts-ignore
this.ecComponentB = this.selectComponent('#mychart-dom-pie')
this.initA()
this.initB()
}
},
methods: {
// 点击按钮后初始化图表
initA () {
// @ts-ignore
this.ecComponentA.init((canvas: any, width: any, height: any) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
})
PeopleChart1(chart,this.data.colorData,this.data.chartsData)
return chart
})
},
initB () {
// @ts-ignore
this.ecComponentB.init((canvas: any, width: any, height: any) => {
const chart = echarts.init(canvas, null, {
width: width,
height: height
})
getPeopleChart2(chart,this.data.colorData2,this.data.chartsData2)
return chart
})
},
}
})