layui.use(['echarts'], function () { let echarts = layui.echarts; var column2 = echarts.init(document.getElementById('project_expense')); option = { // backgroundColor: '#ffffff', title: { text: '支出分布', left: 'center', top: 2, fontSize: 15, textStyle: { color: '#666666', fontWeight: 'normal' } }, color: ['#fed46b', '#2194ff',], tooltip: { trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效 type: 'shadow' // 默认为直线,可选为:'line' | 'shadow' } }, grid: { left: '3%', right: '4%', bottom: '10%', containLabel: true }, // legend: { // left: 'center', // top: 'bottom', // data: ['场地费', '车辆费', '顾问费', '劳务费用', '火车费', '其他'] // }, xAxis: [{ type: 'category', data: ['场地费', '车辆费', '顾问费', '劳务费用', '火车费', '其他'], axisTick: { alignWithLabel: true } }], yAxis: [{ name: '单位:元', type: 'value' }], barMaxWidth: '30', label: { show: true, position: 'top', // formatter: function (params) { // return params.value + '%' // } }, series: [ { type: 'bar', data: [10, 52, 90, 70, 90, 70], itemStyle: { normal: { color: '#f89588' } } } ] }; column2.setOption(option); window.onresize = function () { column2.resize(); } })