0

ZK Charts offline exporting images(jpeg,png,pdf,svg) [closed]

asked 2021-09-19 14:37:39 +0800

bztom35 gravatar image bztom35
103 4

I noticed that when exporting images. The Zkoss chart sends to export.highcharts.com. I know that Zk charts supports offline exporting of images since version 3.0.

I am currently using zk charts 7.2.x. I couldn't find a way to enable this function. We have sensitive data that we don't want to send it to other servers.

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by cor3000
close date 2021-09-29 18:01:15

Comments

Have you followed the documentation to set up your own server? https://www.zkoss.org/wiki/ZKChartsEssentials/WorkingwithZKCharts/Exporting#ByJSON.2C_Offline

jeanher ( 2021-09-22 11:08:30 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-09-23 15:34:06 +0800

cor3000 gravatar image cor3000
6168 2 7
ZK Team

updated 2021-09-27 16:31:02 +0800

Thanks for the documentation link. It was based on an older highcharts version, before the client side export was available. By default highcharts uses the client side exporting functionality. By overriding the menuitems from the outdated example you restored the old behavior to use the export server. Without reconfiguring the url it will lead to https://export.highcharts.com

I updated the example to use the new methods exportChartLocal instead of exportChart.

I also provided the missing fullscreen button script and added 2 configurations to disable the export server, with a custom URL and turning of the fallback flag.

exporting.setUrl("/export-server-not-enabled.zul");
exporting.addExtraAttr("fallbackToExportServer", new AnyVal(false));

...

menuItems.add(defaultMenuItem("viewFullscreen", "this.fullscreen=new Highcharts.FullScreen(this.container);"));
menuItems.add(defaultMenuItem("printChart", "this.print();"));
menuItems.add(separator());
menuItems.add(defaultMenuItem("downloadPNG", "this.exportChartLocal();"));
menuItems.add(defaultMenuItem("downloadJPEG", "this.exportChartLocal({type: \"image/jpeg\"});"));
menuItems.add(defaultMenuItem("downloadPDF", "this.exportChartLocal({type: \"application/pdf\"});"));
menuItems.add(defaultMenuItem("downloadSVG", "this.exportChartLocal({type: \"image/svg+xml\"});"));
link publish delete flag offensive edit

Comments

This is exactly what I am looking for without have to re-invent the wheel; however, Nothing happended when I clicked on viewFullScreen option.

bztom35 ( 2021-09-27 15:18:08 +0800 )edit

The view full screen option works If I just enabled the default export option via chart.getExporting().setEnabled(true); //set enable chart exporting option. Also, chart.getExporting().setSourceWidth() and chart.getExporting().setSourceHeight() override the default chart.setWidth() and setHeight()

bztom35 ( 2021-09-27 15:38:35 +0800 )edit

For example, default setting for chart display: chart.setWidth(800);chart.setHeight(600). In chart export, I use Toolkit to get the max screen size: chart.getExporting().setSourceWidth(screensize.width) and chart.getExporting().setSourceHeight(screensize.height). The latter override the default.

bztom35 ( 2021-09-27 15:46:58 +0800 )edit

thanks for the hint ... I updated the override code for the fullscreen button in the example above, which actually caused a JS error (so it wasn't doing nothing, just failed)

cor3000 ( 2021-09-27 16:32:08 +0800 )edit

please add a new forum question 1 question should have 1 dedicated answer

cor3000 ( 2021-09-29 18:00:13 +0800 )edit
0

answered 2021-09-23 10:19:55 +0800

cor3000 gravatar image cor3000
6168 2 7
ZK Team

What's possible in highcharts and the potential fallback rules (e.g. with older browsers) are described here: https://www.highcharts.com/docs/export-module/client-side-export

The client side exporting (enabled by default in zkcharts) will generate the downloadable file in the browser directly without referring to an external export server. (I verified that in a quick test in our live zkcharts demo)

If this feature doesn't work as expected on your side please provide the exact version and reproducing details (i.e. chart configuration), or a link to a demo and the browser used causing calling the export server.

link publish delete flag offensive edit

Comments

I am using Zk Charts 7.2.1.0 commercial version. I created a custom export items based on this example. https://www.zkoss.org/wiki/ZKChartsEssentials/WorkingwithZK_Charts/Exporting. Nothing more, when I downloaded the any of the images, it was using external site https://export.highchart.com .

bztom35 ( 2021-09-23 12:23:21 +0800 )edit

Question tools

Follow
1 follower

RSS

Stats

Asked: 2021-09-19 14:37:39 +0800

Seen: 10 times

Last updated: Sep 27

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More