After clicking legend hiding some points, the box select function become invalid

I have plot a markers chart and click the legend to hide some data. And then the box selector and lasso select can’t do anything any more. The select function become invalid. How to handle this issue?

Sounds like a bug. Would you mind sharing a reproducible code snippet with us?

function plotBarTrend(fileName, traceData, xData, yData1, yData2, barMode, containId, subId) {
Plotly.d3.csv(fileName, function(erro, rows) {

    var data = [];
    var trace = rows.sort(function(x, y) {
        return x[xData] - y[xData];
    var trData = {
        type: 'bar',
        name: yData2,
        // visible: 'legendonly',
        opacity: 0.5,
        x: unpack(trace, xData),
        y: unpack(trace, yData2),
        yaxis: 'y2',

    var colorNum = 0;
    yData1.forEach(function(yData) {
        var trData = {
            mode: 'lines+markers',
            type: "scatter",
            name: yData,
            x: unpack(trace, xData),
            y: unpack(trace, yData),
            marker: {
                color: colorList[colorNum]

    var layout = {

        xaxis: {
            title: xData,
            type: 'category',
            showline: true,
            mirror: 'allticks',
            tickangle: -90
        yaxis: {
            title: 'Yield%',
            // range: [30, 92],
            showline: true,
            zeroline: false
        yaxis2: {
            title: 'Wafer Cnt',
            overlaying: 'y',
            side: 'right',
            range: [0, 8000],
            showgrid: false,
            showline: true
        margin: {
            l: 60,
            t: 60,
            b: 160,
            r: 20
        legend: {
            x: 1.16,
            y: 1
        hovermode: 'closest'
    Plotly.plot(subId, data, layout);
    clickBarEvent(subId, data, traceData, xData)


Above is another case which is much clearly and it meet the same error when select some points after filtered some data by clicked the legend.
I have test all the chart I have plotted that no one succeed and it returns an error

Hi, etienne, what do you think about this issue? Is that the format of data or layout parts coming wrong which I have set? if you have some idea, please let me know. Thanks.

It’s hard to figure out what’s going without a fully reproducible example i.e. that has your data in it. My apologies.