Chart Events


onActivated

Excel.run(function (context){ 
    var pieChart = context.workbook.worksheets.getActiveWorksheet().charts.getItem("Pie");
    pieChart.onActivated.add(function (event) {
        return Excel.run((context) => {
            console.log("The pie chart is the active chart. ID: " + event.chartId);
            return context.sync();
        });
    });
    return context.sync();
});

onDeactivated

Excel.run(function (context){ 
    var pieChart = context.workbook.worksheets.getActiveWorksheet().charts.getItem("Pie");
    pieChart.onDeactivated.add(function (event) {
        return Excel.run((context) => {
            console.log("The pie chart is NOT active.");
            return context.sync();
        });
    });
    return context.sync();
});


© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext