Giter Club home page Giter Club logo

Comments (5)

behrica avatar behrica commented on May 20, 2024 3

I use vega-lite with org mode.

The main idea is to do this 3 steps to include a vega lite spec in a org mode file:

a)
In a "clojure" block:

  1. Specify the "spec"
  2. Convert spec to json and write to disk
(def spec ....
(spit "spec.vl"
 (json/generate-string spec))

b)
In a following "shell block":

  • convert the json to a svg file using the command line utils
#+BEGIN_SRC shell
vl2svg spec.vl  spec.svg
#+END_SRC

c)
Include the "svg" file into org mode via

 [[file:spec.svg]]

from oz.

metasoarous avatar metasoarous commented on May 20, 2024

Hi @joinr. Thanks for posting this issue.

As I mentioned on slack, I don't use emacs, and am probably not the best person to be working on this, but I think it's a great idea, and encourage you or any one else interested to put forward a proposal.

Thanks again.

from oz.

vladkotu avatar vladkotu commented on May 20, 2024

@behrica is right - i was able to use vega charts in org-more by relaying on vega-cli tool.
You even don't need oz for that.Here is example for reference

from oz.

yubrshen avatar yubrshen commented on May 20, 2024

Although @behrica's work-flows works,
I wish to be able to write spec in Clojure via Oz, and automatically
get the svg file generated and embedded in org-mode buffer.
The desired work-flow should be similar to the code block of plantuml.

For example,

#+BEGIN_SRC oz :exports :file ./from-vega-lite.svg
spec in Clojure via oz
#+END_SRC

You may find some examples of how convenient to specify diagram with plantuml with org-mode's code block.

With this support, I will be able to use org as markdown syntax to
write document with oz for vega-lite specification, without manually
handling the generation of vega-lite figure generation and embedding the
generated file.

from oz.

metasoarous avatar metasoarous commented on May 20, 2024

Hey @yubrshen.

Right now, you could do something equivalent to what @behrica suggests by using oz.core/export!. For svg, this will try to use graalvm to render (without having to install the vega-cli using npm or whatever), but for jpg you need canvas, which I don't think graalvm supports yet (though I'd love for someone to prove me wrong on this). This reduces the steps in your org-mode files to 2 instead of 3. You would still need to include the file into org-mode the way @behrica describes (step c).

If there's a way to facilitate a one step process in org-mode, I'm more than happy to accommodate that. I just don't know enough about org-mode to be of much help sorting out that side of it.

The other thing I would really like to support in Oz is ingest of org-mode files and interpretation as hiccup. Perhaps we can even extend Oz's notion of parallelized clj code execution, so that you could use Oz's notebook functionality with org-mode files. I don't know how much control org-mode gives you over what sort of output formats/templates are available, but Oz is quite flexible in this regard, and only becoming more capable. So perhaps it would be useful to have a flexible rendering system (static site generation, pdf documents, etc) for org-mode files?

Happy to discuss more if anything like that makes sense.

Thanks again

from oz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.