We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Chart within PDF control

Thread ID:

Created:

Updated:

Platform:

Replies:

148254 Oct 11,2019 12:25 PM UTC Oct 14,2019 09:43 AM UTC ASP.NET Core - EJ 2 1
loading
Tags: Charts
Martin
Asked On October 11, 2019 12:25 PM UTC

Is there an example where i can create a chart, then output it in the PDF document which the PDF control creates.


Many thanks

Srihari Muthukaruppan [Syncfusion]
Replied On October 14, 2019 09:43 AM UTC

Hi Martin 

Greetings from syncfusion 

We have validated your query. From that, we would like to let you know that, currently we can export the chart rendered as image to the PDF usingexport” method available in export module, in which “PDF” format and file name can be passed as an arguments. Based on that we have prepared a sample and also provided the code snippet for your reference. 
    
    
Code Snippet:     
[index.cshtml]: 
 
<div class="control-section col-lg-9" align="center"> 
    <ejs-chart id="container" > 
        <e-chart-primaryxaxis valueType="Category" title="Countries"></e-chart-primaryxaxis> 
        <e-series-collection> 
            <e-series dataSource="ViewBag.dataSource" xName="xValue" yName="yValue" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column"> 
            </e-series> 
        </e-series-collection> 
    </ejs-chart> 
</div> 
 
<script> 
    document.getElementById('button').onclick = () => { 
        var chart = document.getElementById('container').ej2_instances[0]; 
        chart.exportModule.export("PDF", 'chart'); 
    }; 
</script> 
  
Screenshot:   
Before click 
After click 
 
 
 
   
Please let me know, if you have any concerns.   
    
Regards,    
Srihari 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon