Support separate but local data files via data.url property for Vega-Lite
See original GitHub issueThank you very much for supporting Vega and Vega-Lite. I works nicely.
I have a specific request regarding the location of the visualized data:
I prefer keeping the visualized data in a separate and local local file (instead of inlined in the diagram specification) via the “data.url” property (https://vega.github.io/vega-lite/docs/data.html#url), because it can be smaller (e.g. CSV instead JSON), can be edited easier, there is a better separation of concerns…
Example: I prefer
{
"data": {
"url": "data.csv"
}
}
over
{
"data": {
"values": [
{
"a": "2020-01-05",
"b": 0.3,
"c": "C1"
},
{
"a": "2020-01-15",
"b": 0.7,
"c": "C1"
}
]
}
}
A separate data file is currently not possible with “asciidoctor-kroki” (It works when using Vega-Lite directly.), because an error is created:
Skipping vegalite block macro. No such file: https://kroki.io/vegalite/svg/....
I suppose, that the reason for this error is, that the referenced file containing the data (i.e. “data.csv”) is not uploaded to kroki. One “workaround” could therefore be to make “data.csv” publicly available:
{
"data": {
"url": "http://.../data.csv"
}
}
But this does not work either (It works when using Vega-Lite directly, i.e. without “asciidoctor-kroki”). Even if this remote URL would work, it would have the disadvantage the file must be available before the asciidoctor generation with :kroki-fetch-diagram: true
.
I created a public repo where you can find all three variants: https://gitlab.com/winni/asciidoctor-kroki-vegalite
The generated result can be found here: https://winni.gitlab.io/asciidoctor-kroki-vegalite/test.html
I don’t know if there is a feasible solution to support local data files and how much effort it would be to implement.
Perhaps the “workaround” with remote URLs can be implemented easily (or could it cause a security problem)?
I don’t know if this is a very special use case in combination with Vega-Lite, or if this or similar requirements would make sense for other types of diagrams.
What do you think?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top GitHub Comments
I didn’t know that. That’s cool!
I’m convinced. Your proposition is the right way to go.
Yes, KISS.
Yes and I agree that Vega-Lite is very nice.
I’ll try and I will certainly have questions. Thanks for your offer to help.
Kroki does not fetch data from local or remote location for security reasons. I’m not a security expert but I believe that it’s a major security concern to load arbitrary data from untrusted origin.
Yes you are absolutely right.
Indeed, I think that’s the right way to solve this issue 👍