Is it possible to target nodes with some important values?
The "category" in the node: Dataset, I'm trying to provide a different color to it, I suppose it is possible. I am thinking that if I can write any kind of statement then
if (d.node.category == dataset) {d3.select (this). Style ("fill", "yellow"); } In this way I am now adding color to nodes
var z = d3.scale.category10 (); Var node = svg.selectAll ("circle.node") .data (nodes) .enter () .andend ("svg: circle") .attr ("r", function (d) {return d.size * 2} ). Style ('Square', 'General Category'). Style ("fill", function (d) {return z (dprent);}) style ("stroke", "# 000"). Style ("stroke-width", "4px"). Call (force drag); My JSON looks like
function getNodes () {var in these nodes = {"name": "APP", "department": "NYC "," Children ": [{" name ":" API1 "," department ":" third party "," size ": 15," url ":" http://www.nytimes.com/ "}, {"Name": "API 2", "department": "NYC", "size": 15, "url": "https://www.google.com/"}, {"name": "dataset" , "Category": "Dataset", // This is one I am trying to assign to a difference coloring "Department": "Third party", "Size": 15, "url": "http: // www .wired.com / ",}]," size ": 20," url ":" http://www.nyc.gov/html/index.html "}; Returns in nodes; }
Can you just provide a different location when the category is present? (prepaid), data (DNA). (Data). (Data). () '.' D.category === 'Dataset'? 'Red': 'defaultColor');});
No comments:
Post a Comment