Is it possible to export pdf of charts enabled reports? Because I couldnt enable or see the options on the outputs. Pls help.
Chart Export
(4 posts) (2 voices)-
-
You can use the ChartDirector based charts in PDF. Use the automatic parameter
inExportFormat
to detect if the export is a PDF one and use theimagechart
chart option in those cases.--
myDB Tea, -
I'm not understanding. I am not using ChartDirector in the query. Below is the chart only query I am using
SELECT 'dbr.parameters.show';
SELECT 'dbr.search', 1;
SELECT 'dbr.title', CONCAT('Revenue by Service Report: ', DATE_FORMAT(inStartDate, '%m/%d/%Y'), ' - ', DATE_FORMAT(inEndDate, '%m/%d/%Y'));
SELECT 'dbr.sum', 'Total Revenue';
SELECT 'dbr.colstyle', 'Total Revenue', '$ %.2f';
SELECT 'dbr.chart', 'Bar';
SELECT 'dbr.chart.options', 'chartjs';Where should I check the inexportformat? Is this something that needs to be done in the backend?
-
The Chart.js based charts do not appear on the PDF or in the Excel export as they are rendered by the browser. Therefore you need to use ChartDirector based charts when doing the export to PDF or Excel.
Add following parameter to your report (it will be automatically filled):
inExportFormat varchar(4)
Then check if there is an PDF or Excel export being done and use the ChartDirector charts. Otherwise, you can use the Chart.js charts:
if (inExportFormat in ('xlsx', 'pdf')) then
select 'dbr.chart.options', 'imagechart';
else
select 'dbr.chart.options', 'chartjs';
end if;
--
myDBR Team
Reply
You must log in to post.