Pie chart with one field in columns

Flexmonster Pivot Charts

by Flexmonster Pivot Table

HTML

<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div>
  <p>
    In this example, a column member for pie chart is preset using the
    <a
      target="_blank"
      href="https://www.flexmonster.com/api/chart-options-object/#piedataindex"
    >chart.pieDataIndex</a> property (line 32 in the JavaScript box).
  </p>
  <p>
    You can change the column member in the code or via UI using the dropdown
    with members.
  </p>
</div>

<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/",
  toolbar: true,
  report: {
    dataSource: {
      filename: "data/data.json"
    },
    slice: {
      rows: [
      	{ 
        	uniqueName: "Country"
        }
      ],
      columns:[
      	{
        	uniqueName: "Category",
          filter:{
          	exclude: ["Clothing", "Components"]
          }
        }
      ],
    	measures: [
   			{ uniqueName: "Price" }
      ]
    },
    options: {
    	viewType: "charts",
      configuratorButton: false,
      chart:{
      	type: "pie",
        pieDataIndex: "1"
      }
    }
  }
});