flexmonster 2.8.31

by sergin

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/2.8.31/flexmonster.js"></script>
<button onclick="removeFields()">
  test
</button>
<div id="pivotContainer"></div>

JavaScript

/*let pivot = new Flexmonster({
  container: "pivotContainer",
  componentFolder: "https://cdn.flexmonster.com/2.8.31/",
  licenseFilePath: "https://cdn.flexmonster.com/jsfiddle.charts.key",
  toolbar: true,
  report: {
    dataSource: {
      filename: "https://cdn.flexmonster.com/data/data.csv"
    }
  }
});*/
var jsonData = [ 
    { 
        "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
    } 
]; 
let pivot = new Flexmonster({
  container: "pivotContainer",
  componentFolder: "https://cdn.flexmonster.com/2.8.31/",
  licenseFilePath: "https://cdn.flexmonster.com/jsfiddle.charts.key",
  toolbar: true,
     report: { 
        dataSource: { 
            data: jsonData ,
            mapping:{
        			"Color":{
              	"type":"string"
              },
              "Country":{
              	"type":"string"
              },
              "State":{
              	"type":"string"
              },
              "City":{
              	"type":"string"
              },
              "Price":{
              	"type":"number"
              },
              "Quantity":{
              	"type":"number"
              }
        		}
        }, 

        slice: { 
            rows: [ 
                { uniqueName: "Color" }, 
                { uniqueName: "[Measures]" } 
            ], 
            columns: [ 
                { uniqueName: "Country" } 
            ], 
            measures: [ 
                { uniqueName: "Price",  aggregation: "sum"  } 
            ] 
        } 
    }
});


function removeFields() {
	const report = {};
	report.dataSource = {
    	data: jsonData,
      mapping: {
      	"City":{
        	"type":"string"
        },
        "Price":{
       ...