JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="toggleCustomization()">
Toggle customization
</button>
<div id="pivotContainer"></div>
JavaScript
let pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: getData()
},
options: {
viewType: "charts",
chart: {
showDataLabels: true
}
}
}
});
let customized = false;
function toggleCustomization() {
if (customized) {
flexmonster.customizeChartElement();
} else {
flexmonster.customizeChartElement(customizeChartElementFunction);
}
customized = !customized;
}
function customizeChartElementFunction(element, data) {
if (data.type === "series_label" && data.value === 0) {
element.remove();
}
}
function getData() {
return [{
Item: "Car",
Price: 2356
},
{
Item: "Bike",
Price: 1244
},
{
Item: "Old piano",
Price: 0
}
]
}