vue画图运用echarts
2024-09-04 00:55:47
<template>
<div class="tubiao">
<div id="main" style="width: 600px;height:400px;"></div>
</div>
</template> <script>
import echarts from 'echarts';
export default {
name: 'tubiao',
data () {
return {
chart: null
}
},
methods:{
drawPie (id) {
this.chart = echarts.init(document.getElementById('main'));
this.chart.setOption({
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
})
}
},
mounted(){
this.$nextTick(function() {
this.drawPie('main');
var that = this;
var resizeTimer = null;
window.onresize = function() {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
that.drawPie('main');
}, 100);
}
});
}
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> </style>
先进行安装echarts,
然后在根据echarts官网的提示例子,进行开发练手,
最后就是配置一下路由,进行页面的跳转。
更多更好的效果,可以再echarts官网查看。
最新文章
- Disque:Redis之父新开源的分布式内存作业队列
- Spring Boot下配置MyBatis多数据源
- delegate用法
- office2003-2007 绿色版 出错 文件丢失(未解决)
- Scala 深入浅出实战经典 第47讲:Scala多重界定代码实战及其在Spark中的应用
- [NOIP2008] 提高组 洛谷P1006 传纸条
- 分享:shell去掉linux配置文件的注释行
- STORM_0010_Message passing implementation/消息传递的实现
- js自定义弹窗
- 张艾迪(创始人):拥抱单身与自由的Eidyzhang
- hive 子查询特别分析
- IOS_OC_本地推送知识总结
- CENTOS 挂载硬盘
- Dynamics CRM The difference between UserId and InitiatingUserId in Plugin
- LeetCode 单链表专题 (一)
- Linux环境下虚拟环境virtualenv安装和使用
- 《笨方法学Python》加分题28
- optimize PHP-FPM优化
- 如何让微信里的html应用弹出“点击右上角分享到朋友圈”的图片
- select 与 time.After 配合使用的问题
热门文章
- 网络初级篇之VLAN间路由(原理与配置)
- 8.9.网络编程_Socket 远程调用机制
- [Nginx]子目录反向代理kibana并添加basic认证
- 【JAVASCRIPT】call和apply的用法以及区别
- Ubuntu 18.04 启动太慢不能忍
- 查看ocx控件CLSID的方法(转载)
- 【leetcode】1283. Find the Smallest Divisor Given a Threshold
- 1、Socket通信
- WPF程序发布有关事项
- @RequestMapping的简单理解