score:6
Here's a server side solution based on PhantomJS. You can use JSONP to make a cross domain call to image.vida.io.
Your chart/visualization need to be accessible from outside. You can pass credential to the URL.
Then you can display image with img tag:
<img src="data:image/png;base64, [base64 data]"/>
It works across browser.
score:9
With the information from "Render charts on the server" (from jkraybills answer), I've created this minimal example using a Ajax to get an image of a chart that has not been rendered, and displaying it in an img
-tag.
HTML:
<img id="chart" style="width: 600px;" />
Javascript:
// Regular chart options
var options = {
title: {
text: 'My chart'
}
...
}
//URL to Highcharts export server
var exportUrl = 'http://export.highcharts.com/';
//POST parameter for Highcharts export server
var object = {
options: JSON.stringify(options),
type: 'image/png',
async: true
};
//Ajax request
$.ajax({
type: 'post',
url: exportUrl,
data: object,
success: function (data) {
// Update "src" attribute with received image URL
$('#chart').attr('src', exportUrl + data);
}
});
As in this JSFiddle demonstration.
The rest of the POST parameter (width
, callback
...) are in the documentation.
score:11
I know this is now an old question, but since it came up #1 for me in a Google search result, I think it's worth mentioning that Highcharts now natively supports a server-side image generation script and it works great.
score:28
Here's a hack if you have your heart set on using HighCharts. It uses canvg to parse the SVG into a canvas and then converts the canvas to a PNG.
chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
title: {
text: ''
},
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]
}],
navigation: {
buttonOptions: {
align: 'center'
}
}
});
canvg(document.getElementById('canvas'), chart.getSVG())
var canvas = document.getElementById("canvas");
var img = canvas.toDataURL("image/png");
document.write('<img src="'+img+'"/>');
Source: stackoverflow.com
Related Query
- Render Highcharts canvas as a PNG on the page
- Highcharts Error #16: charts not showing on the same page
- How to export the whole page or html content with Highcharts not just the chart?
- drilldown maps and funnell charts on the same page using highcharts
- highcharts display in my render html page which i want to convert into PDF using wkhtmltopdf in rails
- how to display 2 same highcharts without duplicate the code
- Why do I have the issue 'property assigment expected' when I want to display a chart on my web page using highcharts
- How do I export the content of a page as either jpg or pdf with Highcharts and scrollable data?
- Not able to render the charts in pdf using Wickedpdf and Highcharts in rails 2.3 app
- Highcharts series doesnt show data and render the chart
- Highcharts (Gauge) and Highstock on the same page with Meteor
- To display legend of the chart outside the canvas of the chart in highcharts
- Strange character in the Highstock source code
- What's the code in Highcharts such that the bars (columns) in the same group use the same color?
- I am using click event to trigger a new page to generate the drill down data from highcharts however the entire chart is being generated
- how to render multiple line charts - highcharts on same page using highcharts react wrapper - highcharts-react-offical
- How to set the enable property to a highcharts line in page load
- Conflict with GSAP and Highcharts on the same page
- How to render x-axis labels in Highcharts without the decimal points?
- How to set the url of moment.min.js to local js file when highcharts exporting png file
- How to use highcharts to display data of only five point when the page is initialized?
- How to modify the code so that Highcharts graph does not cover fixed navigation bar at the top of the page?
- Get the exact highcharts data which was used to render a chart
- Highcharts gauge is render before the data is fetched by json
- Highcharts is not displaying in the div at all, resulting in a blank page - Using python flask and jinja template?
- Printing from Highcharts returns focus to the top of the page
- how to enable only 1 out of 2 column column graph by default when page loads in highcharts and the 2nd one gets visible when toggled in the legend
- Highcharts When printing the chart does not fit the page
- How to automatically download png file from highchart when the page load
- How to render efficiently few hundreds of angular highcharts in the browser without crashing?
More Query from same tag
- Highchart Pie chart, de-structure dataLabels and define custom formatter
- Disable-Click on Legend in HighCharts Column Graph
- Hichcharts (Highstock) — Why isn't the plotLine being drawn on the chart?
- It's not possible load Highstock from the CDN as an AMD module
- Random number on Highcharts + AngularJS
- HighCharts: Color of label according to the color of pie slice
- Highcharts Sunburst Chart Drillup
- Async Drill-down not updating of HighCharts
- OnClick() with Highcharts in MVC 4
- ionic 2 highchart not visible
- I want to implement drilldown for heatmap or heatstock of highcharts
- Highchart: Adding flags to a line chart
- How to reference yData from another series in each category of a highcharts column chart
- Highchart pie-basic
- Is there a way to add a custom tooltip to the second level columns of the drilldown on highcharts?
- Highcharts datetime axis labels according to data point groups
- How to unite function index and function data to one new function?
- How to add value in the tooltip in graph Highcharts?
- States Not Working on Highmaps mappoint click
- Highcharts showing timestamp as wrong date
- Dynamic creation og Highcharts in Angularjs
- Need to have a clear all button in for legend items in Highchart react
- Highcharts or Fusioncharts,which one to select
- Revert theme to default
- How do I dynamically change a data point in Highcharts using JavaScript
- Add second series to highchart master detail
- How to change color of bar in column chart with different level of percentage in highcharts
- Highchart Annotation Scroll
- How do you call a programmer-defined function in javascript in an android webview?
- Remove padding from barcharts Highcharts.js