0

I'm having a JQXChart on a page:

$('#chartContainer').jqxChart(settings);

What I'd like to do is the push this chart - as an image - to the server. The component supports functionality like export to image:

https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxchart/index.htm#demos/jqxchart/javascript_chart_export_jpeg.htm

But I can't see any possibility to just getting the image, without actually downloading it by a web browser. I have to pass this image to the back-end service.

I saw this kind of functionality in another JS framework:

http://www.jqchart.com/jquery/chart/ChartFeatures/ImageDataURL

Is it possible in jqwidgets? Or... somehow achievable through html5...

Thanks in advance

Matthijs
  • 2,483
  • 5
  • 22
  • 33
Czesiek
  • 1
  • 1

1 Answers1

0

Looking at the documentation you linked it seems that the methods to export images support two arguments: fileName and exportServer. The documentation further states:

If you don't setup your own export server the default server is jqwidgets.com.

This causes the behavior of creating a download link as you described and can be seen on the example page. But there is no reason you shouldn't be able to use your own server. Since you want to push the image to your backend server anyway, just set up a corresponding route and use it in the method like:

$('#chartContainer').jqxChart('saveAsJPEG', 'myChart.jpeg', 'http://www.yourserver.com/export')

See what arrives on the server side and go from there.

luke-codewalker
  • 319
  • 3
  • 11