<template>
<div>
<div id="main" style="width: 600px;height:400px;"></div>
</div>
</template>
<script>
import * as echarts from "echarts";
export default {
name: "WorkspaceJsonApp",
data() {
return {
option: {
title: {
text: "世界人口总量",
subtext: "数据来自网络"
},
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow"
}
},
legend: {
data: ["2011年"]
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true
},
xAxis: {
type: "value",
boundaryGap: [0, 0.01]
},
yAxis: {
type: "category",
data: ["巴西"]
},
series: [
{
name: "2011年",
type: "bar",
data: [
{
bmid: 3,
num: 1,
value: 6000
}
]
}
]
}
};
},
mounted() {
this.myChart = echarts.init(document.getElementById("main"));
this.myChart.setOption(this.option);
this.myChart.on("click", function(params) {
console.log(params);
});
},
methods: {}
};
</script>
<style scoped>
.my-swipe .van-swipe-item {
color: #fff;
font-size: 20px;
line-height: 150px;
text-align: center;
background-color: #39a9ed;
}
</style>```
|