This is a migrated thread and some comments may be shown as answers.

How to print RadHtmlChart

3 Answers 129 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Bethany
Top achievements
Rank 1
Bethany asked on 15 May 2015, 07:21 PM

Hello,

I am trying to print just my RadHtmlChart using JavaScript but when I press the event button to activate the script the chart disappears, the components I want to hide successfully hide. I specifically state in my JavaScript code to only hide 2 other components but keep the chart. Also, when I cancel the prompt to print all of the components stay hidden, instead of being shown. Here is my code:

 

01.<script type="text/javascript">
02.     function printChart() {
03.          //Hide components but show chart
04.          document.getElementById("divGrid").style.display = 'none';
05.          document.getElementById("divOptions").style.display = 'none';
06.          document.getElementById("divChart").style.display = 'block';
07. 
08.          //Call the browser print method
09.          window.print();
10. 
11.          //Show components
12.          document.getElementById("divGrid").style.display = 'block';
13.          document.getElementById("divOptions").style.display = 'block';
14.          document.getElementById("divChart").style.display = 'block';
15.</script>

 

Thank you in advance!

3 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 18 May 2015, 07:26 AM
Hi Bethany,

I tested the provided function but the chart and all other elements on the page get hidden/shown properly when printing - video. Can you verify that there are not any JavaScript errors on the page when the button is print button is clicked at your end?

For convenience I am attaching my test page to this reply - are you reproducing the same issue with it? If no, can you modify it up to a point where the issue occur and send it back for a further investigation?

Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Bethany
Top achievements
Rank 1
answered on 19 May 2015, 05:04 PM

Hello,

 I was able to recreate the problem and fixed it to print just the chart. However, project specifications have changed and I am supposed to export to PDF for printing but I am running into some problems with that as well. Can you help me on this post or should I create a new one?

0
Vessy
Telerik team
answered on 22 May 2015, 06:34 AM
Hi Bethany,

You can use the RadClientExportManager  in order to export the HtmlChart to PDF. You can find a live implementation of this approach here: HtmlChart - Export to PDF

On a side note, yes, it would be better if you open separate tickets/forums for each issue you are facing so we can keep the consistency of each thread. Thank you for the understanding.

Regards,
Vessy
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart (HTML5)
Asked by
Bethany
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Bethany
Top achievements
Rank 1
Share this question
or