This is a simple demonstration of the d3fc extent component, which provides a flexible mechanism for computing the domain of a chart. It allows you to add padding, define multiple accessors, include fixed values (e.g. ensure it includes zero), etc.
var yExtent = fc.extentLinear()
// the property of the data that defines the y extent
.accessors([function(d) { return d.close; }])
// pad by 10% in the +ve direction
.pad([0, 0.1])
// ensure that the extent includes zero
.include([0]);
var xExtent = fc.extentDate()
// the property of the data that defines the x extent
.accessors([function(d) { return d.date; }])
// pad in domain units (in this case milliseconds)
.padUnit('domain')
// ensure that the scale is padded by one day in either direction
.pad([millisPerDay, millisPerDay]);
// apply the extent to the scales
x.domain(xExtent(data));
y.domain(yExtent(data));
Forked from this block: https://bl.ocks.org/d3noob/2505b09d0feb51d0c9873cc486f10f67
forked from d3noob's block: d3fc extent example
https://unpkg.com/babel-polyfill@6.26.0/dist/polyfill.js
https://unpkg.com/custom-event-polyfill@0.3.0/custom-event-polyfill.js
https://cdnjs.cloudflare.com/ajax/libs/document-register-element/1.8.0/document-register-element.js
https://unpkg.com/babel-standalone@6/babel.min.js
https://unpkg.com/d3@5.5.0
https://unpkg.com/d3fc@14.0.1