JSFiddle - React, Tailwind, and code Playground
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
JavaScript
var pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
global: {
localization: {
aggregations: {
sum: {
caption: "My Sum",
totalCaption: "{0} - My Sum",
grandTotalCaption: "{0} - My Sum Total"
},
count: {
caption: "My Count",
totalCaption: "{0} - My Count",
grandTotalCaption: "{0} - My Count Total"
}
}
}
},
report: {
dataSource: {
data: getData()
},
slice: {
rows: [
{
uniqueName: "Color"
}
],
columns: [
{
uniqueName: "[Measures]"
}
],
measures: [
{
uniqueName: "Price",
aggregation: "sum"
},
{
uniqueName: "Color",
aggregation: "count",
availableAggregations: [
"count",
"distinctcount"
]
}
]
},
options: {
viewType: "grid_charts"
}
},
height: 700
});
function getData(){
return [
{
"Color" : "green",
"Country" : "Canada",
"State" : "Ontario",
"City" : "Toronto",
"Price" : 174,
"Quantity" : 22
},
{
"Color" : "red",
"Country" : "USA",
"State" : "California",
"City" : "Los Angeles",
"Price" : 166,
"Quantity" : 19
}
];
}