ChartAnnotation Does Not Export With Chart

I am displaying a ChartAnnotation as an image on my chart, but when exporting it, the image is not displayed in the exported chart. Is it possible to export the annotation image with the chart? I'm trying to export to PDF.  Here is my code:

<SfChart @ref="chartObj" Title="@($"{SelectedQuestion.QuestionNumber}. {SelectedQuestion.Text}")" SubTitle="@(GetSubtitle())" Theme="@CurrentTheme" Width="@ChartWidth" Height="@ChartHeight">

    <ChartTooltipSettings Enable="true" />

    <ChartTitleStyle TextOverflow="TextOverflow.Wrap" TextAlignment="Alignment.Near"></ChartTitleStyle>

    <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />

    <ChartPrimaryYAxis Interval="1" />

    <ChartSeriesCollection>

        <ChartSeries DataSource="@BarChartData" XName="X" YName="Y" Type="ChartSeriesType.Column" Fill="rgba(61, 44, 191, 1)" />

    </ChartSeriesCollection>

    <ChartAnnotations>

        <ChartAnnotation X="105" Y="35" CoordinateUnits="Units.Pixel" Region="Regions.Chart">

            <ContentTemplate>

                <img src="/images/logo_200_60.png" alt="Website Logo" width="200" height="60"/>

            </ContentTemplate>

        </ChartAnnotation>

    </ChartAnnotations>

    <ChartMargin Left="5" Right="5" Top="80" Bottom="0"></ChartMargin>

    <ChartEvents Exporting="OnExporting" />

</SfChart>


protected async Task ExportChart()

{

    if (SelectedQuestion != null)

    {

        _ = Snackbar.Add("Exporting chart", Severity.Info);

        switch (SelectedChartType)

        {

            case "Bar":

                ChartWidth = "1000";

                ChartHeight = "650";

                await Task.Delay(100);

                await chartObj.ExportAsync(SelectedExportType, $"{SelectedChartType}_Chart_Q{SelectedQuestion.QuestionNumber}.{SelectedExportType}", Syncfusion.PdfExport.PdfPageOrientation.Landscape, true);

                break;

            case "Pie":

                ChartWidth = "1000";

                ChartHeight = "700";

                await Task.Delay(100);

                await pieChartObj.ExportAsync(SelectedExportType, $"{SelectedChartType}_Chart_Q{SelectedQuestion.QuestionNumber}.{SelectedExportType}", Syncfusion.PdfExport.PdfPageOrientation.Landscape, true);

                break;

        }

        _ = Snackbar.Add("Export complete", Severity.Success);

    }

    else

    {

        _ = Snackbar.Add("Exporting all charts", Severity.Info);

        switch (SelectedChartType)

        {

            case "Bar":

                ChartWidth = "950";

                ChartHeight = "700";

                for (int i = 0; i < BarCharts.Count; i++)

                {

                    await Task.Delay(100);

                    await BarCharts[i].ExportAsync(SelectedExportType, $"{SelectedChartType}_Chart_Q{i + 1}.{SelectedExportType}", Syncfusion.PdfExport.PdfPageOrientation.Landscape, true);

                }

                break;

            case "Pie":

                ChartWidth = "1000";

                ChartHeight = "700";

                for (int i = 0; i < BarCharts.Count; i++)

                {

                    await Task.Delay(100);

                    await PieCharts[i].ExportAsync(SelectedExportType, $"{SelectedChartType}_Chart_Q{i + 1}.{SelectedExportType}", Syncfusion.PdfExport.PdfPageOrientation.Landscape, true);

                }

                break;

        }

        _ = Snackbar.Add("Export complete", Severity.Success);

    }

    ChartWidth = "100%";

    ChartHeight = "100%";

}


3 Replies

DG Durga Gopalakrishnan Syncfusion Team April 15, 2025 11:58 AM UTC

Hi David,


Greetings from Syncfusion.


As of now, we don’t have support to export the chart along with annotations. We have already logged a feature request on this. Based on other logged tasks priority, we will include this improvement in any of our upcoming release. You can keep track of an improvement from the below feedback link. 


Feedback Link :  https://www.syncfusion.com/feedback/50070/support-to-export-chart-along-with-annotations


If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal.


Regards,

Durga Gopalakrishnan.



DW David Warwick April 15, 2025 10:19 PM UTC

Ok thank you for the update.



DG Durga Gopalakrishnan Syncfusion Team April 16, 2025 05:36 AM UTC

Most welcome. We will let you know once this improvement is completed. Please get back to us if you need any further assistance. We are always happy in assisting you. 


Loader.
Up arrow icon