D3.js - Y domain in stacked bar chart

I found a plunker here https://plnkr.co/edit/hBWoIIyzcHELGyewOyZE?p=preview

How to set y domain from 100 instead 0 ? If I set only in that place, the bar is under x axis.

 y.domain([100, d3.max(stackedSeries, function(d) {
        return d3.max(d, function(d) {
            return d[0] + d[1];
        });
 })])

Hi @UltrasAvanti, you were on the right track. This Plunker does what you’re looking for.

I started with the exact adjustment you made, and then I used clipPath from this Stack Overflow post to get rid of the stuff that was outside of the graph.

Hope this helps. :slight_smile:

1 Like