简体   繁体   English

Chart.js:如何将线下的区域填充到特定点?

[英]Chart.js : How to fill the area under the line to a certain point?

I created a line chart using the chart.js library and filled the area under the line. 我使用chart.js库创建了一个折线图,并填充了该线下的区域。

The problem that I'm having is the fill under the line does not stop at the last plotted point on the graph. 我遇到的问题是线下的填充不会在图形的最后绘制点停止。 The fill under the curve should stop when the line stops but it keeps going. 直线停止时,曲线下方的填充应停止,但仍会继续。 Is there are a way to specify the fill area so it doesn't fill past the line/last plotted point? 有没有一种方法可以指定填充区域,以使它不会填充到直线/最后绘制的点之外?

I've looked at the documentation and found a fill property but it's not fixing the problem. 我看了看文档,发现了fill属性,但不能解决问题。 I'm thinking it might have something to do with the chart border or gridlines. 我认为这可能与图表边框或网格线有关。

dataset选项中,设置fill: '-1'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM