CANVE / canve-viz

CANVE visualizer UI
3 stars 1 forks source link

Replace D3 rendering with custom SVG solution #31

Closed danielabar closed 8 years ago

danielabar commented 8 years ago

Continue to use the D3 force layout to assign node positions (i.e. x and y values), but replace the rendering with custom SVG elements.

It doesn't have to be simple circles and lines, could be any custom design to represent source nodes. For example, different types like Class, Value etc. could be drawn differently. Although to start, might be simpler to just do circles and lines at first.

This will probably end up splitting into multiple issues as more complexity is discovered. Have to support drag and drop, keeping the edges connected as nodes move around, animations/transitions etc.

Consider an approach where each Node and Edge is implemented as an Aurelia custom element. Each node can accept properties via data binding such as its display text, position, etc. Then the node viewModel can expose display properties that are a function of the inputs (for example, each type can be a different color, size of node can be function of lines of text etc.).

Then the parent component or view can loop over the nodes to place them in the DOM.

matanox commented 8 years ago

Yep. Consider circles to begin with though (or indeed), because cognition research tell us that people are attracted to round shapes, whereas spiky shapes signify danger or discomfort (there's little in nature that is spiky that is not harmful).

matanox commented 8 years ago

I'd split this to a first item/aim of "merely" rendering everything as a circle, feeding from the d3 force layout computation engine. Let me know if you'd like me to carve out where that "engine" part sits in any particular branch. The sooner we do this overall item, the cleaner we go forward....

And I said "merely" above, because it's not that naive putting it together for the first time, plus it's a first dive into raw SVG that requires wearing the SVG hat. But it's easy if you "view source" on the nodes rendered by d3 - that shows you what the SVG element should be like when in doubt :)

matanox commented 8 years ago

Last but not least - to avoid duplicate work - need a research task to consider whether GreenSock makes sense for the drawing or how to work GreenSock compatible. Overall all fun tasks requiring some investigation and a lot of pixel patience :)

danielabar commented 8 years ago

re: gsap - my understanding is its for animation, but doesn't help with drawing or svg, so that would be a separate issue.

danielabar commented 8 years ago

Fix the custom node element with a nested svg tag, as explained here

danielabar commented 8 years ago

Also follow steps in force layout from d3 docs to compute static layout

danielabar commented 8 years ago

TODO's

Some of these might move to be separate issues