0

I am specifying the cytoscape.js style via css (and converting to the JSON format using this). I am trying to use a discrete mapper for the style. Similar to How to use a descreteMapper like on cytoscapeweb? but I don't want to just pass through the data(blah) value, I want to set different values based on different data(blah) values. Like this (which I based off what I found here)

node { 
   color : {
        defaultValue: red,
        discreteMapper: {
            attr: n_phosphorylated,
            mapped: {
                true: blue
            }
    }};
}

I am getting TypeError: element._private.style.color.value is undefined. Do I have the syntax wrong or is this not supported?

Community
  • 1
  • 1
andy
  • 1,399
  • 3
  • 12
  • 32

1 Answers1

0

Found the answer from this comment: How to create custom style mapping in cytoscape.js?

The correct way is to use selectors based on the data:

node[?n_phosphorylated] {
    color: blue;
}

Here the ? operator means (roughly) n_phosphorylated=true.

Thanks Max

Community
  • 1
  • 1
andy
  • 1,399
  • 3
  • 12
  • 32