refreshData method

void refreshData(
  1. dynamic data
)

Implementation

void refreshData(data) {
  // ignore: invalid_use_of_internal_member
  world.children.clear();
  graph = convertor.convertGraph(data);
  graph.vertexes = graph.vertexes.toSet().toList()
    ..sort((key1, key2) => key1.degree - key2.degree > 0 ? -1 : 1);
  setDefaultVertexColor();
  algorithm.onGraphLoad(graph);
  for (var edge in graph.edges) {
    var ec = EdgeComponent(edge, graph, context)..scaleNotifier = scale;
    edge.cpn = ec;
    world.add(ec);
  }
  for (var vertex in graph.vertexes) {
    var vc = VertexComponent(
      vertex,
      graph,
      context,
      algorithm,
      options: options,
      graphComponent: this,
    )..scaleNotifier = scale;
    vertex.cpn = vc;
    world.add(vc);
  }

  createLegend();
  options.graphStyle.graphColor(graph);
}