[英]Why yAxis axisLabel align left is resulting position label inside the bar in Apache ECharts
The expetacion result is like this post: How to set labels align left in Horizontal Bar using chart.js? expetacion 结果就像这篇文章: How to set labels align left in Horizontal Bar using chart.js? but it's implemented in Apache ECharts但是在Apache ECharts中实现
Any idea?任何的想法?
var chartDom = document.getElementById('main'); var myChart = echarts.init(chartDom); var options = { color: ["#3398DB"], tooltip: { trigger: "axis", axisPointer: { type: "shadow" } }, grid: {}, xAxis: [{ type: "value", }], yAxis: [{ type: "category", axisLabel: { align: 'left', margin: 40 }, data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] }], series: [{ name: "直接访问", type: "bar", barWidth: "60%", data: [10, 52, 200, 334, 390, 330, 220] }] }; myChart.setOption(options);
#main { height: 400px; }
<div id="main"></div> <p>Test</p> <script src="https://cdn.jsdelivr.net/npm/echarts@5.2.1/dist/echarts.min.js"></script>
You can set margin
for axisLabel, to make the labels visible.您可以为 axisLabel 设置margin
,以使标签可见。 Updated your code snippet更新了您的代码片段
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.