Published
Edited
May 4, 2021
Insert cell
Insert cell
{
// Création d'une nouvelle balise
var corps = d3.create("div");

// Ajout de balises div au corps
var div1 = corps.append("div"),
div2 = corps.append("div"),
div3 = corps.insert("div", "div"); // placement de la div avant la première div trouvée

// Définition du contenu des balises
div1.html("Ma première div créée");
div2.html("Je créé ici ma deuxième div");
div3.html("Mais pourquoi la troisème div est placée ici ?");

// Modification de la couleur de la police
corps.style("color", "red");
div2.style("color", "steelblue");
div2.style("text-align", "right");
return corps.node();
}
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more