I'm ussing highcharts in my project and I'm abit new in that. My problem is that how to get a capture of my chart and then send it by email? for email sending I'm ussing PHPMailer, the email works correctly. I searched in highcharts documentation they propose node export-server, but there is no example. I got some hints from internet but doesn't work. I want, when I click on send chart by email button, it sould take the picture of chart and send it to email. So, can anybody kindly help me please with an example? A simple example of My code is bellow:
// import highcharts and export server
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
// sendGraphByMail is my PHPMailer configuration file
<a href="sendGraphByMail.php">
<button class="send-chart" onclick="sendChart()">Send chart by e-mail</button>
</a>
<div id="container"></div>
<h2>
Exported image below
</h2>
<img id="image" />
<script>
var options = {
chart: {},
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],
type: 'column'
}]
}
var chart = Highcharts.chart('container', options);
function sendChart() {
console.log('Send chart button clicked !');
// I think the exprot script goes here
}
a screen shot of page look like this.
