[英]d3.js y-axis min and max value range display
I have data points from 5000 to 91200 我的数据点从5000到91200
y.domain(d3.extent(function(d) { return d.y; }));
It gives me the correct ouput [5000, 91200]
but while displaying it changes to 10000. 它给了我正确的输出[5000, 91200]
但在显示时变为10000。
Does anyone know how I can resolve this issue? 有谁知道我该如何解决这个问题?
d3 uses the 'min' and 'max' functions to show only the lowest and highest numbers in your data d3使用“最小”和“最大”功能仅显示数据中的最低和最高数字
var max = d3.max(d3.values(data));
var min = d3.min(d3.values(data));
y.domain([min, max]);
The extent function actually does both of these functions automagically 范围功能实际上自动地完成了这两个功能
y.domain(d3.extent(data, function(d) { return d; }));
If you show your code on jsfiddle I'll be able to narrow down your issue 如果您在jsfiddle上显示代码,则可以缩小问题范围
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.