Published
Edited
May 12, 2020
Insert cell
md`# SVG STRING BUG: Wolfram Cloud Free Form 2D Regions

I am pretty sure this is a Mathematica ExportString [ ] bug.

x^2+y^2<1 fails

x^2+y^2>1 works!
`
Insert cell
text = `
Insert cell
graphic = {
const document = new DOMParser().parseFromString(text, "image/svg+xml");
const svg = d3.select(document.documentElement).remove();
const path = svg.selectAll("path[fill='#bbb']");
const timer = d3.timer(() =>
path.attr("fill", d3.interpolateRainbow(Date.now() / 10000))
);
invalidation.then(() => timer.stop());
return svg.node();
}
Insert cell
apifunction = "https://www.wolframcloud.com/obj/9a4f6832-8e27-4549-b994-2308b28e09f9"
Insert cell
input1 = encodeURIComponent(
"implicit region x^2+y^2<1 with range {{-2,2},{-2,2}}"
)
Insert cell
url1 = apifunction + "?x=" + input1
Insert cell
text = (await fetch(url1)).json()
Insert cell
d3 = require("d3@5")
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