Skip to content

d3.js canvas

Miroslav Jelaska edited this page Sep 14, 2017 · 6 revisions

Canvas needs to be defined. Its width and height should be defined. Canvas will be used by sankey.renderModel(model, canvas, options).

// ./preview/src/js/main.js
function init(){
    const canvas =
        d3.select('body')
        .append('svg')
        .attr('id', 'canvas')
        .attr('width', 2000)
        .attr('height', 600);

    // Rest of initialization
    sankey.renderModel(model, canvas, options);
}
window.onload = init;

⬅️ SVG images for shapes (2.iv.) 💈 Model management (2.vi.) ➡️