GithubHelp home page GithubHelp logo

Comments (2)

nylen avatar nylen commented on May 26, 2024

Yeah, this would be really nice to have.

Loading the data is more convoluted than necessary. This is simply because I had a dataset in the format like objects.json that you see, and I needed to get it into the format that d3.layout.force consumes (data values + the links between them, with source and target properties).

Here is roughly the code path for transforming and loading the data:

  1. script.js#L17 - Browser makes a request to json.php
  2. common.php#L93 - Server reads objects.json which has depends (child dependencies) for each object, and uses them to compute dependedOnBy (parent dependencies). Also loads documentation for each object
  3. script.js#L83 - Browser computes graph.links which is the list of { source: x, target: y } objects that d3.layout.force() needs.

So, to implement a simple filter, I'd put some code in between steps 2 and 3 above. See #13 for a code sample.

To make the filter fully dynamic (so that it does not require a page refresh), there would be a good bit more work needed - I didn't anticipate that sort of usage when I wrote the code. When the filter changes, you'd probably want to track which objects and links are changing visibility as a result, and use the standard d3 enter and exit selections to add/remove them from the DOM. Then, you'd want to recompute the force layout with graph.force.start() or similar.

(A semi-related enhancement: update the layout when the browser window is resized. See #15 for that.)

from d3-process-map.

sinetwo avatar sinetwo commented on May 26, 2024

Thanks for the detailed response Nylen, I'll let you know our findings and provide you with a sample once we have it working. I'll detail some simple tests as well and keep flexibility in mind so we can push it.

We may stick to the easier solution of refreshing the page as that's acceptable for our purpose.

from d3-process-map.

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.