echarts:在柱子上方显示数值,调整柱子的宽度,调整y轴的步长极限, 设置y轴的名称的样式

小谷最近学习echarts各种收集,百度到的样式修改。
在柱子上方显示数值:

label: {
      	normal: {
          show: true,
          position: 'top',
          textStyle: {
            color: 'black'
          }
      },
   }

调整柱子的宽度:

barWidth : 45,

调整y轴的步长极限:
设置y轴的名称的样式:

yAxis: {name:'金额',
			fontSize : 30,
			max: 500,
			nameLocation:'middle' },

在这里插入图片描述

// 引入基本模板
let echarts = require('echarts/lib/echarts')
// 引入柱状图组件
require('echarts/lib/chart/bar')
// 引入提示框和title组件
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')
export default {
  name: 'hello',
  data() {
    return {
      msg: 'Welcome to Your Vue.js App'
    }
  },
  mounted() {
    this.drawLine();
  },
  methods: {
    drawLine() {
      // 基于准备好的dom,初始化echarts实例
      let myChart = echarts.init(document.getElementById('myChart'))
      // 绘制图表
      myChart.setOption({
        legend: {
			x: 'left',
			// orient: 'vertical'//图例纵向排列,如果没有默认横向
		},
    tooltip: {name:'谷姑姑'},
    dataset: {
        source: [
            ['月份', '订单数', '订单金额'],
			['2月', 150, 30,],
            ['3月', 83.1, 73.4,0],
            ['4月', 86.4, 65.2,0],
            ['5月', 72.4, 53.9,0]
        ]
    },
	xAxis: {type: 'category',
	},
	yAxis: {name:'金额',
			fontSize : 30,
			max: 500,
			nameLocation:'middle' },
    // Declare several bar series, each will be mapped
    // to a column of dataset.source by default.
    series: [{
		type: 'bar',
		
		barWidth : 45,
		label: {
      	normal: {
          show: true,
          position: 'top',
          textStyle: {
            color: 'black'
          }
      },
   }},
		{type: 'bar',
		barWidth : 45,
		label: {
      	normal: {
          show: true,
          position: 'top',
          textStyle: {
            color: 'black'
          }
      }
   }},
		
		
        
    ],
      });
    }
  }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

谷咕咕

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值