score:1

Accepted answer

you can just override the getelementatevent method of the chart object

var originalgetelementatevent = mychart.getelementatevent;
mychart.getelementatevent = function () {
    return originalgetelementatevent.apply(this, arguments).filter(function (e) {
        return e._datasetindex == 0;
    });
}

where mychart is your chart object.


fiddle - http://jsfiddle.net/x4shhvbk/

score:0

it seems that this funcionality is not added to chart.js.

i post my solution in this issue: https://github.com/chartjs/chart.js/issues/1889

score:1

i make use of the custom tooltip configuration to achieve this:

this.mychart = new chart(this.ctx, {
        type: 'bar',
        data: {
            labels: labels,
            datasets: [{
                    label: "line 1",
                    type: 'line',
                    data: data3
                },
                {
                    label: "bar 1",
                    type: 'bar',
                    data: data1,
                    backgroundcolor: "#3eafd5"
                },
                {
                    label: "bar 2",
                    type: 'bar',
                    data: data2,
                    backgroundcolor: "#d24b47"
                }
            ]
        },
        options: {
            responsive: true,
            tooltips: {
                custom: function(tooltipmodel) {
                    if (tooltipmodel.body && tooltipmodel.body[0].lines && tooltipmodel.body[0].lines[0].indexof("bar") > -1) {
                        tooltipmodel.opacity = 0;
                    }
                }
            }
        }
    }

Related Query

More Query from same tag