import * as echarts from '../../ec-canvas/echarts';
let chart = null;
function initChart(canvas, width, height, dpr) {
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr
});
canvas.setChart(chart);
console.log(canvas)
var option = {
tooltip: {
animation: true,
trigger: 'axis',
formatter:`{b0}
{c0}分`
},
xAxis: {
type: 'category',
data: ['09/05 13:00', '09/05 14:00', '09/05 15:00', '09/05 16:00', '09/05 17:00', '09/05 18:00', '09/05 19:00']
},
yAxis: {
type: 'value'
},
series: [{
data: [6, 4, 2, 0, -2, -4, -6],
type: 'line'
}]
};
chart.setOption(option);
return chart;
}
Page({
data: {
ec: {
onInit: initChart
}
},
onLoad(){},
onReady(){
},
});
<view class="container">
<ec-canvas id="mychart-dom-bar" style="width:800rpx;height:800rpx;" canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>
</view>
微信有个echarts的插件