Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function selectDataset(d) {
- let value = this.value;
- if (value == "total") {
- change(datasetTotal);
- } else if (value == "option1") {
- change(datasetOption1);
- } else if (value == "option2") {
- change(datasetOption2);
- }
- }
- function changeColor(d) {
- let value = this.value;
- if (value == "total") {
- d3.selectAll("rect")
- .transition()
- .duration(2000)
- .style("fill", 'blue')
- } else if (value == "option1") {
- d3.selectAll("rect")
- .transition()
- .duration(2000)
- .style("fill", 'red')
- } else if (value == "option2") {
- d3.selectAll("rect")
- .transition()
- .duration(2000)
- .style("fill", 'yellow')
- }
- }
- d3.selectAll("input").on("change", function(d) {
- selectDataset.call(this, d);
- changeColor.call(this, d);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement