Export to file on server

Hi

I see the export dropdown allows the user to download an exported version of the chart.

Is it possible to receive the export on the server - so it can be saved to a file? E.g. via a posted blob or similar?

Thanks


Attachment: Screenshot_20241115_215930_f3b9ba88.zip

1 Reply

DG Durga Gopalakrishnan Syncfusion Team November 18, 2024 01:34 PM UTC

Hi Praveen,


You can achieve your requirement by setting the IsBase64 parameter to true when calling the ExportAsync method. This will convert the stock chart into a Base64 string, which will be available in the ExportCompleted event argument. Please refer to the snippet and sample below for more details.


<SfButton OnClick="ExportChart" Content="DataUrl" IsPrimary="true"></SfButton>

<SfStockChart @ref="@chartInstance" Title="AAPL Stock Price">

    <StockChartEvents ExportCompleted="ExportComplete"></StockChartEvents>

</SfStockChart>

@code {

    private SfStockChart chartInstance;

    public async Task ExportChart(MouseEventArgs args)

    {

        await chartInstance.ExportAsync(ExportType.PNG, "StockChart", null, false, true);

    }

    public void ExportComplete(ExportEventArgs exportEventArgs)

    {

        string base64 = exportEventArgs.Base64;

    }

}


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/StockBase64-920600973.zip


Kindly revert us if you have any concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon