In my previous post I'm all excited about Vega, a way to represent data visualizations in a JSON structure. But as I half-expected, I'm actually going in a different direction now. I've discovered that there's a difference between data-driven visualization libraries like Vega, (and d3.js, after all, stands for data-driven documents), and dynamic math libraries like JSXGraph. Everything I've seen in the data-driven libraries expects a data set that can then be displayed in many possible ways. In contrast, you can tell JSXGraph to create two points, then create a circle or line connected to those two points, and everything is draggable by default. This is similar to another library I was considering but haven't tried: two.js
I've pretty much realized that Vega's JSON structure isn't a necessary enough property to make up for what it lacks, which JSXGraph has: built-in interactive geometry features. Here's a demand-supply graph that has dotted lines stuck perpendicular at the axes to the two lines' intersection. As flexible as d3/vega seem to be, this kind of thing seems to be easier in JSXGraph. As far as storing the configuration options to create these graphs, I'm sure I'll figure something out.