Detecting added visualizations


#1

Hello I have a react app with a configurable dashboard where you can add some pre-defined visualizations like Bars, KPI, Donut, Raw Data Table and so on, but i need to execute some specific logic when any chart is added to the dashboard, so, is there a way to detect added or removed visualizations and their info using chartfactor?


#2

Well there are some event you can use, like aktive:added and aktive:removed, yo can subscribe to them using the global ChartFactor object ( the cf object), this is an example of how to do that:

cf.on('aktive:added', e => {
    // your code here...
    // the `e` object has the `data` key where the vizualization object is
    console.log(e)
});

cf.on('aktive:removed', e => {
    // your code here...
    // the `e` object has the `data` key where the vizualization object is
    console.log(e)
});


#3

I used it and It was useful, thanks :slight_smile: