☝️Small business or a startup? See if you qualify for our special offer.
+
List of all demos

Angular Pivot Table: custom cells

You have full control over your Angular pivot table component — define how rows, columns, or specific cells will be displayed on the grid.

Domain mismatchFlexmonster is used on the domain prod-flexmonster-container-service.tbvgv2m9krico.us-east-1.cs.amazonlightsail.com, which does not match the domain your license key was issued for (flexmonster.com)

Contact our team to request a key for the domain prod-flexmonster-container-service.tbvgv2m9krico.us-east-1.cs.amazonlightsail.com

You are using the following key:
Z707-XCI209-0Q203E-3I5M00-28254L-0B2Z2S-0L0T3F-1H3W3A-421F46

Current version: 2.9.109 (build 08/04/2025)

  • .ts
  • .html
  • .css
import { Component, OnInit } from "@angular/core";

@Component({
  selector: "pivotComponent",
  templateUrl: "./pivot.component.html",
  styleUrls: ["./pivot.component.css"],
})
export class PivotComponent implements OnInit {
  public report: Object = {
    dataSource: {
      type: "csv",
      filename: "https://cdn.flexmonster.com/data/data.csv",
    },
    slice: {
      rows: [
        {
          uniqueName: "Country",
        },
        {
          uniqueName: "Business Type",
        },
      ],
      columns: [
        {
          uniqueName: "Color",
        },
        {
          uniqueName: "[Measures]",
        },
      ],
      measures: [
        {
          uniqueName: "Quantity",
          aggregation: "percentofcolumn",
        },
      ],
      expands: {
        expandAll: true,
      },
    },
    formats: [
      {
        decimalPlaces: 2,
      },
    ],
  };

  constructor() {}

  ngOnInit(): void {}

  customizeCellFunction(cell: Flexmonster.CellBuilder, data: Flexmonster.CellData) {
    if (data?.type === "value" && !data?.isDrillThrough) {
      if (data.value! < 5) {
        cell.text = `<img src="https://cdn.flexmonster.com/i/empty_pie.svg" class="centered">`;
      } else if (data.value! >= 5 && data.value! < 10) {
        cell.text = `<img src="https://cdn.flexmonster.com/i/quarter_pie.svg" class="centered">`;
      } else if (data.value! >= 10 && data.value! < 25) {
        cell.text = `<img src="https://cdn.flexmonster.com/i/half_pie.svg" class="centered">`;
      } else if (data.value! >= 25 && data.value! < 50) {
        cell.text = `<img src="https://cdn.flexmonster.com/i/three_quarters_pie.svg" class="centered">`;
      } else if (data.value! >= 50) {
        cell.text = `<img src="https://cdn.flexmonster.com/i/full_pie.svg" class="centered">`;
      }
    }
  }
}
<fm-pivot
  [componentFolder]="'https://cdn.flexmonster.com/'"
  [height]="600"
  [report]="report"
  [customizeCell]="customizeCellFunction">
</fm-pivot>
img.centered {
  display: block !important;
  margin: auto !important;
  color: transparent !important;
}

#fm-pivot-view .fm-grid-row {
  min-height: 47px;
}

Flexmonster has one of the largest list of customization options among other Angular data visualization components. Not only can you localize the component, change component themes, customize the Toolbar and the context menu, but also replace cell values with any visual content (e.g., with icons), highlight cells based on their data, add hyperlinks, and more.

In this Angular pivot grid example, you can see how to substitute numbers with icons based on cell values. Change the configurations of the pivot table and see how the formatting is applied on the fly.