Update d3.js data with button press
This example demonstrates how to update a line graph by pressing an "Update" button. It uses D3.js version 3.5.17 to render an SVG line chart of date and closing value pairs. The interaction is handled by an HTML `onclick` event that triggers the `updateData()` function, which re-fetches a different CSV file (`data-alt.csv`). The axes and line path are then updated with a smooth 750-millisecond transition, showing how to dynamically replace the dataset and rescale the visualization.
AI-generated descriptionThis is a follow on from the simple d3.js graph used as an example in the book D3 Tips and Tricks.
It demonstrates the loading of new data and updating a graph on a button press. It should be taken in context with the text of the book which can be downloaded for free from Leanpub.