<p id="aa" style="height:500px;min-width:500px" ></p>
<script>
其他的省略.......
function (ec) {
var myChart = ec.init(document.getElementById('aa'));
var ecConfig = require('echarts/config');
var option = {
其他的省略 ..........
series: [ {
"name":"使用量",
"type":"bar",
stack: 'sum',
barCategoryGap: '40%',
//barWidth:30,
itemStyle: { // 系列级个性化
normal: {
// barBorderWidth: 6,
//barBorderColor:'tomato',
color: 'green'
}
},
"data":[5, 20, 40, 10, 10, 20,100,50,200,5, 20, 40, 10, 10, 20,100,50,200,100,150,150,150]
}]
</script>
为什么图表宽度不随数据增加而变宽?因为设置固定宽度当数据很少时,柱子会变得很宽
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...