JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="exportToHtml()">Export to HTML</button>
<button onclick="print()">Print</button>
<br><br>
<div id="pivot-container"></div>
JavaScript
const pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
filename: "https://cdn.flexmonster.com/data/data.csv",
},
options: {
viewType: "charts",
chart: {
type: "pie"
}
},
}
});
function exportToHtml() {
pivot.exportTo('html', { destinationType: 'plain', }, result => {
const html = result.data.toString();
const newWindow = window.open(null);
newWindow.document.write(html);
newWindow.document.close();
});
}
function print() {
pivot.print();
}