score:1
Accepted answer
Since the function is being called with the button's ID...
myBubbleChart.switchMode(buttonId);
The task here is relatively simple.
First, set an array with all the IDs:
var ids = ["all", "region", "Change", "change_vs_net_value", "assets_on_map"];
Then, loop through it calling myBubbleChart.switchMode()
function. Here is a very simple way, using d3.timeout
, to call the function every 3 seconds (and changing the buttons appearance as well):
var index = 0;
d3.interval(function() {
myBubbleChart.switchMode(ids[(index++) % 5])
d3.selectAll(".button").classed("active", function(_, i) {
return i === index % 5 - 1;
})
}, 3000)
Here is the demo bl.ocks: http://blockbuilder.org/GerardoFurtado/dfaaedf591b980c2864eb054c7b29300
Source: stackoverflow.com
Related Query
- D3 visualization - how to automate button selection
- How to access the parentNode of a selection to raise an element?
- How can I use d3 classed selection to have name as function
- How to register multiple external listeners to the same selection in d3?
- How to add an interactive visualization to R markdown
- D3 How to change dataset based on drop down box selection
- How to disable brush selection on right click in d3.js
- How to get the parent selection in d3?
- D3.js - how to add zoom button with the default wheelmouse zoom behavior
- d3.js: How to convert edges from lines to curved paths in a network visualization by drawing a quadratic Bezier curve?
- how do i add a zoom in and zoom out button in a graph on d3
- How to remove circular dependencies in d3 selection using rollupjs?
- How to get value from the element using selection in d3
- How can I get access to the current selection inside a D3 callback?
- D3.js how to embed selection into a new element
- How to create selection from DOM element itself
- d3.js - how to adjust the height of the brush selection
- How to divide a D3 selection into groups by using the selection.filter method in a loop
- How to select and deselect a svg line and change its color on selection and deselection using d3.js and javascript , jquery?
- D3.js v4 - how to add zoom button with the default wheelmouse zoom behavior
- Any one know how to Apache hive data visualization using D3js?
- How do I style a Javascript button using d3?
- how to sort a shape selection in d3
- How to enable text selection in a D3.js-SVG that has zoom enabled?
- How can I render a D3.js visualization as a JPG, or an image?
- D3 How to update the chart after selection from drop down menu with new data
- How to remove D3 link text from visualization
- How can I handle data filtering on a button click on D3.js?
- Using Javascript D3 library, how replace data in selection of rects?
- When selecting an option from the dropdown selection box created via d3.js the value sent to the button becomes undefined
More Query from same tag
- Simplest way to make a slightly curved line in D3
- Dynamic Graph Visualisation Using JS
- How to make d3js calendar and its contents responsive
- Update json on leaflet through d3
- Uncaught TypeError: Object [object Array] has no method 'nodes'
- NodeJS-Typescript-Yarn : Error: Cannot find module 'd3'
- Represent Python-generated data with D3.js chart
- Why is there a multi-second delay in this d3 code running?
- XMLHTTPRequest error while trying to add d3 to project
- How to specify a data column as the property used in a line generator?
- es6 module import of d3 4.x fails
- Use generated json object instead d3.json
- Handling JSON data with no identifiers
- d3 how to scale between number to color when lengths are different
- How can I choose an specific SVG in d3 and change its attributes?
- How to implement tooltip for D3 line chart with data from 2 arrays?
- D3 Stable Sort Simulation
- Get a node by its ID
- d3 rect interpolation
- D3.js exit() not seeming to get updated information
- crossfilter - calculating percent of all records with a property
- d3 equivalent for Ruby on Rails?
- Bar Chart with Counts in dc.js
- Is the order of the ".on" functions important in D3?
- Labeling network nodes in D3
- How "d3.translateExtent" coordinate works?
- X and Y axis are not together
- convert a nested JSON file to a table using D3
- Updating only those SVG elements where the underlying bound data has been modified
- Grouping nodes in force directed graphs in d3.js