elkjs icon indicating copy to clipboard operation
elkjs copied to clipboard

Interactive setting for radial layout

Open alexkoxsecurity opened this issue 2 years ago • 5 comments

I am aiming to achieve the desired layout while minimizing changes to nodes that have a defined position. I've applied all settings that appear to be related to fixed positions, using various combinations, but the layout still does not correspond to the position field. In this example, I used random positions just to observe any changes, but the layout remains unchanged.

const graph = {
    id: 'root',
    layoutOptions: {
      'elk.algorithm': 'radial',
   
    
      'elk.interactive': 'true',
      'elk.interactiveLayout': 'true',
      'cycleBreaking.strategy': 'INTERACTIVE',
      'layering.strategy': 'INTERACTIVE',
      'elk.layered.layering.strategy': 'INTERACTIVE',
      'elk.alg.layered.options.LayeringStrategy': 'INTERACTIVE',
      'elk.layered.crossingMinimization.strategy': 'INTERACTIVE',
      'elk.layered.crossingMinimization.semiInteractive': 'true',
     
     
    },
    children: nodes.map(n => ({
      id: n.id,
      width: 60,
      height: 60,

      layoutOptions: {
        'elk.position': `(${Math.ceil(Math.random() * 1000)},${Math.ceil(
          Math.random() * 1000,
        )})`,
      },
    })),
    edges: edges.map(e => ({
      id: e.id,
      sources: [e.source],
      targets: [e.target],
    })),
  }; 

alexkoxsecurity avatar Nov 27 '23 13:11 alexkoxsecurity

Interactive layout does not work for the radial algorithm. Similarly the following options:

      'elk.interactive': 'true',
      'elk.interactiveLayout': 'true',
      'cycleBreaking.strategy': 'INTERACTIVE',
      'layering.strategy': 'INTERACTIVE',
      'elk.layered.layering.strategy': 'INTERACTIVE',
      'elk.alg.layered.options.LayeringStrategy': 'INTERACTIVE',
      'elk.layered.crossingMinimization.strategy': 'INTERACTIVE',
      'elk.layered.crossingMinimization.semiInteractive': 'true',

only work for the layered algorithm. You can find all radial options here.

soerendomroes avatar Nov 28 '23 13:11 soerendomroes

@soerendomroes Thanks. As I understood there is no way to define desired place for specific node on the circle?

alexkoxsecurity avatar Nov 28 '23 13:11 alexkoxsecurity

@Eddykasp do you know whether this works? To my understanding the order is determined by the order in the model.

soerendomroes avatar Nov 28 '23 13:11 soerendomroes

I can change the order by using sorter and orderId fields, but I would like also to have some of the nodes always above / under / on the right or left sides of the root node

alexkoxsecurity avatar Nov 28 '23 13:11 alexkoxsecurity

I don't think that's currently possible.

Eddykasp avatar Nov 28 '23 14:11 Eddykasp