Public
Edited
Jul 24, 2024
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
tkliteGamble = FileAttachment("TikTok Lite@1.json").json()
Insert cell
tkStd = FileAttachment("TikTok@1.json").json()
Insert cell
reduction = _.map(tkStd, function (countryColl) {
let tlsd = _.find(tkliteBudget, { two: countryColl.two, available: true });
let tl = _.find(tkliteGamble, { two: countryColl.two, available: true });
let t = countryColl.available == true;
let value = (tlsd ? 5 : 0) + (t ? 1 : 0);
let block = "Access Deny";
if (tl) block = "Gambler";
else if (tlsd || t) block = "Standard";

return {
CountryName: countryColl.name,
value,
block
};
})
Insert cell
reduction
X
value
Y
CountryName
Color
value
Size
Facet X
block
Facet Y
Mark
dot
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
height = 480
Insert cell
projection = d3.geoEqualEarth()
Insert cell
path = d3.geoPath(projection)
Insert cell
function render(source) {
const svg = d3
.create("svg")
.attr("viewBox", [0, 0, width, height])
.style("width", "100%")
.style("height", "auto");

var path = d3.geoPath().projection(projection);

svg
.append("defs")
.append("pattern")
.attr("id", "diagonalHatch")
.attr("patternUnits", "userSpaceOnUse")
.attr("width", 4)
.attr("height", 4)
.append("path")
.attr("d", "M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2")
.attr("stroke", "#000000")
.attr("stroke-width", 1);

svg
.selectAll("path")
.data(countries.features)
.enter()
.append("path")
.attr("d", path)
.style("fill", (d, i) => {
alert(d);
let unreach = _.find(source, {
two: d.properties.ISO2,
reachable: false
});
if (unreach) return "url(#diagonalHatch)";
let match = _.find(source, {
two: d.properties.ISO2,
available: true
});
return match ? "#d0ff8a" : "#ffbe6f";
})
.style("stroke", "#dc8add")
.attr("stroke-width", 0.5);

return svg.node();
}
Insert cell
viewof color = Inputs.color({label: "Favorite color", value: "#4682b4"})
Insert cell
_.filter(tkStd, {reachable: false})
Insert cell
_.countBy(tkStd, 'available')
Insert cell
Insert cell
Insert cell
Insert cell
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