Chart.js line chart is cut off at the top?(Chart.js 折线图在顶部被截断?)
问题描述
由于某种原因,所有图表都在最高值处被截断.我怎样才能解决这个问题?我不能使用固定的 y 轴
For some reasone all graphs are cut off at the highest value. How can i fix this? I can't use a fixed y-axis
推荐答案
编辑/更新: 正如评论中提到的,5px 值可以更准确地为您的线宽值的一半,我相信默认值为 2px,所以在这种情况下,您只需要填充:{ top: 1 }
Edit/Update: As mentioned in the comments, the 5px value can more accurately be just half of whatever your line width value is, I belive default is 2px so in that case you would just want padding: { top: 1 }
您可以在选项或全局中设置 layout.padding 属性.我遇到了同样的问题并设置了
There a layout.padding attribute you can set either in options or global. I had this same problem and set
options: {
layout: {
padding: {
top: 5
}
},
...
}
对我来说很好,没有切断线路http://www.chartjs.org/docs/#chart-configuration-layout-配置
worked fine for me to not cut off the line http://www.chartjs.org/docs/#chart-configuration-layout-configuration
这篇关于Chart.js 折线图在顶部被截断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Chart.js 折线图在顶部被截断?


基础教程推荐
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01