3 changed files with 52 additions and 34 deletions
@ -1,48 +1,65 @@ |
|||||
<template> |
<template> |
||||
<view> <view id="myChart" :style="{ width: '300px', height: '300px' }" ref="aaa"></view> </view> |
<view style="width: 100%; height: 500rpx"><l-echart ref="chart"></l-echart></view> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
// 引入基本模板 |
// import * as echarts from 'components/l-echart/echarts'; |
||||
let echarts = require('echarts/lib/echarts'); |
|
||||
// 引入柱状图组件 |
|
||||
require('echarts/lib/chart/bar'); |
|
||||
// 引入提示框和title组件 |
|
||||
require('echarts/lib/component/tooltip'); |
|
||||
require('echarts/lib/component/title'); |
|
||||
|
|
||||
export default { |
export default { |
||||
name: 'hello', |
|
||||
|
|
||||
data() { |
data() { |
||||
return { msg: 'Welcome to Your Vue.js App' }; |
return { |
||||
}, |
option: { |
||||
|
radar: [ |
||||
mounted() { |
{ |
||||
// this.drawLine(); |
indicator: [ |
||||
|
{ text: '记忆力', max: 1 }, |
||||
|
{ text: '语言能力', max: 1 }, |
||||
|
{ text: '视空间', max: 1 }, |
||||
|
{ text: '注意力', max: 1 }, |
||||
|
{ text: '定向力', max: 1 }, |
||||
|
{ text: '计算能力', max: 1 }, |
||||
|
{ text: '逻辑执行', max: 1 }, |
||||
|
], |
||||
|
radius: 80, |
||||
}, |
}, |
||||
|
], |
||||
methods: { |
|
||||
drawLine() { |
|
||||
// 基于准备好的dom,初始化echarts实例 |
|
||||
let myChart = echarts.init(document.getElementById('myChart')); |
|
||||
// 绘制图表 |
|
||||
myChart.setOption({ |
|
||||
title: { text: 'ECharts 入门示例' }, |
|
||||
tooltip: {}, |
|
||||
xAxis: { data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'] }, |
|
||||
yAxis: {}, |
|
||||
series: [ |
series: [ |
||||
{ |
{ |
||||
name: '销量', |
type: 'radar', |
||||
type: 'bar', |
tooltip: { trigger: 'item' }, |
||||
data: [5, 20, 36, 10, 10, 20], |
areaStyle: {}, |
||||
|
data: [ |
||||
|
{ |
||||
|
value: [0.85, 0.65, 0.62, 0.71, 0.45, 0.55, 0.67], |
||||
|
name: 'A Software', |
||||
|
symbolSize: 5, |
||||
|
areaStyle: { color: 'rgba(24,144,255,.3)' }, |
||||
|
lineStyle: { color: '#1da5ff' }, |
||||
|
itemStyle: { color: '#1890ff' }, |
||||
|
}, |
||||
|
], |
||||
}, |
}, |
||||
], |
], |
||||
}); |
|
||||
}, |
}, |
||||
|
}; |
||||
|
}, |
||||
|
mounted() { |
||||
|
// this.$refs.chart.init(config => { |
||||
|
// const { canvas } = config; |
||||
|
// const chart = echarts.init(canvas, null, config); |
||||
|
// canvas.setChart(chart); |
||||
|
// chart.setOption(this.option); |
||||
|
// // 需要把 chart 返回 |
||||
|
// return chart; |
||||
|
// }); |
||||
}, |
}, |
||||
}; |
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style></style> |
<style> |
||||
|
.uni-ec-canvas { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
display: block; |
||||
|
} |
||||
|
</style> |
||||
|
|||||
Loading…
Reference in new issue