Focal Point
[CLOSED] Highcharts on a PDF

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7357087096

September 19, 2018, 11:24 AM
nsk110483
[CLOSED] Highcharts on a PDF
Hello,

Did anyone try to create Highcharts graph on a PDF output?


Thanks

This message has been edited. Last edited by: FP Mod Chuck,


In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts
September 19, 2018, 11:40 AM
BabakNYC
Is that a chart type?


WebFOCUS 8206, Unix, Windows
September 19, 2018, 12:13 PM
Kofi
Is not Highcharts HTML?

You know PDF is not HTML?

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
September 19, 2018, 02:17 PM
nsk110483
I have created this in another framework (Zend) where I would create a html chart and then use the "wkhtmltopdf" tool in unix to generate a pdf output. I was wondering if this can be achieved in WebFocus.


In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts
September 19, 2018, 03:59 PM
BabakNYC
So, are you doing this because of a specific requirement or just as a challenge to see if it can be done? If you have a specific chart type that doesn't exist in WebFOCUS or github, I could see why you'd want to know how to do something like this.


WebFOCUS 8206, Unix, Windows
September 19, 2018, 04:32 PM
nsk110483
quote:
Originally posted by BabakNYC:
So, are you doing this because of a specific requirement or just as a challenge to see if it can be done? If you have a specific chart type that doesn't exist in WebFOCUS or github, I could see why you'd want to know how to do something like this.


I have a requirement to create a Dashboard having multiple containers and I am using highcharts graph in one of those container. I know highcharts has an exporting module where I can easily download the same graph into a PDF, but my requirement is to be able to export the whole dashboard into a pdf file.
Yes! I had to create a chart which was not available in WebFOCUS.


In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts
September 20, 2018, 03:56 AM
Tony A
Nothing native in WebFOCUS although PhantomJS is installed with it. PhantomJS is a "headless" browser and you can capture webpages into an image file using it.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 20, 2018, 10:27 AM
Wep5622
We haven't done this server-side yet, but... Most (all?) of those JS charting libraries generate an SVG image embedded in the HTML output.

If you can run the JS chart server-side (for example using Tony's suggested PhantomJS or perhaps nodejs), capture the svg node + children and store that in a file. You can then embed that vector image in your PDF.

Ideally, you could create a HTML fragment (instead of a full page) consisting of just the generated SVG stuff for the chart and save that as a file.
We do this client-side using a popup window as the target document for the rendered chart, so that there is no left-over stuff (like the script-tags that include the chart library!).


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
September 24, 2018, 08:58 AM
Ira Kaplan
WebFOCUS charting can be extended to make charts from external JavaScript charting libraries such as HighCharts behave like built-in WebFOCUS charts.

See the documentation:
---------------------
Creating HTML5 Charts With WebFOCUS Language Release 8.2 Version 04
Chapter 14: Adding Your Own Chart Types to the Chart Library
https://webfocusinfocenter.inf.../pdfs4/wfjschart.pdf

Note: This is also valid for earlier releases of WebFOCUS 82xx

This technique requires JavaScript programming skills.

Excerpts from the manual:

WebFOCUS supports the ability to add new, custom chart types to its list of built-in charts. These custom chart types are called extensions or plug-ins. An extension is a block of code that accesses resources external to WebFOCUS. This chapter describes the structure of an extension and the steps necessary to create your own and add it to the chart library.

Chart extensions are written in JavaScript. The visual part of a visualization can be drawn with HTML, Canvas, or SVG. Extensions can include external CSS and JS libraries (such as d3), which can be used to build almost any visualization. The WebFOCUS Extension API is limited to new, complete chart types only. It is not possible to add features to existing chart types, and it is not possible to modify or extend parts of WebFOCUS outside of the chart area allocated to your extension.
This chapter summarizes the process of writing, configuring, and installing a chart extension.

Detailed instructions can be found on the Information Builders GitHub site: https://github.com/ibi/wf-extensions-chart
September 24, 2018, 09:06 AM
Ira Kaplan
quote:
... but my requirement is to be able to export the whole dashboard into a pdf file.



In the PDF file containing the whole dashboard, is each container in the dashboard to appear on its own page in the PDF, or does the entire dashboard appear on a single page in the PDF like a screen shot?
October 09, 2018, 12:59 AM
nsk110483
quote:
Originally posted by Ira Kaplan:


In the PDF file containing the whole dashboard, is each container in the dashboard to appear on its own page in the PDF, or does the entire dashboard appear on a single page in the PDF like a screen shot?


The entire dashboard need not be on a single page, but I need to try to fit in as many containers of a dashboard on a page to be visually appealing.


In Focus since 2008
WebFOCUS 8.2.0.1
Windows 7 - IE,Chrome,Firefox
Excel, PDF, HTML, AHTML, XML
JavaScript, jQuery, D3.js, Highcharts