GeezerVison is showing maxgraph.github.io — FitPlugin | @maxgraph/core
A plugin providing methods to fit the graph within its container.
Constructors
constructor
-
Constructs the plugin that provides fit methods.
Returns FitPlugin
Properties
maxFitScale
maxFitScale: number | null = 8
Specifies the maximum scale to be applied in fit and fitCenter. Set this to null to allow any value.
minFitScale
minFitScale: number | null = 0.1
Specifies the minimum scale to be applied in fit. Set this to null to allow any value.
Static ReadonlypluginId
pluginId: "fit" = 'fit'
Methods
fit
-
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
fitCenter
-
Fit and center the graph within its container.
Parameters
Optionaloptions: FitCenterOptions
Optional options to customize the fit behavior.
Returns number
The current scale in the view.
On This Page
Constructors
Properties
Methods