@maxgraph/core
    Preparing search index...

    Class FitPlugin

    A plugin providing methods to fit the graph within its container.

    0.17.0

    Implements

    Index

    Constructors

    Properties

    maxFitScale: null | number = 8

    Specifies the maximum scale to be applied in fit and fitCenter. Set this to null to allow any value.

    8
    
    minFitScale: null | number = 0.1

    Specifies the minimum scale to be applied in fit. Set this to null to allow any value.

    0.1
    

    0.21.0

    pluginId: "fit" = 'fit'

    Methods

    • Scales the graph such that the complete diagram fits into Graph.container and returns the current scale in the view. To fit an initial graph prior to rendering, set GraphView.rendering to false prior to changing the model and execute the following after changing the model.

      graph.view.rendering = false;
      // here, change the model
      graph.getPlugin<FitPlugin>('fit')?.fit();
      graph.view.rendering = true;
      graph.refresh();

      To fit and center the graph, use fitCenter.

      Parameters

      • options: FitOptions = {}

        Optional number that specifies the border.

      Returns number

      0.21.0