Coder Social home page Coder Social logo

Comments (6)

Kcnarf avatar Kcnarf commented on May 19, 2024 2

The d3-voronoi-treemap plugin now provides repeatability/reproducibility through the new prng(...) API.

This API is now available on master branch, and on the new 1.0.0 release.

from d3-voronoi-treemap.

Kcnarf avatar Kcnarf commented on May 19, 2024

Hi,
you're right: currently, this plugin produces a static, one-shot, Voronoï treemap, and it doesn't take into account neither reproducibility, nor animation/self-update:

  • reproducibility is not available because it internally uses Math.random() to place/replace sites ; I guess using a seed-able random function will do the trick.
  • self-update is not available because the algorithm does not suit this requirement. The algorithm is recursive (top->down):
    • in order to compute the treemap of sibling data , the parent's polygon must be known ;
    • and at each stage, computing the treemap of siblings considers a non-changing/static polygon ;

Changing the algorithm to one that can handle live-update/simulation will be hard job.

For your information, I'm working on these two requirements (reproducibility, simulation) for the d3-voronoi-map plugin (the 1-level version of this plugin, see the simulation branch of d3-voronoi-map). But I don't yet figure out how to transpose this work to this plugin, because of the nested/recursive aspect of the treemap.

from d3-voronoi-treemap.

michaschwab avatar michaschwab commented on May 19, 2024

That's excellent to know, thanks!

I think if a stable voronoi-map would suffice for me. I'm aware that voronoi-map is used recursively for this plugin.

Do you think it would be a reasonable approach to try to set the same seed points instead of using a random seed function in the update function? If you think this approach could work I might build it in a fork (with pull request if you'd like).

For your work on the improved d3-voronoi-map, what's the approach? And do you have a concrete timeline? I might be able to help out if you're interested and if the abovementioned approach doesn't work.

from d3-voronoi-treemap.

Kcnarf avatar Kcnarf commented on May 19, 2024

try to set the same seed points instead of using a random seed function

For reproducibility, that's what must be changed.

The simplest way do provide reproducibility is to replace Math.random() by a seed-able PRNG (https://gist.github.com/blixt/f17b47c62508be59987b).

My preference will be to use (or mimic) d3-voronoi-map's APIs initialPositions and initialWeights. It let the user defines its own initial placement/weight of seeds. This block uses the initialPositions() APIs. Seed points are positioned inside a quasi-circle 60-sides polygon.

The problem is more difficult with the treemap because of nested data: you can not know what is the parent polygon before computation. One way to be sure to position seed points inside the computed polygon will be to find a inner circle of the polygon, and position seed points inside this circle, in a repeatable way.

For your work on the improved d3-voronoi-map, what's the approach?

I use the same approach as d3-force (wihtout heating): an internal d3-timer runs. At each tick, the timer runs 1 iteration of the treemap algorithm

And do you have a concrete timeline?

Sorry, no concrete timeline.
The use-case example is not finished. That's why it is still not merged into master. Furthermore, this will upgrade d3-voronoi-map to version 2 (API break, no backward compatibility).

from d3-voronoi-treemap.

Kcnarf avatar Kcnarf commented on May 19, 2024

For transitioning from one shape to another, you can take a look at flubber: 'Tools for smoother shape animations'.

There is even a demo that deals with transitioning from/to a circle shaped Voronoï treemap and a regular rectangular treemap.

from d3-voronoi-treemap.

Kcnarf avatar Kcnarf commented on May 19, 2024

Closing as

  • stability is available since v1.0.0 through prng(...) API
  • the update need (from initial comment: In my use case, the clip changes, and transitions between a rectangle and an ellipse and back.):
    • smoothly transitioning between several clipping polygon has never been intended to be handled
    • even when considering a static clipping polygon, the way the plugin works (recursive computation of inner cells) is not able to smoothly update cells at different levels, and hence is not compatible with the need; it requires a new approach, with is currently out of scope

from d3-voronoi-treemap.

Related Issues (13)

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.