Flexmonster - Pivot Table demo
Demos
by ragilyogai
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.1/js/bootstrap.min.js"></script>
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div class="wrapper">
<div id="side-menu" class="col-md-2 col-sm-3">Side Menu</div>
<div id="pivot-container" class="col-md-10 col-sm-9"></div>
</div>
CSS
.wrapper {
display: flex;
}
#side-menu {
width: 15%;
margin: auto;
font-size: 24px;
border-style: solid;
height: 100vh;
}
#pivot-container {
width: 85%;
}
.fm-custom-cell {
display: flex !important;
align-items: center !important;
font-size: 12px !important;
}
.fm-custom-cell .flag-icon {
width: 21px !important;
height: 16px !important;
margin-left: 0 !important;
margin-right: 2px !important;
}
#fm-pivot-view .fm-grid-layout .fm-custom-cell.fm-expanded .fm-expanded-icon::before,
#fm-pivot-view .fm-grid-layout .fm-custom-cell.fm-collapsed .fm-collapsed-icon::before {
top: -2px;
height: 16px;
}
#fm-pivot-view .fm-drillthrough-view {
position: fixed !important;
top: 15vh !important;
left: 8vw !important;
}
JavaScript
new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 550,
customizeCell: customizeCell,
toolbar: true,
report: {
"dataSource": {
"type": "json",
"filename": "https://cdn.flexmonster.com/data/retail-data.json",
"mapping": {
"Quantity": {
"type": "number"
},
"Price": {
"type": "number"
},
"Retail Category": {
"type": "string"
},
"Sales": {
"type": "number"
},
"Order Date": {
"type": "year/quarter/month/day"
},
"Date": {
"type": "date"
},
"Status": {
"type": "string"
},
"Product Code": {
"type": "string"
},
"Phone": {
"type": "string"
},
"Country": {
"type": "string",
"folder": "Location"
},
"City": {
"type": "string",
"folder": "Location"
},
"CurrencyID": {
"type": "property",
"hierarchy": "Country"
},
"Contact Last Name": {
"type": "string"
},
"Contact First Name": {
"type": "string"
},
"Deal Size": {
"type": "string"
}
}
},
"slice": {
"rows": [
{
"uniqueName": "Country",
"filter": {
"members": [
"country.[australia]",
"country.[usa]",
"country.[japan]"
]
}
},
{
"uniqueName": "Status",
}
],
"columns": [
{
"uniqueName": "Order Date"
},
{
"uniqueName": "[Measures]"
}
],
"measures": [
{
...