子组件

<template>
<div>
<div id="myChart" :style="{width: '400px', height: '450px'}"></div>
</div>
</template>
<script>
export default {
data () {
return {
msg: ''
}
},
props:['houseStyle'],
mounted () {
this.drawLine()
console.log(this.houseStyle)
},
methods: {
drawLine () {
// 基于准备好的dom, 初始化echarts
let myChart = this.$echarts.init(document.getElementById('myChart'))
// 绘制图表
myChart.setOption({
title: {},
grid: {
left: '1%',
bottom: '5%',
containLabel: true
} ,
tooltip: {},
xAxis: {
type : 'category',
data: ['商务办公用房','门面房','办公用房','集体宿舍','公租房','学生房'],
axisTick: {
alignWithLabel: true
},
axisLabel:{
interval:0,//横轴信息全部显示
rotate:-30,//-30度角倾斜显示
}
},
yAxis : [
{
type : 'value'
}
],
series: [{
type: 'bar',
barWidth: '50%',
data: [{
value:this.houseStyle[0],
itemStyle:{
color:'#4383C9'
}
},
{
value:this.houseStyle[1],
itemStyle:{
color:'#7B5BAA'
}
},
{
value:this.houseStyle[2],
itemStyle:{
color:'#BA6329'
}
},
{
value:this.houseStyle[3],
itemStyle:{
color:'#B92E2E'
}
},
{
value:this.houseStyle[4],
itemStyle:{
color:'#6E8C34'
}
},
{
value:this.houseStyle[5],
itemStyle:{
color:'#21A579'
}
}]
}]
})
}
},
watch:{
houseStyle:{
handler(val,oldval){
this.houseStyle=val
this.drawLine ()
},
deep:true
}
}
}
</script>

  父组件

<EchartZx :houseStyle="openhouseStyle"></EchartZx>

  (房屋管理)

vue中使用柱状图的更多相关文章

  1. 在vue中使用echarts图表

    在vue中使用echarts图表   转载请注明出处:https://www.cnblogs.com/wenjunwei/p/9815290.html 安装vue依赖 使用npm npm instal ...

  2. vue中监听window.resize的变化

    我只想说每个人遇到的bug真的不能一概而论,解决办法也会有不同.在vue中使用echarts的时候,会想要实现window.resize窗体变化大小的时候让图形大小跟着变化.实现的过程中各种bug,也 ...

  3. echarts在vue中使用的感悟

    echarts在vue中使用的感悟 echarts作为图表展示的强大存在,每当使用后台系统,或多或少都会使用到,但是作为菜鸟的我,则是一路采坑,各种头大,比比皆是,为了避免下次再犯同样的错误,特意记录 ...

  4. Echars -- 在Vue中如何使用Echars

    在vue-cli项目中使用echarts -->Wangqi   这个示例使用 vue-cli 脚手架搭建 安装echarts依赖 npm install echarts -S 或者使用国内的淘 ...

  5. vue 中使用echarts

    前言:在vue2.0中使用百度echarts有三种解决方案. 一.原始方法直接使用 这样每次都要获取图表dom元素 然后通过setOption渲染数据,最后在mounted中初始化.很麻烦. < ...

  6. 在Vue中echarts可视化组件的使用

    echarts组件官网地址:https://echarts.apache.org/examples/zh/index.html 1.找到脚手架项目所在地址,执行cnpm install echarts ...

  7. vue中如何不通过路由直接获取url中的参数

    前言:为什么要不通过路由直接获取url中的参数? vue中使用路由的方式设置url参数,但是这种方式必须要在路径中附带参数,而且这个参数是需要在vue的路由中提前设置好的. 相对来说,在某些情况下直接 ...

  8. vue中的重要特性

    一.vue中的自定义组件 html的代码: <!DOCTYPE html> <html lang="en"> <head> <meta c ...

  9. Vue中comoputed中的数据绑定

    Vue中的数据实现响应式绑定是在初始化的时候利用definePrototype的定义set和get过滤器,在进行组件模板编译时实现water的监听搜集依赖项,当数据发生变化时在set中通过调用dep. ...

随机推荐

  1. python7.4邮件发送

  2. [vue]子组件通过props获取父组件数据以及使用watch解决动态数据不生效问题

    父子组件的传值,在Vue官方也写得很清楚,父组件中使用v-bind绑定传送,子组件使用props接收. 父组件通过v-bind绑定数据: <template> <router-vie ...

  3. python关于函数调用作为参数的说明&&装饰器

    python关于函数调用作为参数的说明&&装饰器 简单的: 先看代码: def out(): print('out') def inner(): return 'inner' retu ...

  4. CompletableFuture异步线程

    1.线程池七大参数介绍 (1)corePoolSize:线程池中常驻核心线程数 (2)maximumPoolSize:线程池能够容纳同时执行的最大线程数,此值必须大于等于1 (3)keepAliveT ...

  5. C++ STL sort 函数的用法

    sort 在 STL 库中是排序函数,有时冒泡.选择等 $\mathcal O(n^2)$ 算法会超时时,我们可以使用 STL 中的快速排序函数 $\mathcal O(n \ log \ n)$ 完 ...

  6. 火题大战Vol.1 A.

    火题大战Vol.1 A. 题目描述 给定两个数\(x\),\(y\),比较\(x^y\) 与\(y!\)的大小. 输入格式 第一行一个整数\(T\)表示数据组数. 接下来\(T\)行,每行两个整数\( ...

  7. Oracle数据库安装教程

    一.准备文件 Oracle安装程序(64位)下载地址: http://download.oracle.com/otn/nt/oracle11g/112010/win64_11gR2_database_ ...

  8. MIT 6.828 Lab04 : Preemptive Multitasking

    目录 Part A:Multiprocessor Support and Cooperative Multitasking Multiprocessor Support 虚拟内存图 Exercise ...

  9. IDEA的externel tool配置Javap -c 命令

    1.ctrl+alt+s打开设置界面,找到Tool-> External Tools 点击 +来增加一个新的外部工具. 在tool setting 的Program输入工具的路径,可以插入宏,比 ...

  10. 为什么 java.util.Stack不被官方所推荐使用!

    Java 为什么不推荐使用 Stack 呢? 因为 Stack 是 JDK 1.0 的产物.它继承自 Vector,Vector 都不被推荐使用了,你说 Stack 还会被推荐吗? 当初 JDK1.0 ...