blazor-devexpress-dot-blazor-dot-base-dot-gaugebase-dot-exporttoasync-x28-system-dot-string-devexpress-dot-blazor-dot-dataexportformat-x29.md
Exports gauge data to a file in the specified format.
Namespace : DevExpress.Blazor.Base
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public ValueTask ExportToAsync(
string fileName,
DataExportFormat format = DataExportFormat.Png
)
| Name | Type | Description |
|---|---|---|
| fileName | String |
The name of the exported file.
|
| Name | Type | Default | Description |
|---|---|---|---|
| format | DataExportFormat | Png |
The format of the exported file.
|
| Type | Description |
|---|---|
| ValueTask |
A structure that stores an awaitable result of an asynchronous operation.
|
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.
<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