bug array prototype

Data source

by sergin

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div>
  <h2>How to configure multilevel hierarchies</h2>
  <p>
  This example demonstrates how to create multilevel hierarchies when connecting to JSON or CSV.
  </p>
  <p>
  In Flexmonster, you can configure multilevel hierarchies from non-hierarchical data using the mapping. In this example, we created the <code>Geography</code> hierarchy with three levels: <code>Country</code>, <code>State</code>, and <code>City</code> (lines 8-20 in the JavaScript box).
  </p>
  <p><a href="https://www.flexmonster.com/doc/mapping/#!multilevel-hierarchies" target="_blank">Visit our docs to learn more about creating multilevel hierarchies</a>.
  </p>
</div>

<div id="pivot-container"></div>

CSS

h2 {
  text-align: center;
}

p {
  font-size: 15px;
  line-height: 1.5;
  padding-right: 10px;
  padding-left: 10px;
}

a {
  color: #00a45a;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
    font-size: 105%;
    color: #DF3800;
    background-color: #f5f5f5;
    padding: 1px 4px;
    font-family: monospace !important;
    border-radius: 4px;
}

JavaScript

Array.prototype.test = function () {
     return alert("test")
   };
 
let pivot = new Flexmonster({
  container: "pivot-container",
  componentFolder: "https://cdn.flexmonster.com/",
  height: 400,
  report: {
    dataSource: {
      data: getData(),
      mapping: {
        "Country": {
          hierarchy: "Geography",
        },
        "State": {
          hierarchy: "Geography",
          parent: "Country"
        },
        "City": {
          hierarchy: "Geography",
          parent: "State"
        }
      }
    },
    slice: {
      columns: [{
          uniqueName: "[Measures]"
        },
        {
          uniqueName: "Color"
        }
      ],
      rows: [{
        uniqueName: "[Geography]"
      }],
      measures: [{
        uniqueName: "Price",
        aggregation: "sum"
      }]
    }
  }
});

function getData() {
  return [{
      "Color": "red",
      "Country": "Canada",
      "State": "Ontario",
      "City": "Toronto",
      "Price": 174
    },
    {
      "Color": "blue",
      "Country": "USA",
      "State": "California",
      "City": "Los Angeles",
      "Price": 166
    }
  ];
}