Exercise
Extension: make data interactive
Allow 10 minutes. Make a small chart whose result changes in one predictable way.
Files
Prompt to start
First explain what Chart.js, Plotly, D3.js and Three.js are each useful for. Then make a single self-contained HTML file with a bar chart of three fictional event registration counts: 4, 6 and 10. Label the data as fictional. Add a multiplier slider from 1 to 3 in whole steps and show the numbers as well as the bars. At multiplier 2 the values should be 8, 12 and 20. Use HTML, CSS and JavaScript with no libraries or network requests for this first version. Return the complete source to save as visualisation.html.
Steps
- Ask the chatbot to compare Chart.js, Plotly, D3.js and Three.js, then pick a chart idea.
- For a local first version, ask for a bar chart with fictional values 4, 6 and 10 and a multiplier slider. Save the complete HTML and open it.
- Set the multiplier to 1 and then 2. Compare the bars and visible numbers, then return it to 1.
- If you try a library version, record its version and source URL. Use the Console to diagnose a loading failure.
Chart.js covers common charts. Plotly supports interactive charts and 3D plots. D3.js helps build custom graphics driven by data. Three.js builds 3D scenes. To explore a library, ask for a second version and the exact library URL including its version. Check your organisation permits that source. If it will not load, keep using the local version.
Check your result
- Multiplier 1 shows 4, 6, 10. Multiplier 2 shows 8, 12, 20. Returning to 1 restores the original values.
- You tested the saved page and recorded which version worked.