score:1
here i post my solution that is work for me.
on button click, get svg image using high chart export server.
// get selected checkbox $('.selected_checkbox').each(function( index ){ var obj = {},chart; chart = $('#each_chart').highcharts(); obj.svg = chart.getsvg(); obj.type = 'image/png'; obj.async = true; obj.id = chart_id; // ajax call for svg $.ajax({ type: "post", url: url,// u need to save svg in your folder data: obj, success: function(data) { // redirect to php function and create zip window.location = 'php function call'; } )}
ajax function call to create svg..
ini_set('magic_quotes_gpc', 'off'); $type = $_post['type']; $svg = (string) $_post['svg']; $filename = 'name'; $id = $_post['id'];
$outfile = apppath."tempp/$tempname.$ext"; if (!file_put_contents(apppath."tempp/$tempname.svg", $svg)) { die("couldn't create temporary file."); }}if (get_magic_quotes_gpc()) { $svg = stripslashes($svg); } // check for malicious attack in svg if(strpos($svg,"<!entity") !== false || strpos($svg,"<!doctype") !== false){ exit("the posted svg could contain code for a malicious attack"); } $tempname = $filename.'_'.$id; // allow no other than predefined types if ($type == 'image/png') { $typestring = '-m image/png'; $ext = 'png'; } elseif ($type == 'image/jpeg') { $typestring = '-m image/jpeg'; $ext = 'jpg'; } elseif ($type == 'application/pdf') { $typestring = '-m application/pdf'; $ext = 'pdf'; } elseif ($type == 'image/svg+xml') { $ext = 'svg'; } else { // prevent fallthrough from global variables $ext = 'txt'; }
ajax success function redirect code..
here you need to read directory files and create pdf from svg.
after add each pdf to zip.
this is example solution.you have to change code as per your requirement
score:2
an example solution to this would be:
create your charts
var options1 = { // ... }; $('#chart1').highcharts(options1);
ask the highcharts export server to generate an image of the chart
var exporturl = 'http://export.highcharts.com/'; var d1 = $.ajax({ url: exporturl, // ... });
fetch the contents of the generated image
$.when(d1).done(function(v1) { var p1 = new jszip.external.promise(function (resolve, reject) { jsziputils.getbinarycontent(exporturl + v1[0], function(err, data) { // ... }); }); // ...
use jszip to construct and save the zip file with the contents of the generated images
// ... promise.all([p1]).then(function(values) { var zip = new jszip(); zip.file("chart1.png", values[0], {binary:true}); zip.generateasync({type:"blob"}) .then(function(content) { saveas(content, "charts.zip"); }); }); });
you can see this (very scrappy) jsfiddle demonstration of how you could get the zip file. the steps are as described above, but not connected to any button and instead executed immediately upon entering the site.
Source: stackoverflow.com
Related Query
- Export multiple Highchart as Zip file to my project directory
- Export HighChart as an image in excel file together with the other page contents
- How to export multiple charts in HighCharts to one file (png, jpeg, pdf)
- How can i export row data from highchart to excel file and not csv?
- Creating a Highchart with multiple series from a JSON file
- Highchart - Export data as Excel file
- Multiple chart export in HighChart is not same as the one displayed on the screen
- export multiple highcharts with text area for their highcharts to multiple PDF file
- Manage multiple highchart charts in a single webpage
- Remove Export and print button plugin on highchart chart
- Drilldown multiple levels Highchart
- How to export a Highchart chart to PDF thanks to a button outside the chart?
- HighCharts is undefined because multiple Html pages in Javascript file
- Background color for multiple Highchart panes, in Vue app
- Highcharts export chart exportSettings with svg file
- How to Export JavaScript Chart to Excel file (HighCharts)
- Highchart axis max with multiple axes
- Is multiple level Highchart Drilldown possible in adjacent charts?
- highchart export button not show
- JavaScript code inside TypeScript file .ts not working
- Highchart (basic line chart) which can have multiple values vs x axis?
- Showing multiple data with same x and y in highchart
- Highchart multiple axes - sync axes on multiple charts
- Export chart image data locally in HIghchart
- Export multiple charts with one request
- Getting error 'Cannot read property 'document' of undefined' while importing exporting.js (to export highchart charts)
- HighChart : plot line click event for multiple chart
- Problem with multiple labels in Highchart
- How to add php data into highchart js file in php
- How to reformat a HighChart series to for CSV export
More Query from same tag
- Highchart: display time and date at midnight
- is there any option to get highchart plotbands only for one xaxis?
- How to set xAxis minimum and maximum values on Highstock?
- how to display data into linear highChart?
- How to toggle date input datepicker in Highstock rangeSelector
- Highcharts: Dates Off By 1 Month
- Highcharts how to show certain tooltips and don't show others
- Highcharts: showing tooltip with calculated value at Crosshair
- script not running in templateurl
- HighCharts/HighStocks: Pie graph with Highstock
- Highcharts: Remove extra margin y-axis when plotting multiple series
- Highchart - Unable to parse my JSON string as a variable in the series but hardcoded way seems to work fine
- Adding multiple dynamic lines to highcharts
- change json value's datatype in javascript
- Wordcloud tags not appearing in a given fontSize - Highcharts
- How can I change the width of the bars in a highchart?
- Highcharts: StockChart initialization with new Highchart
- Styling bar colors in Highcharts with a gradient issue
- How to add click event on django-chatit chart
- A different suffix from an array for each line on Highcharts
- Loading Javascript Highcharts series data issues
- Set HighChart yAxis's min max to a specific series only
- Highcharts Bar Graphic: Make small number the higher bar and large number the smaller bar
- Highcharts: setting stroke-width on a line series when styledMode is on has no effect
- Highcharts export to svg
- Does highcharts have a callback function for before full chart reload (this should not include legends disable)?
- Parsing CSV and then Using the Data to Build Highcharts Bar Chart
- Highcharts - column color different from color in legend
- No tooltip with IE10 document mode IE8 Standards
- Highcharts small size div not showing minorTickInterval