score:2
HighCharts already supports the image exporting functionality via the Exporting Module which is packaged with it. Exporting After getting it you should be able to modify the script to save the image in any way you need. It's certainly not a beginners task and will require lots of tinkering.
If it were me I would modify the code that responds to the export button so that I can activate it with JavaScript and also pass in information so that the PHP file on the back-end could save the picture in the manner you want rather than returning it to the client.
score:0
I know it's too late but i have the same problem and this jsfiddle helped me to create excel from highchart. The Download CSV option added to export menu works fine. Here is the code:
/**
* A small plugin for getting the CSV of a categorized chart
*/
(function (Highcharts) {
// Options
var itemDelimiter = ',', // use ';' for direct import to Excel
lineDelimiter = '\n';
var each = Highcharts.each;
Highcharts.Chart.prototype.getCSV = function () {
var xAxis = this.xAxis[0],
columns = [],
line,
csv = "",
row,
col;
if (xAxis.categories) {
columns.push(xAxis.categories);
columns[0].unshift("");
}
each (this.series, function (series) {
columns.push(series.yData);
columns[columns.length - 1].unshift(series.name);
});
// Transform the columns to CSV
for (row = 0; row < columns[0].length; row++) {
line = [];
for (col = 0; col < columns.length; col++) {
line.push(columns[col][row]);
}
csv += line.join(itemDelimiter) + lineDelimiter;
}
return csv;
};
}(Highcharts));
// Now we want to add "Download CSV" to the exporting menu. We post the CSV
// to a simple PHP script that returns it with a content-type header as a
// downloadable file.
// The source code for the PHP script can be viewed at
// https://raw.github.com/highslide-software/highcharts.com/master/studies/csv-export/csv.php
Highcharts.getOptions().exporting.buttons.contextButton.menuItems.push({
text: 'Download CSV',
onclick: function () {
Highcharts.post('http://www.highcharts.com/studies/csv-export/csv.php', {
csv: this.getCSV()
});
}
});
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
$('#getcsv').click(function () {
alert(chart.getCSV());
});
score:1
This might be a little late, but I stumbled across this via Google so it might help someone. Highchart's image is in SVG format: http://en.wikipedia.org/wiki/Svg , you need to convert that to a bitmap format image. You have to change the Highcharts exporting options URL to your own URL:
exporting : {
url: 'http://mydomain.com/export.php'
}
In your export script you must convert the SVG image to a bitmap image (I used PHP & imagick) then export to whatever suits your needs, save the bitmap image to the server, send by e-mail, etc. ,
score:1
After some searching, I found this recent answer in their forums, with a jsfiddle to tinker with.
It describes how to export a CSV using a script on your server, which from past experience, is the only way this can get done because the HighChart graph itself doesn't contain nearly enough information to produce a usable spreadsheet. We already do with a different charting library, and use phpExcel to actually create the spreadsheet.
score:1
If you are willing to try an Add-in, there is a way to use Javascript, HTML and css in Excel. It's called Funfun and it hosts an online editor with an embedded spreadsheet so the transition isn't hard between the website to Excel.
Here is a chart I made with Highcharts:
https://www.funfun.io/1/#/edit/5a61c190404f66229bda3f0f
In this example I took the chart from a Highchart demo, and replaced the data with mine. I store my data in the embedded spreadsheet, and thanks to a json file I can use it in my javascript code.
That is how I get my data from the spreadsheet with the json file:
{
"data": "=A1:E16"
}
I store it in my script.js with the right format so I can directly load it in Highcharts (for numbers you must convert your data into floats or int):
var data = [];
for (var i = 1; i < $internal.data.length; i++)
data.push(
{
x: parseFloat($internal.data[i][2]),
y: parseFloat($internal.data[i][3]),
z: parseFloat($internal.data[i][4]),
name: $internal.data[i][1],
country: $internal.data[i][0]
}
);
After You've chosen all of you're options for your chart you can add your data:
series: [{
data: data
}]
Once you are happy with your chart you can directly load it into Excel by pasting the URL in the Funfun add-in. Here is how it looks like with my example:
Of course you can use another library than Highcharts, there are a lot of powerful libraries for data visualization like charts.js and D3.js.
I know this is an old post but I hope it helps people with the same problem.
Disclosure : I’m a developer of Funfun.
Source: stackoverflow.com
Related Query
- How to Export JavaScript Chart to Excel file (HighCharts)
- How can I read an Excel File with JavaScript (without ActiveXObject)
- Highcharts export chart exportSettings with svg file
- How do i export HIGHCHARTS chart to a .jpeg
- Highcharts - how to export chart with different scale in one click
- 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?
- Highcharts - how to export chart with a custom legend?
- Highcharts - How to get the particular chart id on click of custom label in export options
- How to show categorized Highcharts Chart using csv file
- Server side chart .svg export with Highcharts and PhantomJS, error loading data from .csv file
- How to create a column range chart in Highcharts using range and navigator functions?
- How can I get access to a Highcharts chart through a DOM-Container?
- How to set Highcharts chart maximum yAxis value
- How to display the value instead of percentage in a pie chart using jquery Highcharts
- Highcharts - how to have a chart with dynamic height?
- How do I rotate my HighCharts bar chart so its vertical, not horizontal?
- JavaScript - Export Div with SVG chart + HTML as and Image
- Export Highcharts to PDF (using javascript and local server - no internet connection)
- How to export a Highchart chart to PDF thanks to a button outside the chart?
- How do I dynamically change a data point in Highcharts using JavaScript
- HighCharts is undefined because multiple Html pages in Javascript file
- How to export the whole page or html content with Highcharts not just the chart?
- How do you increase the performance of highcharts chart creation and rendering
- HighCharts - How to create dynamic chart that exports EVERYTHING
- Javascript Highcharts v3.0.5 - How to hide Y Axis Title when using multiple Y Axis
- Highcharts : Chart with drilldown how to obtain click event of drill up button
- Export HighChart as an image in excel file together with the other page contents
- Highcharts how to use JavaScript variable as series data source?
- How do I get remove of 'data table' option from High chart export
More Query from same tag
- Highcharts using Datatable in Asp.Net
- Having only one yaxis but at the right side on Highcharts.js
- Make chart.renderer.path as plotline Highcharts
- chart not showing when executed in c#
- How to change the marker style on hover in HighCharts
- How to add data to a custom HighChart's HighMaps map? joinBy?
- Combine Dates with Homerun Data from JSON
- Series fillColor for marker on hover ONLY
- append the min max value lableof solidguage with string in highchart
- Highcharts Legend event click to get data
- Draw another chart/or series on mouse hover in HighStock
- Converting Poloniex API Callback JSON into format suitable for Highcharts.Stockchart
- Stacked highcharts on the same graph, with a new y axis each time?
- Highcharts pie chart outer circle
- Highcharts - Put different URL to each of data in donut-pie
- How to change Highcharts xAxis formatting from yearly to monthly?
- Use Highchart context menu provided in version v4.0.0
- how to create array object use jquery
- remove grid line on chart
- get access to chart-object in highchart
- Line Chart using array
- ionic 2 Uncaught (in promise): Error: Highcharts error #17: www.highcharts.com/errors/17
- Highchart.js secondary axis not showing on the opposite side
- Changing highmap values dynamically
- Make highcharts bar-chart threshold line visible & labels not to overlap on one another
- how to get chart object inside a point event function in Highcharts
- Highcharts - How to display legend symbol inside the tooltip
- Highcharts draggable annotaion how to move by steps?
- Highcharts Spline lines not showing up
- Highcharts date in form of Day(Integer) - Month(the name of the month), like 17 - July