Published
Edited
Sep 25, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width, height]);
desenhaMarcas(svg);
svg.append("g")
.call(xAxis1)
.call(xLabel1);

svg.append("g")
.call(yAxis1)
.call(yLabel1);

return svg.node();
}
Insert cell
Insert cell
xAxis1 = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x))

// xAxis1 = g => g
// .attr("transform", `translate(0,${margin.top})`)
// .call(d3.axisTop(x))

// xAxis1 = g => g
// .attr("transform", `translate(0,${height - margin.bottom})`)
// .call(d3.axisBottom(x).ticks(d3.timeMonth.every(3)))
Insert cell
Insert cell
xLabel1 = g => g
.select(".tick:last-of-type text")
.clone()
.attr("text-anchor", "end")
.attr("x", 0)
.attr("y", -10)
.attr("font-weight", "bold")
.text("Semana")

// xLabel1 = g => g
// .select(".tick:last-of-type text")
// .clone()
// .attr("text-anchor", "middle")
// .attr("x", -width / 2)
// .attr("y", margin.bottom * .6)
// .attr("font-weight", "bold")
// .text("Semana")
Insert cell
Insert cell
yAxis1 = g => g
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(y))
Insert cell
yLabel1 = g => g
.select(".tick:last-of-type text")
.clone()
.attr("x", 80)
.attr("font-weight", "bold")
.text("Temperatura (C)")

// yLabel1 = g => g
// .select(".tick:last-of-type text")
// .clone()
// .attr("transform", `rotate(-90)`)
// .attr("x", 0)
// .attr("y", 10)
// .attr("font-weight", "bold")
// .text("Temperatura (C)")

// yLabel1 = g => g
// .select(".tick:last-of-type text")
// .clone()
// .attr("transform", `rotate(-90)`)
// .attr("x", 0)
// .attr("y", - margin.left / 4 * 3)
// .attr("font-weight", "bold")
// .text("Temperatura (C)")

// yLabel1 = g => g
// .select(".tick:last-of-type text")
// .clone()
// .attr("transform", `rotate(-90)`)
// .attr("text-anchor", "middle")
// .attr("x", -(height - margin.top - margin.bottom)/2)
// .attr("y", - margin.left / 4 * 3)
// .attr("font-weight", "bold")
// .text("Temperatura (C)")
Insert cell
Insert cell
Insert cell
legend({
color: fill,
title: "Temperatura (°C)"
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
sizeLegend = legendCircle()
.tickValues([25, 50, d3.max(dados, d => d.chuva)])
.tickFormat((d, i, e) => i === e.length - 1 ? d + " mm de chuva" : d)
.scale(radius);
Insert cell
{
const svg = d3.create("svg")
.attr("height", 90)
.attr("width", 180 + 5)
svg.append("g")
.call(sizeLegend);
return svg.node();
}
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

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