GithubHelp home page GithubHelp logo

Comments (13)

philogb avatar philogb commented on July 16, 2024

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.

fl-Ash avatar fl-Ash commented on July 16, 2024

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.

fl-Ash avatar fl-Ash commented on July 16, 2024

well, i forgot to mention, this not only applies to the spacetree but for hypertree as well...

from jit.

philogb avatar philogb commented on July 16, 2024

That's not proper JSON. In JSON all keys must be strings. Try setting "$color", "$type", ... instead of $color, $type.

from jit.

fl-Ash avatar fl-Ash commented on July 16, 2024

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.

philogb avatar philogb commented on July 16, 2024

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.

fl-Ash avatar fl-Ash commented on July 16, 2024

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.

philogb avatar philogb commented on July 16, 2024

on what example?

from jit.

fl-Ash avatar fl-Ash commented on July 16, 2024

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.

fl-Ash avatar fl-Ash commented on July 16, 2024

example 1

from jit.

philogb avatar philogb commented on July 16, 2024

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.

philogb avatar philogb commented on July 16, 2024

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.

fl-Ash avatar fl-Ash commented on July 16, 2024

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)

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.