Back to Devexpress

GaugeBase.ExportToAsync(String, DataExportFormat) Method

blazor-devexpress-dot-blazor-dot-base-dot-gaugebase-dot-exporttoasync-x28-system-dot-string-devexpress-dot-blazor-dot-dataexportformat-x29.md

latest2.4 KB
Original Source

GaugeBase.ExportToAsync(String, DataExportFormat) Method

Exports gauge data to a file in the specified format.

Namespace : DevExpress.Blazor.Base

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Parameters

NameTypeDescription
fileNameString

The name of the exported file.

|

Optional Parameters

NameTypeDefaultDescription
formatDataExportFormatPng

The format of the exported file.

|

Returns

TypeDescription
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.

razor
<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

GaugeBase Class

GaugeBase Members

DevExpress.Blazor.Base Namespace