Tim Hardy Tim Hardy - 22 days ago 6
Javascript Question

Cytoscape - Do not assign mappings to elements without corresponding data

I have followed the advice in the error message, but I'm still getting the error. I have a selector like the following...

{
selector: 'node[shape]',
css: {
'shape': 'data(shape)'
}
}


... so, I am only using the shape property on elements that have shape defined, yet I am still getting this error. If you remove this particular selector from the code, the error goes away, but I still don't have any shapes. The property is only used inside this very particular selector. Also, the data is defined on ALL elements, so this error should never be happening. Whatever mechanics are going on behind the scenes should not be generating errors.

Here is a jsfiddle demonstrating this problem - https://jsfiddle.net/thardy/gbascrhw/8/

Any help will be greatly appreciated.

Answer

You didn't specify a shape for one of the nodes. roundrect is not a valid value, and so you haven't specified anything for that node.

Refer to the docs for valid values: http://js.cytoscape.org/#style/node-body