Custom export to PDF button

by annlee » Fri Jan 29, 2016 6:39 pm

Is there a way to add a custom export to PDF button outside of the chart?

Currently the PDF img sits inside the chart and not very visible.

What if I have multiple charts, how do I reference the export buttons to the right charts?

Thanks.
Attachments
Capture.JPG
Capture.JPG (50.82 KiB) Viewed 299 times
annlee
 
Posts: 35
Joined: Thu Oct 08, 2015 3:25 pm

by Rostislav » Mon Feb 01, 2016 12:33 pm

Yes.

1. Add a link element via the content editor webpart (Edit page -> Insert -> Web Part -> Media and Content -> Content Editor -> Add -> Click the webpart -> Insert -> Embed Code):

Code: Select all
<a id="export_button_1" href="">Export to PDF</a>


2. Change the preRender function in the following way (in Dashboard Designer go to Dashboard -> Advanced):

Code: Select all
handlers.preRender = function(config, logger, processor, el) {
   logger.debug('Configuration: ', config);
   $('#export_button_1').click(function(e) {
      e.preventDefault();
      el.getKendoChart().saveAsPDF();
   });
   return true;
}



This way you'll be able to do for any number of charts that are situated on the same page, but of course, you'll need to use different link elements with different id values.
User avatar
Rostislav
 
Posts: 61
Joined: Fri Oct 09, 2015 10:51 am


Return to Dashboard Designer for SharePoint 2013

cron