user4083185
user4083185

Reputation:

Change default size of nodes

I'm starting to use this awesome library and I want to do a very simple thing: change the size of my nodes.

When I get the nodes from my server, they have a size attribute, which is an integer between 1 and 6. I would like to display the size of the node in consequence.

I've tried with the weight attribute:

for (var i = 0; i < self.galaxy.nodes.length; i++) {
        cy.add({
            group: 'nodes',
            data: { id: self.galaxy.nodes[i].id.toString(), weight: self.galaxy.nodes[i].size },
            position: { x: self.galaxy.nodes[i].x , y: self.galaxy.nodes[i].y}
        });
    }

But unfortunately, the size remains constant, and I can't find a direction in the doc. Do you have some clue for me?

Upvotes: 8

Views: 6077

Answers (1)

maxkfranz
maxkfranz

Reputation: 12242

You can set the width and height of nodes in your stylesheet, probably using a mapper on weight.

Upvotes: 5

Related Questions