第一步:获取dpr
const getPixelRatio = () => {
let pixelRatio = 0
wx.getSystemInfo({
success: function (res) {
pixelRatio = res.pixelRatio
},
fail: function () {
pixelRatio = 0
}
})
return pixelRatio
}
var dpr = getPixelRatio()
第二步:在echarts初始化时设置dpr
function initChart(canvas, width, height) {
chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio:dpr /////这里设置 =====================///
});
var option = [];
canvas.setChart(chart);
//chart.setOption(option);
return chart;
}