Skip to main content
All docs
V24.1

GaugeBase.ExportToAsync(String, DataExportFormat) Method

Exports gauge data to a file in the specified format.

Namespace: DevExpress.Blazor.Base

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public ValueTask ExportToAsync(
    string fileName,
    DataExportFormat format = DataExportFormat.Png
)

Parameters

Name Type Description
fileName String

The name of the exported file.

Optional Parameters

Name Type Default Description
format DataExportFormat Png

The format of the exported file.

Returns

Type Description
ValueTask

A structure that stores an awaitable result of an asynchronous operation.

Remarks

Call the ExportToAsync() method to export gauge data to a file in the specified format: PNG, PDF, JPEG, or SVG.

The following code snippet displays a custom Export to PDF button that exports bar gauge data to a PDF file. The button appears after the component is completely loaded. For demo purposes, the example imitates a time-consuming operation.

Bar Gauge - Export Data

<DxBarGauge Width="50%"
            Height="50%"
            StartValue="-5"
            EndValue="5"
            BaseValue="0"
            @ref=@BarGauge
            Values="@Values"
            Rendered="@BarGaugeRendered">
    @* ... *@
</DxBarGauge>

<DxButton Text="Export to PDF" Visible="@buttonVisible" Click="@ExportToPdf" />

@code {
    bool buttonVisible;
    DxBarGauge BarGauge;

    async Task ExportToPdf () {
        await BarGauge.ExportToAsync("Custom file", DataExportFormat.Pdf);
    }

    async Task BarGaugeRendered() {
        await Task.Delay(2000);
        buttonVisible = true;
    }
    double[] Values = new double[] { -2.13, 1.48, -3.09, 4.52, 4.9, 3.9 };
    // ...
}
See Also