Skip to content
Related Articles
Open in App
Not now

Related Articles

D3.js stackOffsetExpand() Method

Improve Article
Save Article
  • Last Updated : 29 Sep, 2020
Improve Article
Save Article

The D3.js stackOrderOffsetExpand() method applies a zero baseline and normalizes the values for each point such that the topline is always one.


d3.stackOrderOffsetExpand(series, order);

Parameters: This function accepts two parameters as mentioned above and described below.

  • series: This is the series based on which offset is expanded.
  • order: This is the ordering of the stack.

Return Value: This method returns no value.



<!DOCTYPE html>
    <meta charset="utf-8">
    <script src=
    <h1 style="text-align: center; color: green;">
        var data = [
        {letter: {a: 1000, b: 2000, c: 3000, d: 4000}},
        {letter: {a: 2000, b: 3000, c: 4000, d: 5000}},
        {letter: {a: 640, b: 960, c: 640, d: 400}},
        {letter: {a: 320, b: 480, c: 640, d: 400}}
        var stack = d3.stack()
            .keys(["a", "b", "c", "d"])
            .value((d, key) => d.letter[key])
            // Use of d3.stackOrderOffsetExpand() Method
        var series = stack(data);


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!