Render/Refresh

1 min read

graph.render()

graph.render();

Render the graph with data onto the canvas.

graph.refresh()

Refresh the canvas when the existing data items' configurations is changed in the source data.

Attention: If there are some new nodes/edges/combos to be added or some nodes/edges/combos to be removed, use graph.addItem / graph.removeItem or graph.changeData instead.

Usage

graph.refresh();

graph.paint()

Repaint the canvas. Use it after changing the item's style or state.

Usage

const item = e.item;
const graph = this.graph;

const autoPaint = graph.get('autoPaint');
graph.setAutoPaint(false);

graph.setItemState(item, 'selected', true);

graph.paint();
graph.setAutoPaint(autoPaint);

graph.setAutoPaint(auto)

Whether to repaint the canvas automatically after updating or deleting items.

Parameters

NameTypeRequiredDescription
autoBooleantrueWhether to repaint the canvas automatically.

Usage

const item = e.item;
const graph = this.graph;

const autoPaint = graph.get('autoPaint');
graph.setAutoPaint(false);

graph.setItemState(item, 'selected', true);

graph.paint();
graph.setAutoPaint(autoPaint);