Skip to main content
100%

Canvas tutorial - Turn SVG scatterplot into Canvas - Normal level

✓ Published0🌍 Public
GGJHazelaar
Last edited Feb 8, 2018
Created on Feb 8, 2018

This interactive scatterplot uses a Canvas element to visualize movie data from the IMDB 5000 dataset, plotting each film’s rating against its budget on a logarithmic scale. Circle size and opacity encode the profit ratio (revenue divided by budget), while color represents release year via a sequential Viridis scale. The code uses D3 v4 for data loading, scales, and Canvas creation, then draws circles directly with the Canvas 2D API’s `ctx.arc` and `ctx.fill` methods.

AI-generated description

This scatterplot is made with d3.js and SVG - For the canvas tutorial it is now your job to turn this scatterplot into one uses canvas for the visual part (the drawing of the circles). You can still use d3's helper functions for things such as scales, d3.select, etc.

See the other two levels here: <a href='https://bl.ocks.org/nbremer/aae35b358c7450b70cc12b27e48c6196'>Medium level</a> and <a href='https://bl.ocks.org/nbremer/7eda7f35215d6a5eb2a485f645844676'>Extreme level</a>

If you're completely stuck (and please, for your own benefit, only then) you can look at the solution here

Built with blockbuilder.org

forked from <a href='http://bl.ocks.org/nbremer/'>nbremer</a>'s block: <a href='http://bl.ocks.org/nbremer/0ed7cfdca6487b8cda79af3aaedf2ec5'>Canvas tutorial - Turn SVG scatterplot into Canvas - Normal level</a>

mit Licensed

Similar vizzes