当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - d3.scaleBand not a function

问题描述:

Shouldn't it work with this library? <script src="https://d3js.org/d3.v4.js"> I've tried all the libraries that I can find about this and none of them get rid of this error. Any help would be great.

var x = d3.scaleBand().rangeRound([10, width]).padding(0.4),

y = d3.scaleLinear().rangeRound([height, 20]);

网友答案:

Instead of

var x = d3.scaleBand().rangeRound([10, width]).padding(0.4),
y = d3.scaleLinear().rangeRound([height, 20]);

Change .padding to .paddingInner like such

var x = d3.scaleBand().rangeRound([10, width]).paddingInner(0.4),
y = d3.scaleLinear().rangeRound([height, 20]);

Thanks to Darren Sweeney for the answer.

分享给朋友:
您可能感兴趣的文章:
随机阅读: