Does anyone know of any DSLs or similar that are s...
# thinking-together
a
Does anyone know of any DSLs or similar that are specific to graph/chart drawing? I.e. a language that defines a function from data to image, specialised toward visualising data? If not, what’s the closest thing? E.g. is there a JS chart-drawing library with an API that feels close to a DSL?
m
m
vega has json-schemas for its configs, but those are huge https://vega.github.io/schema/vega-lite/v4.json so if you fancy some clojure, I got draft lib https://github.com/akovantsev/json-schema-to-clojure-spec specifically to explore those schemas in repl (I don't remember if it handled schemas of such size though :))
t
vega, plot, ggplot, all based off "grammar of graphics" which defines a conceptual toolbox for data -> pixel space.
k
Graphviz and Penrose are two graph DSLs that are quite different from Vega.
t
I've done a thing some time ago that may be relevant: https://compostjs.github.io/compost/ It is fairly small composable DSL for composing visualizations - unlike grammar of graphics libraries (vega), it is more low-level and you construct graphical primitives yourself - but it handles mapping of units from "domain units" to pixels (where domain units can be continuous or categorical) - so the idea is to have something that is a sweet spot between low level drawing and high-level (Vega, D3, etc) libraries...
a
Thank you, Vega does look pretty close to what I’m describing, if one considers that giant JSON schemas like this are standing in for what could probably be a nice and tidy special-purpose language. I will investigate further.
m
schemas are "grammar of a language", not a "message written in a language".