0

I have a problem. I know, that this problem is solved here, but I don't know how show it in JS code. I have

   style: cytoscape.stylesheet()
 .selector('node')
   .css({
   'shape': 'data(faveShape)',
   'background-color': 'data(faveColor)',
    'content': 'data(name)',
    'text-valign': 'center',
    'color': 'white',
    'text-outline-width': 2,
    'text-outline-color': '#888',
    'width': 100,
    'height':65
   })

and I create nodes by this code

 elements: {
nodes: [
  { data: { id: 'k', name: 'Kramer','faveColor': '#6FB1FC', 'faveShape' : 'roundrectangle'} },
  { data: { id: 'g', name: 'George','faveColor': '#6FB1FC', 'faveShape' : 'roundrectangle'} }
],

Error: Do not assign mappings to elements without corresponding data (e.g. ele ele3 for property shape with data field faveShape); try a [faveShape] selector to limit scope to elements with faveShape defined

Community
  • 1
  • 1
Dmitry
  • 73
  • 2
  • 11

1 Answers1

0

Sorry for my silly question. I solved the problem by changing parameter handleLineType to straight.

Erik Kaplun
  • 37,128
  • 15
  • 99
  • 111
Dmitry
  • 73
  • 2
  • 11
  • That works because you no longer have an edge preview, just a line instead. Follow the instructions in the error message and you won't have an issue. You shouldn't be using universal selectors like `node` if you want to use UI extensions. – maxkfranz Mar 21 '16 at 18:22