javascript - d3.js y-axis min and max value range display - Stack Overflow

I have data points from 5000 to 91200y.domain(d3.extent(function(d) { return d.y; }));It gives me the c

I have data points from 5000 to 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.

Does anyone know how I can resolve this issue?

I have data points from 5000 to 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.

Does anyone know how I can resolve this issue?

Share Improve this question edited Sep 27, 2015 at 0:46 Martin Liversage 107k23 gold badges215 silver badges262 bronze badges asked May 26, 2014 at 13:44 Afzal LakdawalaAfzal Lakdawala 1873 silver badges10 bronze badges 1
  • What do you mean by "while displaying it's changed to 10000"? Do you mean the tick mark labels? When your domain is irregular, the labels will not always include the exact minimum and maximum of the domain. – AmeliaBR Commented May 26, 2014 at 14:21
Add a ment  | 

1 Answer 1

Reset to default 4

d3 uses the 'min' and 'max' functions to show only the lowest and highest numbers in your data

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745152801a4613939.html

相关推荐

  • javascript - d3.js y-axis min and max value range display - Stack Overflow

    I have data points from 5000 to 91200y.domain(d3.extent(function(d) { return d.y; }));It gives me the c

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信