import * as echarts from '../../components/ec-canvas/echarts' let chart = null Page({ data: { studentdata: { lazyLoad: true }, //折线图 subject: '', term: [], point: [] }, onLoad: function () { this.echartsComponnet = this.selectComponent('#mathtest'); this.getData(); //获取数据 }, getData: function () { this.setData({ subject: '数学', term: [1, 2, 3, 4, 5, 6, ], point: [123, 125, 145, 136, 124, 142] }), this.initChart() }, initChart: function () { this.echartsComponnet.init((canvas, width, height) => { const Chart = echarts.init(canvas, null, { width: width, height: height }) Chart.setOption(this.getOption()) return Chart }) }, getOption: function () { return { title: { left:'center', show:true, text:'数学' //this.data.subject, }, xAxis: { name:'学期', data: this.data.term }, yAxis: { name:'分数', type: 'value' }, series: [{ data: this.data.point, type: 'line' }] } } })
请问为什么我用echarts做的图像不显示标题啊?[图片]
2022-02-17