score:0
how about combining native Highcharts export functionality with html2canvas?
First, you export Highcharts to a file. I'm guessing that it's enough to know the URL you have to call to get an image.
Second, you use your standard html2canvas magic to produce a document without a chart. (You may need to specify width and height of the div with chart so it doesn't collapse in exported file).
Finally, you use gd or imagemagick to paste one onto another and serve back to client.
score:0
It's to simple you can use this code for capture the screenshot of particular area
you have to define the div id in html2canvas. I'm using here 2 div-:
div id="car"
div id ="chartContainer"
if you want to capture only cars then use car i'm capture here car only you can change chartContainer for capture the graph
html2canvas($('#car')
copy and paste this code
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
theme: "light2",
title:{
text: "Simple Line Chart"
},
axisY:{
includeZero: false
},
data: [{
type: "line",
dataPoints: [
{ y: 450 },
{ y: 414},
{ y: 520, indexLabel: "highest",markerColor: "red", markerType: "triangle" },
{ y: 460 },
{ y: 450 },
{ y: 500 },
{ y: 480 },
{ y: 480 },
{ y: 410 , indexLabel: "lowest",markerColor: "DarkSlateGrey", markerType: "cross" },
{ y: 500 },
{ y: 480 },
{ y: 510 }
]
}]
});
chart.render();
}
</script>
</head>
<body bgcolor="black">
<div id="wholebody">
<a href="javascript:genScreenshotgraph()"><button style="background:aqua; cursor:pointer">Get Screenshot of Cars onl </button> </a>
<div id="car" align="center">
<i class="fa fa-car" style="font-size:70px;color:red;"></i>
<i class="fa fa-car" style="font-size:60px;color:red;"></i>
<i class="fa fa-car" style="font-size:50px;color:red;"></i>
<i class="fa fa-car" style="font-size:20px;color:red;"></i>
<i class="fa fa-car" style="font-size:50px;color:red;"></i>
<i class="fa fa-car" style="font-size:60px;color:red;"></i>
<i class="fa fa-car" style="font-size:70px;color:red;"></i>
</div>
<br>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="box1">
</div>
</div>>
</body>
<script>
function genScreenshotgraph()
{
html2canvas($('#car'), {
onrendered: function(canvas) {
var imgData = canvas.toDataURL("image/jpeg");
var pdf = new jsPDF();
pdf.addImage(imgData, 'JPEG', 0, 0, -180, -180);
pdf.save("download.pdf");
}
});
}
</script>
</html>
Source: stackoverflow.com
Related Query
- How do I export the content of a page as either jpg or pdf with Highcharts and scrollable data?
- How to export the whole page or html content with Highcharts not just the chart?
- How to export CSV and XLS with external button in Highcharts
- Highcharts : How do I keep the marker formatting and make the click event fire with a 5K+ point scatter plot?
- How to use jspdf to print and download the multiple highcharts contents in pdf format
- Highcharts (Gauge) and Highstock on the same page with Meteor
- Conflict with GSAP and Highcharts on the same 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, How to show datatable when export PDF and not show pdf when normal with Drilldown Chart
- how can I use rangeselector and navigation in highcharts in the given code
- HIGHCHARTS - Given a series with UNIX stamps and values pairs for the data, how do I show only the date for the first and last point on xAxis?
- Highcharts export to PDF with text aligned in the top center of PDF
- Calling Highcharts export to jpeg but the source is https and exporting is http (security warnings issued by browser)
- 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 to import highcharts with webpack and babel
- How do you increase the performance of highcharts chart creation and rendering
- Add a gap between the second and third series in a Highcharts column plot with four series displayed
- Plotting seconds, minutes and hours on the yAxis with Highcharts
- Export HighChart as an image in excel file together with the other page contents
- How to Check and Uncheck all the Legend elements in HighCharts Linechart?
- Highcharts - how to remove "Open in Highcharts Cloud" from the export menu
- How to structure Angular with Highcharts and lots of dynamic data
- Highcharts 3.0, area chart with stacked and unstacked series - how to fix?
- Highcharts - Global configuration with common code and unique data & Headings
- How to enable noData with highcharts and angular
- drilldown maps and funnell charts on the same page using highcharts
- How to use Highmaps and Highcharts with Meteor?
- How to achieve the best possible performance with mutable data and real-time charts in React?
- How to draw a bubble map with longitude and latitude using Highcharts in react
More Query from same tag
- highcharts have data Labels only on some points
- Issue with Dates - trying to plot MongoDB data in Highcharts via PHP
- Highcharts: Can I export to the user an Excel or CSV of the raw data driving the chart?
- incorrect highcharts export server js script error codes
- Highstock different time value interval
- Setting Highcharts styledMode: true fails to load CSS
- Highstock + angular material + flex-layout problems
- Animation end callback after adding points
- How to bind model list variable to highchart
- Line chart with multiple series and irregular intervals not displaying correctly
- Highcharts with yaxis max property doesn't hide plotbands and lables
- Highstock Y-Axis labels overlap eachother
- Embed javascript code in a django template
- Highcharter annotation on date x-axis not working - R
- Chart type to plot only data points
- High charts (Time Series Zoomable) not working with my data
- Remove padding from barcharts Highcharts.js
- Delay after addpoint when y-axis with opposite: true
- Using highchart to get a series of a series in a column chart
- Highcharts doesn't display all categories
- How does 'min' 'max' works in Highcharts? I can't get the scrollbar to work
- Custom SVG Symbol for location for highcharts
- HighCharts: set specific border width and border color dynamically for one column
- How to prevent my stacked series from being in reverse order?
- How to break highchart bars for extreme values
- Reduce space between column in Highcharts
- Highcharts synchronized charts combining with other charts
- Highcharts export server does not export labels
- highcharts tooltip not working after zoom
- Is there a way to use two series (or some kind of group) in highcharter wordcloud?