multichart export is not working

Hi,

I read the exemple below and I coud not export multi charts, only one chart was exported.

https://ej2.syncfusion.com/aspnetcore/documentation/chart/chart-print

Only chartTemp1 was exported.

document.getElementById('button').onclick = () => {

var chartTemp1 = document.getElementById('chart1').ej2_instances[0];

var chartTemp2 = document.getElementById('chart2').ej2_instances[0];

var chartTemp3 = document.getElementById('chart3').ej2_instances[0];

chartTemp1.export('PNG', 'chart', 'Landscape', [chartTemp1, chartTemp2, chartTemp3]);

};

Could you help?


this is my ej2 version I´m using.

<script src="https://cdn.syncfusion.com/ej2/21.2.10/dist/ej2.min.js"></script>





5 Replies

SS Soundeswari Selvam Syncfusion Team June 20, 2023 09:06 AM UTC

Hi Roberto,

We have analyzed your reported query, we suggest you to use exportModule through which we export multiple chart. We also created an sample for your reference.

[Index.cshtml]

 

<script>

    document.getElementById('button').onclick = () => {

        var chart = document.getElementById('container').ej2_instances[0];

        var chart1 = document.getElementById('container1').ej2_instances[0];

        var chart2 = document.getElementById('container2').ej2_instances[0];

        chart.exportModule.export('PNG', 'Chart', 'Landscape', [chart, chart1,chart2]);

    };

</script>

 


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/MULTIC~1561138497.zip

We hope this information helps you in resolving your concern. If you have any further queries or require further assistance, please let us know.


Regards,

Soundeswari Selvam



RO Roberto June 20, 2023 02:58 PM UTC

Hello,

It worked, but when I switched to the PDF option the third graphic didn't show completely, it was cut off. I tried changing the width and height to fully show the three charts and a black background appeared. Is there more detailed documentation for this module?


Can I put the charts side-by-side for example?


To have better control to generate a PDF will I have to use the PDF package?


Thanks.



NP Nishanthi Panner Selvam Syncfusion Team June 21, 2023 09:32 AM UTC

Roberto,


We have analyzed your query. We suggest that you specify "isVertical" as false in order to export the chart in a horizontal format as a PDF. Additionally, we can change the width and height while exporting by specifying the values. We have attached a sample and screenshots for your reference.


Code snippet:


document.getElementById('button').onclick = () => {

        var chart = document.getElementById('container').ej2_instances[0];

        var chart1 = document.getElementById('container1').ej2_instances[0];

        var chart2 = document.getElementById('container2').ej2_instances[0];

        chart.exportModule.export('PDF', 'chart', null, [chart, chart1, chart2], 1100, 0, false);

    };


Screen shot:



Kindly revert us if you have any concerns.


Regards,

Nishanthi


Attachment: export_chart_efca25b7.zip


RO Roberto June 21, 2023 01:53 PM UTC

thanks.



NP Nishanthi Panner Selvam Syncfusion Team June 22, 2023 03:59 AM UTC

Roberto,

Most Welcome! Please get back to us if you need further assistance.

 

Regards,

Nishanthi


Loader.
Up arrow icon