Comments (8)
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.
I created a branch with a first commit to initiate the work: https://github.com/data2viz/data2viz/compare/svg-export
from data2viz.
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.
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.
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.
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.
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.
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)
- Runtime exception due to wrong casting
- Add a copy() function to all scales
- [VIZ] Stroke properties should be called strokeColor ?
- Handling changing and/or real-time data HOT 4
- Use the latest KotlinX DateTime version HOT 1
- Android version does not support the dashedLine property of the HasStroke interface HOT 1
- Share Meta keys on KEvent
- Upgrade JavaFX to version 11 HOT 1
- Manage multi line rich text
- Wrong measure text on Android and JS when the text starts or ends with whitespaces HOT 1
- Viz appears blurry on a HDPI screen, using Kotlin/JS IR compiler
- Introduce HeadlessVizContainer
- Wrong height of TextNode.measureText()
- Android: Handle view size/measurements better HOT 2
- Force Directed Graphs
- Scaling transformation is missing HOT 1
- chart in loop ? HOT 2
- Fatal Exception: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/Instant; HOT 3
- Add Kotlin's wasm-js target
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 data2viz.