You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/06/29 02:07:15 UTC
[GitHub] mqliutie opened a new issue #8613: yAxis.axisLabel 值不平均
mqliutie opened a new issue #8613: yAxis.axisLabel 值不平均
URL: https://github.com/apache/incubator-echarts/issues/8613
<!--
为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
-->
### One-line summary [问题简述]
Y轴的刻度不平均,无论是值还是距离
### Version & Environment [版本及环境]
+ ECharts version [ECharts 版本]: 4.1.0
+ Browser version [浏览器类型和版本]: chrome `67.0.3396.99`
+ OS Version [操作系统类型和版本]: mac 10.13.4
### Expected behaviour [期望结果]
### ECharts option [ECharts配置项]
<!-- Copy and paste your 'echarts option' here. -->
<!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
```javascript
const data = [0.11, 0.11, 0.15, 0.13];
let max = Math.max(...data);
let min = Math.min(...data);
const distance = (max - min) / 2;
max = (max + distance) > 1 ? 1 : parseFloat((max + distance).toFixed(2));
min = (min - distance) < 0 ? 0 : parseFloat((min - distance).toFixed(2));
option = {
grid: {
left: 50,
},
legend: {
data: [{
name: '我的准确率',
icon: 'rect'
}]
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四']
},
yAxis: {
type: 'value',
name: '正确率',
min,
max,
axisLabel: {
formatter: function (value) {
console.log(value)
return `${(value * 100).toFixed(0)}%`
}
}
},
series: [{
name: '我的准确率',
type: 'line',
data,
formatter: function (value) {
console.log(value)
},
label: {
show: true,
color: 'blue'
},
lineStyle: {
color: 'black'
},
itemStyle: {
normal: {
color: 'green'
}
}
}]
}
```
### Other comments [其他信息]
<!-- For example: Screenshot or Online demo -->
<!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org