calebeaires
calebeaires

Reputation: 2094

cytoscape css selector to an nested object

I am working with a project with cytoscape.js that its data node has this object.

data = {
  id: "some-id-here"
  name: "Area Chart",
  description: "Some cool chart"
  report: {
     type: "areachart",
     data: [{
        label: [...],
        series: [...]
        }
     ]
  }
}

I intend to put an different icon to each of the charts on the board. I am tring to do so with the cytoscape.stylesheet() function like above:

cytoscape.stylesheet()
.selector('node[report\\.type = \'areachart\']')
.css({
    'background-image': 'assets/img/flow/bg-areachart.png'
})

Even if I follow the Notes & Caveat instructions, this example does not work. Does cytoscape.js has support on selecting nested object property? If so, how can I make it work?

Upvotes: 0

Views: 673

Answers (1)

maxkfranz
maxkfranz

Reputation: 12250

It's not supported, and I think it would probably be too expensive to support. The selectors are intended only for simple data comparisons. You can either flatten your object or you can use a custom mapper function that differentiates types of nodes and their associated background images: http://js.cytoscape.org/#style/mappers

Upvotes: 1

Related Questions