JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.min.js'></script>
<script src="controllers/schedular.js"></script>
</head>
<body onload="abc()">
<div id="DashboardData"></div>
<div class="container">
<div class="row">
<div class="col-md-6,col-lg-6,col-sm-6">
<canvas id='barchart'></canvas>
</div>
<hr>
</div>
</div>
<script>
function toJSON(DashboardData) {
return JSON.stringify(DashboardData);
}
var data ={{ toJSON this }};
var ctx = document.getElementById('barchart').getContext('2d');
var barchart = new Chart(ctx, {
type: 'bar',
data: {
labels:["ddd"],
datasets: [{
label: 'Customers',
data:[89],
backgroundColor:'blue'
}]
},
options: {
tooltips: {
mode: 'index',
intersect: false
},
responsive: true,
scales: {
xAxes: [{
stacked: true,
}],
yAxes: [{
stacked: true
}]
},title: {
display: true,
text: 'Day Wise Stastics'
},
animation: {
onComplete: function () {
// set the PDF printing trigger when the animation is done
// to have this working, the phantom-pdf menu in the left must
// have the wait for printing trigger option selected
...
JavaScript
jsreport.render({
template: {
content: fs.readFileSync('./report.handlebars').toString('utf8'),
helpers: 'function toJSON() { return 1 }',
engine: 'handlebars',
recipe: 'phantom-pdf',
phantom: {
header: '<div style="float:right">Page {#pageNum} of {#numPages}</div>',
footer: "Rent Dues Report",
format: 'A4',
orientation: 'portrait',
footerHeight: '0.7cm',
headerHeight: '0.7cm',
margin: '0.5cm',
waitForJS: true
}
},
data: {
DashboardData: data,
startDate: startDate,
endDate: endDate,
dummydata: dummydata
}
})