Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
**bump**custom visualization (d3): how to export to pdf?
DQM
<p>Hi, we would like to place a quadrant chart in one of our reports and created one in D3.</p>
<p>It works fine when placed in a html page, and it also works fine when we enter the html code and script inside a text element from the palette in Birt Designer Pro (and generate the report as html).</p>
<p>However... when we place the script, html and css in a custom visualization element the chart does not show up.</p>
<p>What is wrong and how do I fix this?</p>
<p>Attached are the original html chart and the problematic report.</p>
<p>any thoughts/suggestions?</p>
<p> </p>
<p> </p>
Find more posts tagged with
Comments
Clement Wong
<p>In your Custom Visualization Report Item, for the Script subtab under the Template tab, I noticed that you have a <span style="font-family:'courier new', courier, monospace;">head.load</span> with a callback function. However, there isn't a "callback" function defined.</p>
<p> </p>
<p>1. In the HTML, replace:</p>
<p><span style="font-family:'courier new', courier, monospace;">$(function(){</span><br>
</p>
<p>With:</p>
<p><span style="font-family:'courier new', courier, monospace;">var callback = function() {</span></p>
<p> </p>
<p>And the D3.js chart is rendered.</p>
<p> </p>
<p> </p>
<p>You'll want to change is the ID that the SVG is rendered to because currently it is set to target the body, and it will be cutoff at the top part of the viz:<br>
</p>
<p>2. In the HTML, change:</p>
<p><span style="font-family:'courier new', courier, monospace;"><div class='chart'></div></span></p>
<p> </p>
<p>To:</p>
<p><span style="font-family:'courier new', courier, monospace;"><div class='chart' id='theChart'></div></span></p>
<p> </p>
<p>In the Script, change:</p>
<p><span style="font-family:'courier new', courier, monospace;"> var id = 'body',</span></p>
<p> </p>
<p>To:</p>
<p><span style="font-family:'courier new', courier, monospace;"> var id = '#theChart',</span></p>
<p> </p>
<p> </p>
<p><span style="font-family:'courier new', courier, monospace;"><span style="font-family:arial, helvetica, sans-serif;">3. </span></span>You have some extraneous test <span style="font-family:'courier new', courier, monospace;"><svg>...</svg></span> under the HTML subtab that you'll want to remove after <span style="font-family:'courier new', courier, monospace;"><div <span style="font-family:'courier new', courier, monospace;"><div class='chart' id='theChart'></div></span></span> .</p>
DQM
<p>It's working fine now
</p>
<p> </p>
<p>Thanks for your quick response, Clement</p>
DQM
<p>Follow up question:</p>
<p>When generating a pdf from the resulting html file using the browsers print menu... the d3 visualisation renders (prints) fine,</p>
<p>but we need to generate our pdf's from inside our Birt reports (using Properties -> Hyperlink -> Drill-through -> Step 5. Format the target report in pdf).</p>
<p>This renders the report as expected, but the custom visualisation doesn't show. </p>
<p>After reading up on this it seems to be a common problem. But is there a solution?</p>
DQM
<p>bump</p>
Clement Wong
<p>Sorry, I've been out of the office for the past week and half, and just returned today.</p>
<p> </p>
<p>I tested using a drill-through as PDF link with the drill-through report having two custom visualizations. It works for me as expected. The resulting PDF generates with the custom visualization.</p>
<p> </p>
<p>Attached are the designs.</p>
<p> </p>
<p>Can you modify the design to demonstrate the case where it doesn't work?</p>
DQM
<p>Hi Clement, thanks for your reply and welcome back.</p>
<p>When I run 02_child and choose print -> pdf from the <strong>hamburger menu</strong> (top bar of the report) the custom visualization doesn't generate. </p>
<p>Maybe something is wrong with my Birt installation.</p>
<p>When I'm back at the office (tuesday) I will ask a colleague to run the report from his machine to see if we can replicate the problem.</p>
<p>cheers, Mark</p>
Clement Wong
<p>OK, keep me posted.</p>
<p> </p>
<p>JFYI, I tested in both BIRT Designer Professional 3.1, and Analytics Designer 16 on my Windows environment, and the 02_Child report can <em>Print > PDF</em> from the Viewer (hamburger icon).</p>
<p> </p>
<p>What version of commercial BIRT are you using? Which product? And what OS? Does it also work from the iHub server?</p>
<p> </p>
<p>If you are using Mac OS and BIRT Designer Professional 3.1 or 3.1.1, then please read this (<a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/37093-using-amazon-javascript-sdk-in-report/?p=138966'>http://developer.actuate.com/community/forum/index.php?/topic/37093-using-amazon-javascript-sdk-in-report/?p=138966</a>).</p>
;
DQM
<p>Hi Clement,</p>
<p>we use Actuate Birt Designer Pro version 4.4</p>
<p>we tested your report on two machines (both 2015 MBP, El Capitan running 10.11.6, Java version 1.6.0_65) in firefox, firefox dev, chrome and safari.</p>
<p>The visualization rendered fine in html (the browser window) but never showed up in pdf's printed from the hamburger menu.</p>
<p>Just to make sure we also created a new, blank report and placed a custom visualisation (heatmap from highcharts) in that.</p>
<p>That also did not print to pdf (showing us a blank page).</p>
<p>We did not run the report from the ihub server because we need to test our reports extensively before moving them to our server.</p>
<p> </p>
<p>Our "normal" visualisations when run from Birt Designer Pro 4.4 or when run from iHub server do work as expected (i.e. show in pdf's)</p>
<p>I attached the report with our custom vis. </p>
<p>I hope you can shed some light on this issue that has us stumped.</p>
<p>(edit: after updating java to 1.8.0_92 the issue is still not resolved)</p>
<p>(edit2: same problemwhen using OpenText Analytics Designer)</p>
Clement Wong
<p>The PDF conversion of the Custom Visualization utilizes PhantomJS. So it appears only on Mac? Are you able to test on a Windows environment to confirm?</p>
<p> </p>
<p>Did you confirm the following, and see the workaround in this post:</p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/37093-using-amazon-javascript-sdk-in-report/?p=138966'>http://developer.actuate.com/community/forum/index.php?/topic/37093-using-amazon-javascript-sdk-in-report/?p=138966</a></p>
;
DQM
<p>Hi Clement, thanks for the link to the workaround, I followed the instructions but still no joy.</p>
<p>I did notice that the plugins folder has a <strong>com.actuate.phantomjs_1.0.0.v20150206.jar</strong>, and not the <strong>com.actuate.phantomjs_1.0.0.v20150710.jar </strong>version mentioned in the thread.</p>
<p><span style="font-size:14px;">I am running Birt designer Pro 4.4 - </span><span>Build id: v20150206 by the way. Could that particular build be the problem?</span></p>
Clement Wong
<p>From the build #, you are using version iHub 3.1. I tried it out both with my workaround JAR, and a rebuilt JAR, and it's not finding the path to phantomjs with 3.1.</p>
<p> </p>
<p>Are you able to upgrade to BIRT Designer Professional 3.1.1? I re-tested the workaround I posted previously, and it is working as expected in 3.1.1.</p>
<p> </p>
<p>I will investigate further if there is a way to get it to work in 3.1, but there are no guarantees. In the meantime, I suggest that you upgrade to 3.1.1.</p>
DQM
<p>Hi Clement, thank you for looking into this.</p>
<p>Upgrading to 3.1.1 is in the cards, but may take us a while. We work with a custom LDAP, and changed a few other things in our install as well. So upgrading won't be a clean, whistle while you work process for us. Downtime is no option.</p>
DQM
<p>Hi Clement, I am pleased to report that we got our custom visualizations working by replacing <strong>com.actuate.phantomjs.win32_1.0.0.v20150206</strong> and <strong>com.actuate.phantomjs_1.0.0.v20150206.jar</strong></p>
<p>with <strong>com.actuate.phantomjs.macosx_1.9.7</strong> and <strong>com.actuate.phantomjs_23.2.0.v201604061009.jar</strong> from the Analytics Designer package (build 16).</p>
<p>thanks for looking into the matter,</p>
<p>MK</p>