Giter Site home page Giter Site logo

Comments (8)

Jolanrensen avatar Jolanrensen commented on June 12, 2024 2

I started working on it here https://github.com/Jolanrensen/data2viz/tree/svg-export
It's a first draft, but some basic things seem to work already!
Gradients don't work yet, images probably never will work and I've still got some render issues with entire plots (I probably missed some attributes), but, it's a start :)
Will continue with it later

from data2viz.

gzoritchak avatar gzoritchak commented on June 12, 2024 1

I created a branch with a first commit to initiate the work: https://github.com/data2viz/data2viz/compare/svg-export

from data2viz.

gzoritchak avatar gzoritchak commented on June 12, 2024 1

I merged the current work, and I'm going to release it in version 0.8.17.

We'll have to wait for the HeadlessVizContainer to implement the export for VizContainer (to do some tests).

from data2viz.

gzoritchak avatar gzoritchak commented on June 12, 2024

In fact, there is no need to create a per-platform code. The idea is to generate an SVG string representing the whole node tree. This can be done in the common code with an extension on Viz:

fun Viz.toSvg(): String {
  //...
} 

The first implementation of data2viz was based on D3JS and used SVG. The initial code can be used as an inspiration on how to do the transformation from nodes to SVG string: https://github.com/data2viz/data2viz/blob/aa1f9a3b2ffa1babc470569a95405fb51a9e17bb/viz/d2v-viz-js/src/main/kotlin/io/data2viz/viz/SvgViz.kt

from data2viz.

Jolanrensen avatar Jolanrensen commented on June 12, 2024

I agree. In theory an SVG is nothing more than a string, so no platformspecific code is needed, although having a SVG building library could save us some time. I did find https://github.com/nwillc/ksvg, but it hasn't been updated in a while so I guess we'll have to do it ourself. I'll see what I can do in my spare time, because it does seem very doable indeed :)

from data2viz.

Jolanrensen avatar Jolanrensen commented on June 12, 2024

I created a branch with a first commit to initiate the work: https://github.com/data2viz/data2viz/compare/svg-export

Small question: How efficient should it be? It might be a lot less error-prone to use a class with maps to represent an "SvgComponent", but I can understand this would result in a lot of overhead compared to simply using a string builder... I'll try to figure out something clever yet fast.

from data2viz.

gzoritchak avatar gzoritchak commented on June 12, 2024

The goal is to generate an export from a visualization. The exported SVG will be a subset of the SVG elements and attributes. So the code doesn't have to represent all the possible attributes. You can write idiomatic clever but simple code ;-).

from data2viz.

LouisCAD avatar LouisCAD commented on June 12, 2024

I think we can close this issue as the latest released fixed most text rendering problems, and added support to generate SVG out of a VizContainer?

from data2viz.

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.