Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
d3.js - Add parameter/data to nodes

I have a working d3.js (v 4.0) hierarchical tree. Each level in the tree structure has a type parameter field determined in the process of creating the JSON from a MySQL database.

An example of the JSON is at the end.

I want to add another data/parameter field dynamically in the d3.js script where nodes d.type == 'unit'.

That data/parameter field can be called dv.

I would need to do a separate query on the unit table for this in another script, then iterate through those nodes, where nodes d.type == 'unit', for example to change the node's appearance if dv equals something.

How should this be done?

E.g. from

  d3.json("json/data.json", function(treeData) {

Example JSON:

 "name": "1.1 Ensure the appropriateness of sample collection procedures",
              "column_to_sort_by": null,
              "type": "program_outcome",
              "children": [
                {
                  "name": "PATH5121 Clinical Biochemistry",
                  "column_to_sort_by": "PATH5121 Clinical Biochemistry",
                  "children": [
                    {
                      "name": "Learning Events - PATH5121",
                      "column_to_sort_by": null,
                      "type": "unit_group"
                    },
                    {
                      "name": "Assessments - PATH5121",
                      "column_to_sort_by": null,
                      "type": "unit_group"
                    }
                  ],
                  "type": "unit"
                },
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!