JavaScript
const pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
data: getData(),
mapping: {
Year: {
hierarchy: "Date",
},
Month: {
hierarchy: "Date",
parent: "Year",
},
Day: {
hierarchy: "Date",
parent: "Month",
},
},
},
slice: {
rows: [
{
uniqueName: "Color",
},
],
columns: [
{ uniqueName: "Date" },
{
uniqueName: "[Measures]",
},
],
measures: [
{
uniqueName: "Price",
aggregation: "sum",
},
],
},
},
})
function getData() {
return [
{
Color: "green",
Country: "Canada",
State: "Ontario",
City: "Toronto",
Price: 174,
Quantity: 22,
Year: 2024,
Month: "July",
Day: 29,
},
{
Color: "green",
Country: "USA",
State: "California",
City: "Los Angeles",
Price: 166,
Quantity: 19,
Year: 2025,
Month: "July",
Day: 15,
},
{
Color: "blue",
Country: "USA",
State: "Florida",
City: "Tallahassee",
Price: 215,
Quantity: 25,
Year: 2024,
Month: "September",
Day: 5,
},
{
Color: "blue",
Country: "Canada",
State: "Quebec",
City: "Montreal",
Price: 194,
Quantity: 15,
Year: 2025,
Month: "March",
Day: 10,
},
]
}