Public
Edited
Feb 22
2 stars
Insert cell
Insert cell
viewof reverseDomainPlot = drawTernaryPlot(reverseTernaryPlot, data)
Insert cell
reverseTernaryPlot = {
const reverseTernary = barycentric()
.a((d) => d.agriculture)
.b((d) => d.industry)
.c((d) => d.service)
.rotation(240);

return ternaryPlot(reverseTernary)
.labels(labels)

.labelAngles([-60, 0, 60])
.tickAngles([-60, 0, 60])
.tickFormat((t) => formatPercentage(1 - t))
.tickTextAnchors(["end", "start", "end"]);
}
Insert cell
formatPercentage = d3.format(".0%")
Insert cell
d3Ternary = import("d3-ternary")
Insert cell
barycentric = d3Ternary.barycentric
Insert cell
ternaryPlot = d3Ternary.ternaryPlot
Insert cell
import {
labels,
data,
drawTernaryPlot,
valuesTable
} from "@julesblm/d3-ternary"
Insert cell
d3 = require('d3@v6')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more