Public
Edited
Sep 18, 2021
3 forks
Insert cell
Insert cell
Insert cell
Insert cell
margin = ({top: 20, right: 30, bottom: 30, left: 40}) // Cambiá estos valores para ver el efecto
Insert cell
Insert cell
// width = 954 // (Opcional, si no está definida se considera que vale lo mismo que el ancho de la celda)
Insert cell
height = 500 // Alto
Insert cell
Insert cell
x = d3.scaleLinear()
.domain([0, 1])
.range([margin.left, width - margin.right]) // x va de (margen izquierdo) -> (ancho - margen derecho)
Insert cell
y = d3.scaleLinear()
.domain([0, 1])
.range([height - margin.bottom, margin.top]) // y va de (altura - margen inferior) -> (margen superior)
Insert cell
Insert cell
xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x))
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