Reputation: 91
Is there a way to display a node label centered inside the node such as cytoscape desktop does by default?
Upvotes: 5
Views: 7331
Reputation: 103
Yes, you can control this with the labelValign
property as explained in the Wiki StyleObject description. For example:
var myStyle = {
selectors: {
"node": {
labelValign: "middle",
... } } }
$("#cy").cy({style: myStyle, ... })
Upvotes: 3
Reputation: 1397
From the official and actual documentation - text-valign and text-halign are the way to go. They are certainly not css properties however. The possible options are: text-halign - left, center, or right; text-valign - top, center, or bottom.
These options work only for nodes, not for edges.
Offical documentation for more info
Upvotes: 0
Reputation: 428
I set css style for nodes and it works:
"text-valign" : "center"
"text-halign" : "center"
Upvotes: 17