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
let pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 400,
toolbar: true,
report: {
/* Data source configuration. Read more about supported data sources and their configuration here: https://www.flexmonster.com/doc/data-source
*/
"dataSource": {
"type": "json",
"data": [{
"Symbol": "BTCUSDT",
"Entry Price": 20252.5,
"Avg. Price": 20353.5,
"Execution Time": "2022-11-11",
"Entry Time": "2022-11-11",
"Filled Price": "N/A"
},
{
"Symbol": "BTCUSDT",
"Entry Price": 20559.9,
"Avg. Price": 20559.9,
"Execution Time": "2022-10-11",
"Entry Time": "2022-10-11",
"Filled Price": "N/A"
}
],
/*
Define the data types in mapping: https://www.flexmonster.com/doc/mapping/
*/
"mapping": {
"Execution Time": {
"type": "datetime"
},
"Entry Time": {
"type": "datetime"
}
}
},
/*
Slice configuration, used to select fields to be shown on the grid: https://www.flexmonster.com/doc/slice
*/
"slice": {
"rows": [{
"uniqueName": "Symbol"
},
{
"uniqueName": "Filled Price"
}
],
"measures": [{
"uniqueName": "Execution Time",
},
{
"uniqueName": "Entry Time",
},
{
"uniqueName": "Entry Price",
},
{
"uniqueName": "Avg. Price",
}
],
/*
Fields can be customly reordered
*/
"flatOrder": [
"Symbol",
"Execution Time",
"Entry Price",
"Avg. Price",
"Filled Price",
"Entry Time"
]
},
/* Options configuration: https://www.flexmonster.com/api/options-object/
*/
"options": {
"grid": {
...