Public
Edited
Sep 18, 2024
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
let a = 10; // Number
a = true; // boolean
a = [1, 2, 3, 4]; // Array
a = { nom: "Nicolas", prénom: "Lambert" }; // Object
a = "JavaScript"; // String
return a;
}
Insert cell
Insert cell
typeof NaN
Insert cell
Insert cell
{
let a = [7, 1, 9, 3, 10, 4, 5, 6, 2, 8];
return a.sort();
}
Insert cell
Insert cell
{
let a = [7, 1, 9, 3, 10, 4, 5, 6, 2, 8];
return a.sort((a, b) => a - b);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
chart = {
const width = 640;
const height = 400;
const margin = { top: 20, right: 30, bottom: 30, left: 40 };

const x = d3
.scaleUtc()
.domain(d3.extent(aapl, (d) => d.Date))
.range([margin.left, width - margin.right]);

const y = d3
.scaleLinear()
.domain([0, d3.max(aapl, (d) => d.Close)])
.range([height - margin.bottom, margin.top]);

const svg = d3.create("svg").attr("width", width).attr("height", height);

svg
.append("g")
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x));

svg
.append("g")
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(y));

svg
.append("path")
.attr("fill", "none")
.attr("stroke", "steelblue")
.attr("stroke-width", 1.5)
.attr(
"d",
d3
.line()
.x((d) => x(d.Date))
.y((d) => y(d.Close))(aapl)
);

return svg.node();
}
Insert cell
Insert cell
Insert cell
Plot.plot({
marks: [Plot.tickX(data2, { x: "gdppc" })]
})
Insert cell
Plot.plot({
grid: true,
marginLeft: 50,
facet: {
data: data2,
y: "region"
},
marks: [Plot.boxX(data2, { x: "gdppc" })]
})
Insert cell
Insert cell
Insert cell
aqdata = aq
.from(data)
.select("id", "name", "pop", "gdp")
.orderby(aq.desc("pop"))
.filter((d) => d["pop"] > 200000000)
.relocate("gdp", { before: "pop" })
Insert cell
md`${aqdata.toMarkdown()}`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Ceci est une cellule
Insert cell
Insert cell
Voici du texte en *italic* ou en __gras__ avec un [lien](https://observablehq.com/).
Insert cell
Insert cell
Insert cell
c = \pm\sqrt{a^2 + b^2}
Insert cell
Insert cell
<div>ceci est du texte surligné en <span style="background-color:tomato; color:white">rouge</span>.</div>
Insert cell
Insert cell
<canvas id="myCanvas" width="100" height ="100" style="border:1px
solid #000000; background-color: steelblue;"></canvas>
Insert cell
Insert cell
<svg viewBox="0 0 1000 100" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="100px" height="100px" fill="#F2CD3B" stroke="#06000C" />
</svg>
Insert cell
Insert cell
Insert cell
a = 10
Insert cell
b = 62
Insert cell
c = a + b
Insert cell
Insert cell
x = {
let val1 = 8;
let val2 = 7;
return val1 * val2;
}
Insert cell
Insert cell
function sum(a, b) {
return a + b;
}
Insert cell
sum(10, 30)
Insert cell
multi = (a, b) => a * b
Insert cell
multi(3, 8)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
e + d
Insert cell
d = 120
Insert cell
e = 5
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof radios = Inputs.radio(["pop", "pib", "idh"], {
label: "Variable à traiter",
value: "pop"
})
Insert cell
viewof date = Inputs.date({label: "Date", value: "2023-09-28"})
Insert cell
viewof select = Inputs.select(["Paris", "Marseille", "Lyon"], {
label: "Choisissez une ville"
})
Insert cell
Insert cell
Insert cell
<svg viewBox="0 0 1000 100" xmlns="http://www.w3.org/2000/svg">
<circle cx=50 cy=50 r=50 fill="#4ab58c"/>
</svg>
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
<svg viewBox="0 0 1000 100" xmlns="http://www.w3.org/2000/svg">
<circle cx=${position} cy="50" r=${radius} fill="${color}"/>
</svg>
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
premiermai
Insert cell
Insert cell
import { chart1 } from "@neocartocnrs/strikes"
Insert cell
chart1
Insert cell
Insert cell
Insert cell
dicopal = require("dicopal")
Insert cell
dicopal.getPaletteProviders()
Insert cell
dicopal.getRawData("colorbrewer")
Insert cell
pal = dicopal.getColors("Sunset", 7)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
geo = require("geotoolbox@2")
Insert cell
Insert cell
world = FileAttachment("world.json").json()
Insert cell
Insert cell
Insert cell
world_light = geo.simplify(world, { k })
Insert cell
Insert cell
Insert cell
africa = geo.filter(world, (d) => d.region == "Africa")
Insert cell
viewof dist = Inputs.range([1, 4000], { label: "Distance", step: 100 })
Insert cell
buff = geo.buffer(africa, { dist: dist })
Insert cell
clipworld = geo.clip(world, { clip: buff })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
bertin = require("bertin")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
bertin.draw({
layers: [
{
geojson: world,
fill: "blue",
stroke: "red"
}
]
})
Insert cell
Insert cell
bertin.draw({
layers: [
{
type: "bubble",
geojson: world,
values: "pop", // <- données quantitatives absolues
fill: {
type: "typo",
values: "region" // <- données qualitatives
}
},
{
geojson: world,
fill: "#CCC"
}
]
})
Insert cell
Insert cell
Insert cell
bertin.draw({
params: { projection: "InterruptedSinusoidal" }, // Paramètres généraux (marges, projection, etc.)
layers: [
{ type: "header", text: "La population mondiale" }, // Titre
{ type: "footer", text: "Fait avec bertin.js", anchor: "middle" }, // Source
// COUCHE 1 (cercles)
{
type: "bubble",
geojson: world, // géometrie
k: radiusmax,
values: "pop", // variable
fill: "#b566ac", // couleur des cercles
stroke: "white", // couleur de contour des cercles
strokeWidth: 0.5, // épaisseur
tooltip: ["$name", "$pop"], // Infobulle
leg_x: 20, // position de la légende (x)
leg_y: 250, // position de la légende (y)
leg_title: "Population des\npays en 2000", // Titre de la légende
leg_round: -3 // arrondi
},
// COUCHE 1 (pays)
{
geojson: world, // géométrie
fill: "white", // couleur de fond
stroke: "none", // cauleur de contour (aucun)
fillOpacity: 0.5 // Opacité
},
{ type: "graticule" }, // Lignes de latitude et longitude
{ type: "outline" } // coutour de la Terre dans la projection
]
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viz = require("geoviz@0.4")
Insert cell
Insert cell
viz.path({ data: world, tip: true })
Insert cell
Insert cell
viz.tile({ url: "worldimagery" })
Insert cell
Insert cell
viewof k2 = Inputs.range([10, 100], { label: "Radius max", step: 1, value: 30 })
Insert cell
viewof field = Inputs.radio(["pop", "gdp"], { label: "Field", value: "pop" })
Insert cell
{
let svg = viz.create({
zoomable: true,
width: 800,
projection: d3.geoNaturalEarth1()
});
svg.outline();

svg.header({ text: "World Population", id: "worldtitle" });

// Countries layer
svg.path({
datum: world,
fill: "white",
fillOpacity: 0.4
});
// Circle layer with default parameters
svg.circle({
id: "bubble",
data: world,
fill: "#38896f",
r: "pop",
tip: true
});

return svg.render();
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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