Comments (6)
If you set :static-embed :svg
it will use darkstar instead of npm, so won't touch the filesystem.
from oz.
Hi @LouDnl. Thanks for posting here.
The problem here is that oz is trying to generate a static image to embed in the page, which then gets replaced by the live/interactive vega visualization once the dom loads up. To do this, it's incidentally calling out to the which
command, which is a linux command.
I'm happy to accept a PR to make this code Windows compatible, but I don't use Windows, so I'm probably not the best person to work on this.
If you're fine not having the statically embedded image (which, to be honest, is a pretty minor convenience in most scenarios; it's mostly there so that if js is turned off, you can still see the plots, such as in Dropbox previews, or for converting to PDF), you can just keep using the existing code unaltered. If it's important to you though, you could try using the WSL for Windows, which was getting pretty good last time I tried it, and to my understanding has only gotten better.
Please let me know if I can be of further help with this.
Thanks again!
from oz.
PS I think the correct behavior here would be for Oz to try to use darkstar to compile a static svg instead of png via the vega npm cli(s) if it's not able to find the latter. The default/fallback behavior here could probably use a review and revamp, as it doesn't always do what you'd want at the moment.
from oz.
Hi @metasoarous , thanks for your reply. Is it possible to disable the local generation of a static image by supplying an option? I have tried to find it but failed.
For security reasons I'm not really into code accessing local filesystems in a production environment.
from oz.
I think I found a workaround, will use this:
(embed-vega-form {:vega-embed-opts {:live-embed? true :static-embed false}}
{:mode :hiccup
:doc [:vega-lite {:description "Bar chart with text labels. Set domain to make the frame cover the labels.",
:data {:values [{:a "A", :b 28},
{:a "B", :b 55},
{:a "C", :b 43}]},
:encoding {:y {:field "a", :type "nominal"},
:x {:field "b", :type "quantitative", :scale {:domain [0, 60]}}},
:layer [{:mark "bar"}, {:mark {:type "text",
:align "left",
:baseline "middle",
:dx 3},
:encoding {:text {:field "b", :type "quantitative"}}}]}]})
from oz.
Almost, this works:
(oz/embed-vega-form {:vega-embed-opts {:live-embed? true :static-embed false}}
[:vega-lite {:description "Bar chart with text labels. Set domain to make the frame cover the labels.",
:data {:values [{:a "A", :b 28},
{:a "B", :b 55},
{:a "C", :b 43}]},
:encoding {:y {:field "a", :type "nominal"},
:x {:field "b", :type "quantitative", :scale {:domain [0, 60]}}},
:layer [{:mark "bar"}, {:mark {:type "text",
:align "left",
:baseline "middle",
:dx 3},
:encoding {:text {:field "b", :type "quantitative"}}}]}])
from oz.
Related Issues (20)
- Support streaming data into a visualization via core.async chan
- More idiomatic support for reactive data updates (via reagent atom/reaction data inputs)
- More idiomatic support for reactive Vega signals (as reagent atoms/reactions)
- Add option to ingest clj file comments as markdown
- Add function for setting global compile option defaults
- Progressively stream clj file and markdown block evaluations to client
- Stop using prewalk on client for applying components to hiccup docs
- Live-reloading styles
- Add cli
- Oz does not seem to respect the xOffset setting HOT 5
- Clarify that 1.6.0-alpha36 is the current version HOT 2
- Bump vega-lite to 5.2.0 HOT 1
- live-view! function should work on directories HOT 3
- export! error with png
- WARN Missing type for channel "order", using "quantitative" instead.
- Issues using spec with new notebook features
- rebuilding when output file is missing (but input has not changed)
- memory leak when updating reagent component HOT 7
- Incorrect rendition when using `oz/view!`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oz.