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>
<div id="pivotContainer"></div>
JavaScript
let pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
width: 600,
report: {
dataSource: {
filename: "data/data.csv"
},
"options": {
"viewType": "charts",
"chart": {
"type": "bar_h",
"showDataLabels": true
}
}
}
});
flexmonster.customizeChartElement((element, data) => {
if (data.type == "series_label") {
const containerRect = document.querySelector(".fm-ui-container .fm-chart > svg").getBoundingClientRect();
const labelRect = element.getBoundingClientRect();
if(containerRect.right < labelRect.right) {
const difference = labelRect.right - containerRect.right;
element.setAttribute("x", element.getAttribute("x") - difference - 10);
}
}
});