CSV mapping example
Mapping configuration
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<div id="pivot-container"></div>
CSS
@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);
JavaScript
let pivot = new Flexmonster({
container: "#pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
height: 430,
toolbar: true,
report: {
dataSource: {
filename: "data/sales_data_without_types.csv",
mapping: {
"Order ID": {
type: "string"
},
"Month": {
type: "month"
},
"Company Name": {
type: "string"
},
"Region": {
type: "string",
hierarchy: "Geography"
},
"State": {
type: "string",
parent: "Region",
hierarchy: "Geography"
},
"City": {
type: "string",
parent: "State",
hierarchy: "Geography"
},
"Salesperson": {
type: "string"
},
"Payment Method": {
type: "string"
},
"Category": {
type: "string"
},
"Name": {
type: "string",
caption: "Product Name"
},
"Price": {
type: "number",
caption: "Unit Price"
},
"Quantity": {
type: "number"
},
"Revenue": {
type: "number"
},
"Shipping Cost": {
type: "number"
}
}
},
slice: {
rows: [
{
uniqueName: "Geography"
}
],
columns: [
{
uniqueName: "Category"
},
{
uniqueName: "[Measures]"
}
],
measures: [
{
uniqueName: "Revenue",
aggregation: "sum",
format: "currency_US"
}
],
drills: {
rows: [
{
tuple: ['geography.[midwest]']
}
]
}
},
formats: [{
name: "currency_US",
thousandsSeparator: ",",
decimalSeparator: ".",
...