简体   繁体   English

D3.js折线图y最高轴小于最高线

[英]D3.js line chart highest y axis smaller than highest line

For example, in the line the highest value is 890, but the largest axis is 800. 例如,在该行中,最高值为890,但最大轴为800。

I tried to fix it by change .ticks() and tickSize(), they cannot change highest value. 我试图通过更改.ticks()和tickSize()来修复它,它们不能更改最大值。 it seems d3 draw it automatically. 似乎d3自动绘制了它。 Is there any way to make the highest value larger than the highest value in chart? 有什么方法可以使最大值大于图表中的最大值?

Currently, what I do is I set it to the nearest 10. 目前,我要做的是将其设置为最接近的10。

yScale.domain(
    [d3.max(dataset) + (
        10 - (
            d3.max(dataset) % 10 )
        )
    ), 0]

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

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