引入mpvue-echarts图表组件页面无显示也无报错。
根据社区uni-app引用npm第三方库(http://ask.dcloud.net.cn/article/19727?item_id=16985)的案例操作,页面无任何作用。
代码如下:
<template>
<view class="container">
<mpvue-echarts :echarts="echarts" :onInit="lineInit" canvasId="gauge" ref="lineOption" />
</view>
</template>
<script>
import * as echarts from 'echarts'
import mpvueEcharts from 'mpvue-echarts'
function initChart(canvas, width, height) {
let chart = echarts.init(canvas, null, {
width: width,
height: height
})
canvas.setChart(chart)
var lineOption = {
tooltip : {
formatter: "{a} <br/>{b} : {c}%"
},
toolbox: {
feature: {
restore: {},
saveAsImage: {}
}
},
series: [
{
name: '业务指标',
type: 'gauge',
detail: {formatter:'{value}%'},
data: [{value: 50, name: '完成率'}]
}
]
}
chart.setOption(lineOption)
return chart
}
export default {
data() {
return {
echarts,
lineInit: initChart
}
},
methods: {
},
components: {
mpvueEcharts
}
}
</script>
<style scoped>
.container {
flex: 1;
}
</style>
8***@qq.com (作者)
示例也没用,type设置为pie就可以,设置为gauge就一直报错,说未加载gauge。
2019-03-18 17:25
4***@qq.com
uchart 奇丑无比 功能不全
2020-12-23 10:20