r/javascript • • Jul 18 '16

d4.js — declarative data-driven documents

https://d4.js.org
33 Upvotes

10 comments sorted by

4

u/goshakkk R Jul 18 '16

Some great thought here, Joel!

With React and JSX, I like where the things are headed. I don't think we're far from having reusable SVG components, allowing to express high-level visualizations pretty easily.

Given the tendency... I've also recently experimented with using React to draw to canvas, using an engaging image editor as an example (demo, sources, post on how it works), and I really love how React provides us a baseline to implement, reason about, and use pieces of UI, regardless of where they render — be it native mobile, terminal, canvas, and more.

2

u/joelburget Jul 18 '16

Pabla looks like a very cool project! I'll definitely check it out more after work.

I don't think we're far from having reusable SVG components

What's standing in the way?

2

u/goshakkk R Jul 18 '16

Technically — nothing. I guess it's more of a mindset shift. Like only now people are coming to appreciate reusable UI elements in HTML, but I agree that it'll spread to SVG and all sorts of other components.

1

u/TeamHelloWorld Jul 18 '16

Is there an example of transitions?

d3 transitions are really easy to do, but I haven't seen/figured out how to do them well with react(or ember); I end up writing a lot of code to simulate a tween transition.

1

u/jij Jul 18 '16

Why wouldn't you just dispatch events into d3 and let it handle it?

https://bl.ocks.org/mbostock/5872848

1

u/flying-sheep Jul 18 '16

i tend to use CSS transitions. they’re more performant anyway.

1

u/tbranyen Jul 19 '16

How do they relate to SVG? Seems like Web Animations are more in line with SVG stuff than CSS animations meant for HTML elements.

1

u/flying-sheep Jul 19 '16

“web animations”?

I only know SMIL and CSS animations/transitions. SVG can do both

1

u/tbranyen Jul 19 '16

Pretty sure css transitions dont work with svg attributes making them useless. Siml is deprecated?

1

u/flying-sheep Jul 19 '16

you’re right. CSS can only animate properties that have a CSS equivalent (e.g. fill, but not cx)

in the end i had to do e.g. all placement that i wanted to animate into transforms (which are animatable via CSS)