menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class FitOptions - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class FitOptions

    Defines how the diagram has to be fit into the viewport

    Inheritance
    System.Object
    FitOptions
    Namespace: Syncfusion.Blazor.Diagram
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class FitOptions : Object
    Examples
    <SfDiagramComponent Width="1000px" Height="1000px">
    </SfDiagramComponent>
    @code
    {
       SfDiagramComponent Diagram;
       FitOptions Options = new FitOptions(){
       Mode = FitMode.Both,
       Region = DiagramRegion.PageSetting,
       }
    
       Diagram.FitToPage(Options);
    }

    Constructors

    FitOptions()

    Declaration
    public FitOptions()

    Properties

    CanZoomIn

    Gets or sets a value indicating whether the small diagram can be zoomed in to fit within the viewport.

    Declaration
    public bool CanZoomIn { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is false.

    Remarks

    When the method is called with the value of this property set to true, the zoom factor is increased to fit the entire diagram within the current viewport, allowing the small diagram to be zoomed in to fit.

    Examples
     
    
    <SfDiagramComponent Width="1000px" Height="1000px"> 
    </SfDiagramComponent> 
    @code 
    { 
       SfDiagramComponent Diagram; 
       FitOptions Options = new FitOptions(){ 
       Mode = FitMode.Both, 
       Region = DiagramRegion.PageSetting, 
       CanZoom=true 
       } 
    
       Diagram.FitToPage(Options); 
    } 

    Mode

    Gets or sets the Mode of the Fit Options.

    Declaration
    public FitMode Mode { get; set; }
    Property Value
    Type Description
    FitMode

    The default value is Both

    Remarks
    • Both - Fits the diagram content within the viewport.
    • Width – Fits the width of the diagram content within the viewport.
    • Height - Fits the height of the diagram content within the viewport.
    Examples
    <SfDiagramComponent Width="1000px" Height="1000px">
    </SfDiagramComponent>
    @code
    {
       SfDiagramComponent Diagram;
       FitOptions Options = new FitOptions(){
       Mode = FitMode.Both,
       Region = DiagramRegion.PageSetting,
       }
    
       Diagram.FitToPage(Options);
    }

    Region

    Gets or sets the region in the diagram which need to be fit within the viewport.

    Declaration
    public DiagramRegion Region { get; set; }
    Property Value
    Type Description
    DiagramRegion

    The default value is PageSettings

    Remarks
    • PageSettings - The region within the given values( x,y, width and height) of page settings is fit within the viewport.
    • Content – Content of the diagram without empty space around the content is fit within the viewport.
    Examples
    <SfDiagramComponent Width="1000px" Height="1000px">
    </SfDiagramComponent>
    @code
    {
       SfDiagramComponent Diagram;
       FitOptions Options = new FitOptions(){
       Mode = FitMode.Both,
       Region = DiagramRegion.PageSetting,
       }
    
       Diagram.FitToPage(Options);
    }
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved