首页 > 其他分享 >柱状图

柱状图

时间:2023-02-13 20:14:37浏览次数:35  
标签:color data barChart 柱状图 type echarts 255

<!--柱状图-->
<template>
<div class="chartBox">
<!--echart图标-->
<div id="barChart" ref="barChart"></div>
</div>

</template>

<script>
// 引入基本模板
// const echarts = require('echarts');
import * as echarts from 'echarts' // 注意此处echarts高版本中需要使用此方式才可引入
export default {
props: {},
data() {
return {
barChart: null,
}
},
mounted() {
this.initEchart();

},
methods: {
initEchart() {
// 基于准备好的dom,初始化echarts实例
this.barChart = echarts.init(this.$refs.barChart);

let option = {
grid: {
left: '0',
bottom: '20',
top: '60',
right: 0,
containLabel: true
},
tooltip: {
trigger: 'item'
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisLine: {
lineStyle: {
color: 'rgba(255,255,255,0.2)'
}
},
axisLabel: {
interval: 0,
// rotate:-30,
textStyle: {
color: '#FFF',
fontSize: 12
}
}
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: 'rgba(255,255,255,0.2)'//横线颜色
}

},
axisLabel: {
interval: 0,
// rotate:-30,
textStyle: {
color: '#FFF',
fontSize: 12
}
}
},
color: 'rgb(97, 165, 232)',
series: [
{
data: [120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130],
type: 'bar',

}
]
};

// 使用刚指定的配置项和数据显示图表。
this.barChart.setOption(option);
}
}
}
</script>

<style lang="scss" scoped>
.chartBox {
width: 100%;
box-sizing: border-box;
padding: 1.6rem 1.6rem 0;
flex: 1;

#barChart {

height: calc(100% - 16px);

}
}
</style>

标签:color,data,barChart,柱状图,type,echarts,255
From: https://www.cnblogs.com/connie256/p/17117652.html

相关文章

  • 横向柱状图图
    <!--横向柱状图图--><template><divclass="chartBox"><!--echart图标--><divid="crosswiseBarChart"ref="crosswiseBarChart"></div></div></template><scr......
  • 分组柱状图
    <!--分组柱状图--><template><divclass="chartBox"><!--echart图标--><divid="histogram"ref="histogram"></div></div></template><script>//引入基本模......
  • echarts动态排序柱状图
    链接:https://juejin.cn/post/7149089840850534407<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"/><metahttp-equiv="X-UA-Comp......
  • vue+echarts实现疫情柱状图(全国确诊省市TOP10)
    效果:代码:<template><div><divid="right1"style="height:800px;width:100%"></div></div></template><script>exportdefault{data(){return{......
  • Python修改柱状图边缘柱子与图边界的距离
      本文介绍基于Python中matplotlib.pyplot模块,修改柱状图、条形图最两侧的柱子与图像边缘之间距离的方法。  最近,绘制了一个水平的柱状图,但是发现图的上、下边距(不是......
  • 09Bar柱状图
    importmatplotlib.pyplotaspltimportnumpyasnpn=12X=np.arange(n)Y1=(1-X/float(n))*np.random.uniform(0.5,1.0,n)Y2=(1-X/float(n))*np.random.uniform(0.5,......
  • echarts柱状图柱体圆角
    init_chuangkou_top_list_chart:function(ckmc_list,value_list){letmyChart=this.$echarts.init(document.getElementById('chuangkou_top_list'));......
  • Echarts柱状图属性设置大全,怎么不要等高线
    https://blog.csdn.net/sleepwalker_1992/article/details/126467654......
  • 在vue中使用Echarts绘制叠堆折线面积图(可切换叠堆柱状图)
    (文章目录)效果我这里用的框架是Element+vue,将可视化图表用card卡片包起来,这个叠堆折线面积图主要实现的功能有:1.默认进入时看到的是叠堆折线面积图,在点击对应的元素切......
  • 横向echarts柱状图,双坐标轴展示
    效果如图:        //设备故障lineOption1:{tooltip:{trigger:'axis',axisPointer:{type:'......