plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Stacked area chart - Avoid zero padding to clean up hovertool

Open patrickfuller opened this issue 3 years ago • 0 comments

When I hover over a stacked line chart, it shows zeroes for all lines not in range. Is there a way to hide these values rather than adding noise to the hover tool?

Plotly.newPlot('test', [{
    line: { shape : 'vh' },
    stackgroup: '1',
    x: [1, 2],
    y: [1, 1],
}, {
    line: { shape : 'vh' },
    stackgroup: '1',
    x: [3, 4],
    y: [2, 2],
}, {
    line: { shape : 'vh' },
    stackgroup: '1',
    x: [3, 4, 5, 6],
    y: [3, 3, 3, 3],
}], {
    hovermode: 'x unified',
    width: '100%',
});

As a jsfiddle and image:

image

(Cross-post from StackOverflow, which also provides an example use case where this matters)

patrickfuller avatar Apr 18 '21 20:04 patrickfuller