forked from D3 Custom Bundle II
styles
after the transition wasn’t working. I needed to modify node_modules/d3-selection-multi/index.js
to update the transition prototype:
import {selection} from "d3-selection";
import selection_attrs from "./src/selection_attrs";
import selection_styles from "./src/selection_styles";
import selection_properties from "./src/selection_properties";
selection.prototype.attrs = selection_attrs;
selection.prototype.styles = selection_styles;
selection.prototype.properties = selection_properties;
if (selection.prototype.transition){
selection.prototype.transition.attrs = selection_attrs;
selection.prototype.transition.styles = selection_attrs;
selection.prototype.transition.properties = selection_attrs;
}
This seems way too hacky since it there’s an unspecified dependency on loading d3-transition
before d3-selection-multi
. I’m not sure if there should be a separate d3-selection-transition-multi
module to handle this? Creating two modules for everything you’d like to stick onto selection.prototype
seems like overkill.
To use attrs
after a transition now, just add this to the top of your code:
d3.selection.prototype.transition.attrs = d3.selection.prototype.attrs