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 折线图在顶部被截断?


- 400或500级别的HTTP响应 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- Fetch API 如何获取响应体? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01