Comments (13)
Which version of the JIT are you using? 1.1.3? Could you paste some code so I can see the issue in more detail please?
Thanks
from jit.
yes 1.1.3
//example from the example itself
var json = {
id: "node02",
name: "0.2",
data: {},
children: [{
id: "node13",
name: "1.3",
data: {$color : '#aaa', $type : 'circle'},
children: [{
id: "node24",
name: "2.4",
data: {},
children: [{
id: "node35",
name: "3.5",
data: {},
children: [{
id: "node46",
name: "4.6",
data: {},
children: []
}]
}, .........
the shape does change but not the color as specified in the data.
from jit.
well, i forgot to mention, this not only applies to the spacetree but for hypertree as well...
from jit.
That's not proper JSON. In JSON all keys must be strings. Try setting "$color", "$type", ... instead of $color, $type.
from jit.
already tried that too before, just tried it again, same thing, no effect for the color, but for the rest it does work though, as a mentioned, for the circle shape it does turn into circle compared to the rest which havent been overridden. For the color it remains same as the default specified.
from jit.
Do you have an onBeforePlotNode or something like that configured?
If you don't, could you add an onBeforePlotNode controller and console.log(node.data) to see what's inside? That seems to be very weird if you know what I mean.... all examples use this kind of data.
from jit.
i'm working directly on the example available for download 1.1.3, only added the color parameter to see, for the rest it is as default in your example scripts.
from jit.
on what example?
from jit.
well, i'm not too conversant with the script, simple things i can understand but not the ones you are asking to do, where should i add the console.log(node.data)?
from jit.
example 1
from jit.
Please could you post this as a question in the google group? That way you'll get a faster answer and you'll be able to paste the entire code (or append it). The Google Group's at http://groups.google.com/group/javascript-information-visualization-toolkit . Thanks and sorry for the inconvenience.
from jit.
BTW the example1 in Spacetree adds an onBeforePlotNode handler that is triggered before plotting a node and the code from the example explicitly sets values to the $color property, overriding the ones you setted in the json data. Here:
//This method is called right before plotting
//a node. It's useful for changing an individual node
//style properties before plotting it.
//The data properties prefixed with a dollar
//sign will override the global node style properties.
onBeforePlotNode: function(node){
//add some color to the nodes in the path between the
//root node and the selected node.
if (node.selected) {
node.data.$color = "#ff7";
}
else {
delete node.data.$color;
var GUtil = Graph.Util;
//if the node belongs to the last plotted level
if(!GUtil.anySubnode(node, "exist")) {
//count children number
var count = 0;
GUtil.eachSubnode(node, function(n) { count++; });
//assign a node color based on
//how many children it has
node.data.$color = ['#aaa', '#baa', '#caa', '#daa', '#eaa', '#faa'][count];
}
}
},
from jit.
yes exactly, but then how to make it go through? I this same example above by commenting the line 'delete node.data.$color;' the node accepts the overriden color, but then it doesnt return it back to how it was if the node is clicked... it takes the clicked color. I'll post that in the google group to see what happens.
from jit.
Related Issues (20)
- Too much recursion
- export e Json Data
- An extrenal file Json
- Add bidirectional and double line
- $jit.ForceDirected how can i specific each edge's length
- Bower.json version mismatch
- dynamically loading the tree
- Implement Cushioned Treemaps
- Stacked Bar Chart Show Labels for each stack in the Bar. HOT 1
- bower download is just text HOT 1
- How do I avoid the nodes to extend outside of the visible canvas
- How to make the root node and other nodes start displaying from left not center HOT 1
- Force Directed renders incorrectly? HOT 1
- "offsetY" setting doesn't work after "removeSubtree" call
- when click Node A , how to just show the children nodes belonging to the Node A
- voronoi treemap area
- Class.override doesn't give access to the overriden method
- Node overlapping
- click on children cant set canvas view to center !
- Jit
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jit.