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>
<p>The output will appear <a href="#output">under the component</a>.</p>
<div id="pivot-container"></div>
<div class="output" id="output">Output will appear here</div>
CSS
.output {
width: 80%;
height: 300px;
margin-left: auto;
margin-right: auto;
padding: 20px;
background: rgba(242, 242, 242, 1);
font-family: Menlo, Monaco, "Courier New", Courier, monospace;
white-space: pre;
font-size: 16px;
font-weight: 400;
overflow-y: scroll;
margin-top: 20px;
}
p {
font-size: 15px;
line-height: 1.5;
padding-right: 10px;
padding-left: 10px;
}
a {
color: #00a45a;
text-decoration: none;
}
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 300,
customizeAPIRequest: customizeAPIRequestFunction,
report: {
dataSource: {
type: "api",
url: "https://olap.flexmonster.com:9500",
index: "fm-product-sales"
},
slice: {
rows: [
{ uniqueName: "Category" }
],
columns: [
{ uniqueName: "[Measures]" }
],
measures: [
{ uniqueName: "Price" }
]
}
}
});
function customizeAPIRequestFunction(req) {
req.mindate = "DATE1";
req.maxdate = "DATE2";
showOutput(JSON.stringify(req, null, 2));
return req;
}
function showOutput(content) {
document.getElementById("output").innerText = content;
}