
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@d3fc/d3fc-extent
Advanced tools
Extends the d3 extent functionality to allow multiple accessors, padding and date support
Extends the D3 extent functionality (found in d3-array) to allow padding, multiple accessors and date support
npm install @d3fc/d3fc-extent
Calculates the extent of an array of data which can be used to set the range on a scale. Can also optionally pad the data in various ways as described below. Internally makes use of d3-array's min and max methods.
import { extentLinear } from 'd3fc-extent';
const data = [{ x: 1 }, { x: 2 }, { x: 4 }, { x: 8 }, { x: 16 }];
const extent = extentLinear()
.accessors([d => d.x])
.pad([1, 4])
.padUnit('domain');
extent(data);
// [0, 20]
Constructs a new linear extent calculator.
If accessors is specified, sets the array of value accessors to the specified array and returns this extent instance. The accessors are applied to each data value before computing the extent. The value returned by the accessors must be a scalar value or an array of scalar values. Defaults to an identity function (i.e. d => d).
If accessors is not specified, returns the current array of value accessors, which defaults [].
If values is specified, sets the amount of padding applied to the minimum and maximum values of the extent, to the specified array [minPad, maxPad] and returns this extent instance. The unit of these values is set by padUnit.
If values is not specified, returns the current array of padding values, which defaults [0, 0].
If value is specified, sets the unit of the pad values applied to minimum and maximum values and returns this extent instance. Possible values are -
[0.5, 0.5] would double the calculated extent.percent.linear.symmetricalAbout([value])
If value is specified, sets the value around which the extent will be centered around and returns this extent instance. Can also be set to null to disable centering. Note this is applied before padding.
If value is not specified, returns the current center value, which defaults null.
If values is specified, sets the array of additional values to include within the calculated extent to the specified array and returns this extent instance. This allows for always including an origin (e.g. [0]) or specifying a minimum extent to always be displayed (e.g. [10, 20]).
Note included values are applied before symmetricalAbout.
If values is not specified, returns the current array of included values, which defaults [].
Calculates the extent of an array of data which can be used to set the range on a scale. Can also optionally pad the data in various ways as described below. Equivalent in functionality to linear but for Date values.
import extentTime from 'd3fc-extent';
const data = [{ x: new Date(2016, 0, 1) }, { x: new Date(2016, 0, 11) }];
const extent = extentTime()
.accessors([d => d.x])
.pad([0, 0.2]);
extent(data);
// [ 2016-01-01T00:00:00.000Z, 2016-01-13T00:00:00.000Z ]
Constructs a new time extent calculator.
If accessors is specified, sets the array of value accessors to the specified array and returns this extent instance. The accessors are applied to each data value before computing the extent. The value returned be the accessors must be a Date or an array of Dates. Defaults to an identity function (i.e. d => d).
If accessors is not specified, returns the current array of value accessors, which defaults [].
If values is specified, sets the amount of padding applied to the minimum and maximum values of the extent, to the specified array [minPad, maxPad] and returns this extent instance. The unit of these values is set by padUnit.
If values is not specified, returns the current array of padding values, which defaults [0, 0].
If value is specified, sets the unit of the pad values applied to minimum and maximum values and returns this extent instance. Possible values are -
[0.5, 0.5] would double the calculated extent.percent.time.symmetricalAbout([value])
If value is specified, sets the value around which the extent will be centered around and returns this extent instance. Can also be set to null to disable centering. Note this is applied before padding.
If value is not specified, returns the current center value, which defaults null.
If values is specified, sets the array of additional values to include within the calculated extent to the specified array and returns this extent instance.
If values is not specified, returns the current array of included values, which defaults [].
Deprecated - use time instead.
FAQs
Extends the d3 extent functionality to allow multiple accessors, padding and date support
The npm package @d3fc/d3fc-extent receives a total of 7,024 weekly downloads. As such, @d3fc/d3fc-extent popularity was classified as popular.
We found that @d3fc/d3fc-extent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.