palantir / plottable

:bar_chart: A library of modular chart components built on D3
http://plottablejs.org/
MIT License
2.98k stars 221 forks source link

Complete instance gets rerendered after using the data method #3353

Open fklement opened 7 years ago

fklement commented 7 years ago

I've an instance with a bar plot and a pie plot. The bar plot with the .onClick interaction updates the dataset used in the pie plot.

interaction.onClick(function(point) {
                plot.selections().attr("fill", "#5279c7");
                var selection = plot.entitiesAt(point)[0].selection;
                selection.attr("fill", "#F99D42");
                pieData.pop()
                pieData.push({
                    cat: 'Einsatz Nr: ' + plot.entitiesAt(point)[0].datum.x,
                    total: plot.entitiesAt(point)[0].datum.y
                })

                pieDataset.data(pieData)
            });

Whenever i'm using this interaction the complete instance gets rerendered instead of only rerendering the pie plot. How can i manage it that the bar plots selection is still filled after using the data method of the Dataset class?

hellochar commented 7 years ago

Hey @fklement thanks for your interest in Plottable. Can you provide a full jsfiddle/codepen repro? I think this is a limitation of the current redraw logic; you can try having two separate Plottable top-level Components (e.g. two .renderTo() to different container elements) to work around it