# Percent Bar

Canonical page: https://www.adaptabletools.com/docs/handbook-styled-column-percent-bar

- The Percent Bar Style renders a coloured bar in each cell in a numeric column
- The width of the bar is calculated as a percentage of the cell value relative to a provided Min and Max
- Min and Max can be set for whole Column or in Ranges, and be hard-coded or based on another Column values
- Bars can grow from the left edge, from `0`, from a custom baseline, or as a centred axis for negative values
- The actual Cell Value (and Percent Value) can also be displayed, above, below or merged with the Bar
- An optional Tooltip can show the Cell Value, the Percent Value, or both on hover
- By default the bar renders on data rows only but can also display on Group, Summary and Total rows

The Percent Bar Style enables **numeric columns** to display a coloured bar in each cell.

Each cell bar's width is calculated as a percentage of the cell's value compared to a maximum value.

## Anatomy

A Percent Bar cell is composed of three main elements:

- **Bar** — a horizontal coloured bar whose width represents the cell value relative to `[Min, Max]`

  
  - The bar can grow from the left edge, from `0`, from `Min`, or from a fixed numeric `Origin`
  - It can also use a centred-axis where positive values extend right and negative values extend left
  

- **Cell Text** _(optional)_ — the cell value and / or the percentage value

  
  - They can be placed above, below or merged with Bar and on left, right or center of cell (9 possibilities)
  - If both are in same spot, they are concatenated with a space (Cell Value first, then Percent Value)
  

- **Back Color** _(optional)_ — fills the part of the cell that isn't covered by the bar

**Example: Percent Bar: Showcase**

Three Percent Bars side-by-side, each configured differently

- **GitHub Stars** — three-band **traffic-light** colours (red / orange / green) with a subtle back colour
- **Closed PRs** — a single colour bar (cyan) with the cell value **merged** centred on top
- **Weekly Issue Change** — **diverging** bar (`Origin: 'Auto'`) with red below `0` and green above, cell value merged on top
- Non-bar columns (`language`, `has_pages`) sit between the bars as visual separators
- Each of these patterns is broken down in detail in the sections below

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Percent Bar Showcase',
  initialState: {
    Dashboard: {
      ModuleButtons: ['StyledColumn'],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'github_stars',
            'language',
            'closed_pr_count',
            'has_pages',
            'week_issue_change',
            'open_issues_count',
            'closed_issues_count',
            'updated_at',
            'pushed_at',
          ],
          ColumnSorts: [
            {
              ColumnId: 'github_stars',
              SortOrder: 'Desc',
            },
          ],
          AutoSizeColumns: true,
        },
      ],
    },
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'github_stars',
          Name: 'GitHub Stars traffic-light bar',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellRanges: [
              {Min: 0, Max: 10000, Color: 'rgba(220, 53, 69, 0.85)'},
              {Min: 10000, Max: 100000, Color: 'rgba(255, 152, 0, 0.85)'},
              {Min: 100000, Max: 'Col-Max', Color: 'rgba(40, 167, 69, 0.85)'},
            ],
            BackColor: 'rgba(255, 255, 255, 0.08)',
          },
        },
        {
          ColumnId: 'closed_pr_count',
          Name: 'Closed PRs single colour merged',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellRanges: [
              {Min: 'Col-Min', Max: 'Col-Max', Color: '#22d3ee'},
            ],
            CellTextProperties: {
              CellTextLayout: {
                CellValue: {Horizontal: 'Center', Vertical: 'Merged'},
              },
            },
          },
        },
        {
          ColumnId: 'week_issue_change',
          Name: 'Issue Change diverging bar',
          PercentBarStyle: {
            Origin: 'Auto',
            RangeValueType: 'Number',
            CellRanges: [
              {Min: 'Col-Min', Max: 0, Color: 'rgba(244, 63, 94, 0.65)'},
              {Min: 0, Max: 'Col-Max', Color: 'rgba(34, 197, 94, 0.65)'},
            ],
            BackColor: 'rgba(255, 255, 255, 0.06)',
            CellTextProperties: {
              CellTextLayout: {
                CellValue: {Horizontal: 'Center', Vertical: 'Merged'},
              },
            },
          },
        },
      ],
    },
  },
};
```

## Ranges

The bar colour is driven by a **Cell Range** (one colour per range).

A `CellRange` is used to define a set of cells, and contains 3 properties:

- a minimum value
- a maximum value
- an associated colour

When the cell value falls inside the range, the bar displays the appropriate colour.

This is useful when wanting a traffic light effect - e.g. 0-30: Red; 31-70: Orange; 71-100: Green

There are 3 types of Ranges which can be provided in a Percent Bar:

- _Numeric_ - Range contains all Column cells which fall between the top and bottom values
- _Percentage_ - Range contains all Column cells whose value falls in that percentage of all values
- _Column Comparison_ - a single colour comparing against another column

- There is no limit on how many ranges can be created
- But all Ranges must be of the same type (numeric or percentage) - you cannot mix and match

### Numeric Range

In a Numeric Range the top and bottom values are numeric values which can be provided in 2 ways:

- _Hardcoded Values_ - the user provides the actual numeric values for the range

- _Dynamic Values_ - the user selects `Col-Min` or `Col-Max`; AdapTable will then automatically evaluate the Column's Minimum or Maximum values and use those

- `Col-Min` or `Col-Max` values are re-evaluated in real time in response to data changes
- For instance, if a cell ticks and now becomes the Column's highest value, all the cells will re-render
- Dynamic endpoints are computed across the column's **visible** rows (so they respect Filters)

The Styled Column Wizard only permits the automatic Min in the first Range and automatic Max in the last Range

The state shape additionally allows `Col-Avg` and `Col-Median` as `DynamicRangeEndpoint` values.

- For example you can pin a band to "everything above the column average"
- These can only be set via Initial State or the API — the wizard exposes `Col-Min` / `Col-Max` only

**Example: Percent Bar: Numeric Ranges**

Percent Bars using Numeric Ranges

- Two columns each use a **Number Range** only (`RangeValueType: 'Number'`):
  - **GitHub Stars** — three bands with hard-coded thresholds (red / orange / green)
  - **Closed PRs** — one band from `Col-Min` to `Col-Max` (purple)

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Percent Bar Numeric Ranges',
  initialState: {
    Dashboard: {
      ModuleButtons: ['StyledColumn'],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'github_stars',
            'language',
            'closed_pr_count',
            'has_pages',
            'open_issues_count',
            'closed_issues_count',
            'week_issue_change',
            'has_projects',
            'updated_at',
            'pushed_at',
          ],
          AutoSizeColumns: true,
        },
      ],
    },
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'github_stars',
          Name: 'github_stars Percent Bar',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellRanges: [
              {
                Min: 0,
                Max: 10000,
                Color: 'red',
              },
              {
                Min: 10000,
                Max: 100000,
                Color: 'orange',
              },
              {
                Min: 100000,
                Max: 'Col-Max',
                Color: 'green',
              },
            ],
          },
        },

        {
          ColumnId: 'closed_pr_count',
          Name: 'closed_pr_count Percent Bar',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellRanges: [
              {
                Min: 'Col-Min',
                Max: 'Col-Max',
                Color: 'purple',
              },
            ],
          },
        },
      ],
    },
  },
};
```

### Percentage Range

A Percentage Range has the same shape as a Numeric Range, but each band's `Min` and `Max` are expressed as percentages (`0`–`100`) along the column's overall value span.

For example, you can create 2 Ranges to render:

- the top 50% of cell values in the column in one colour
- the bottom 50% of cell values in another

- The percentage is calculated from each **cell value** relative to the column's value range (`Col-Min` → `Col-Max`)
- It is **not** calculated using the number of cells in the column - that is not part of the evaluation

**Example: Percent Bar: Percentage Ranges**

Percent Bars using Percentage Ranges

- Three columns each use a **Percentage Range** only (`RangeValueType: 'Percentage'`):
  - **GitHub Stars** — three bands: `0`–`33`, `33`–`66`, `66`–`100` (red / orange / green); sorted descending — most rows sit in the lowest band, so many bars look red (this is value-based, not row count)
  - **Closed PRs** — two bands: `0`–`20` and `20`–`100` (brown / blue)
  - **GitHub Watchers** — two bands: `0`–`50` and `50`–`100` (teal / green)

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Percent Bar Percentage Ranges',
  initialState: {
    Dashboard: {
      ModuleButtons: ['StyledColumn'],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'github_stars',
            'closed_pr_count',
            'github_watchers',
            'language',
            'open_issues_count',
            'closed_issues_count',
            'week_issue_change',
            'has_projects',
            'has_pages',
            'updated_at',
            'pushed_at',
          ],
          ColumnSorts: [
            {
              ColumnId: 'github_stars',
              SortOrder: 'Desc',
            },
          ],
          AutoSizeColumns: true,
        },
      ],
    },
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'github_stars',
          Name: 'GitHub Stars three bands',
          PercentBarStyle: {
            RangeValueType: 'Percentage',
            CellRanges: [
              {
                Min: 0,
                Max: 33,
                Color: 'IndianRed',
              },
              {
                Min: 33,
                Max: 66,
                Color: 'DarkOrange',
              },
              {
                Min: 66,
                Max: 100,
                Color: 'ForestGreen',
              },
            ],
          },
        },
        {
          ColumnId: 'closed_pr_count',
          Name: 'Closed PRs bottom 20%',
          PercentBarStyle: {
            RangeValueType: 'Percentage',
            CellRanges: [
              {
                Min: 0,
                Max: 20,
                Color: 'SaddleBrown',
              },
              {
                Min: 20,
                Max: 100,
                Color: 'SteelBlue',
              },
            ],
          },
        },
        {
          ColumnId: 'github_watchers',
          Name: 'GitHub Watchers two bands',
          PercentBarStyle: {
            RangeValueType: 'Percentage',
            CellRanges: [
              {
                Min: 0,
                Max: 50,
                Color: 'CadetBlue',
              },
              {
                Min: 50,
                Max: 100,
                Color: 'MediumSeaGreen',
              },
            ],
          },
        },
      ],
    },
  },
};
```

### Column Comparison

Alternatively, the Percent Bar Style can render by comparing each Cell Value against another column in the row.
**Example: Percent Bar: Column Comparisons**

Percent Bars Using Column Comparisons

- **Open Issues** uses **Column Comparison** against **Closed Issues** (bar width = open issues as a share of closed on that row)
- Cell text shows the value and percentage, merged on the bar
- Row data for the first few rows is adjusted so you can see under-fill, over-fill, and match cases side by side

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Percent Bar Column Comparison',
  initialState: {
    Dashboard: {
      ModuleButtons: ['StyledColumn'],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'github_stars',
            'language',
            'closed_pr_count',
            'has_pages',
            'closed_issues_count',
            'open_issues_count',
            'week_issue_change',
            'has_projects',
            'updated_at',
            'pushed_at',
          ],
          AutoSizeColumns: true,
        },
      ],
    },
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'open_issues_count',
          Name: 'open_issues_count Percent Bar',
          PercentBarStyle: {
            ColumnComparison: {
              MinValue: 0,
              MaxValue: 'closed_issues_count',
              Color: 'Brown',
            },
            CellTextProperties: {
              CellTextLayout: {
                CellValue: { Horizontal: 'Left', Vertical: 'Merged' },
                PercentValue: { Horizontal: 'Left', Vertical: 'Merged' },
              },
            },
          },
        },
      ],
    },
  },
};
```
**`src/rowData.ts`**

```ts
export interface WebFramework {
  id: number;
  name: string;
  full_name?: string;
  html_url?: string;
  description: string;
  created_at: string;
  updated_at: string;
  pushed_at: string;
  homepage?: string;
  github_stars: number;
  language: string;
  forks_count?: number;
  open_issues_count: number;
  license: string;
  topics?: string[];
  github_watchers: number;
  has_projects: boolean;
  has_wiki: boolean;
  has_pages: boolean;
  closed_issues_count: number;
  open_pr_count: number;
  closed_pr_count: number;
  week_issue_change: number;
}

export const rowData: WebFramework[] = [
  {
    id: 10270250,
    name: 'react',
    full_name: 'facebook/react',
    html_url: 'https://github.com/facebook/react',
    description:
      'A declarative, efficient, and flexible JavaScript library for building user interfaces.',
    created_at: new Date('2013-05-24T16:15:54').toDateString(),
    updated_at: new Date('2021-12-20T09:03:49').toDateString(),
    pushed_at: new Date('2021-12-19T14:34:59').toDateString(),
    homepage: 'https://reactjs.org',
    github_stars: 179429,
    language: 'JavaScript',
    forks_count: 36403,
    open_issues_count: 500,
    license: 'MIT License',
    topics: ['declarative', 'frontend', 'javascript', 'library', 'react', 'ui'],
    github_watchers: 6671,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 1000,
    open_pr_count: 249,
    closed_pr_count: 11408,
    week_issue_change: 5,
  },
  {
    id: 24195339,
    name: 'angular',
    full_name: 'angular/angular',
    html_url: 'https://github.com/angular/angular',
    description: 'The modern web developer’s platform',
    created_at: new Date('2014-09-18T16:12:01').toDateString(),
    updated_at: new Date('2021-12-20T08:37:07').toDateString(),
    pushed_at: new Date('2021-12-19T21:54:01').toDateString(),
    homepage: 'https://angular.io',
    github_stars: 78348,
    language: 'TypeScript',
    forks_count: 1000,
    open_issues_count: 750,
    license: 'MIT License',
    topics: [
      'angular',
      'javascript',
      'pwa',
      'typescript',
      'web',
      'web-framework',
      'web-performance',
    ],
    github_watchers: 3119,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 1000,
    open_pr_count: 159,
    closed_pr_count: 20052,
    week_issue_change: 12,
  },
  {
    id: 11730342,
    name: 'vue',
    full_name: 'vuejs/vue',
    html_url: 'https://github.com/vuejs/vue',
    description:
      '🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.',
    created_at: new Date('2013-07-29T03:24:51').toDateString(),
    updated_at: new Date('2021-12-20T08:47:06').toDateString(),
    pushed_at: new Date('2021-12-20T08:10:16').toDateString(),
    homepage: 'http://vuejs.org',
    github_stars: 191435,
    language: 'JavaScript',
    forks_count: 30945,
    open_issues_count: 10001,
    license: 'MIT License',
    topics: ['framework', 'frontend', 'javascript', 'vue'],
    github_watchers: 6187,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 1000,
    open_pr_count: 224,
    closed_pr_count: 1878,
    week_issue_change: -9,
  },
  {
    id: 74293321,
    name: 'svelte',
    full_name: 'sveltejs/svelte',
    html_url: 'https://github.com/sveltejs/svelte',
    description: 'Cybernetically enhanced web apps',
    created_at: new Date('2016-11-20T18:13:05').toDateString(),
    updated_at: new Date('2021-12-20T08:56:37').toDateString(),
    pushed_at: new Date('2021-12-19T14:53:30').toDateString(),
    homepage: 'https://svelte.dev',
    github_stars: 53935,
    language: 'TypeScript',
    forks_count: 2584,
    open_issues_count: 500,
    license: 'MIT License',
    topics: ['compiler', 'template', 'ui'],
    github_watchers: 874,
    has_projects: true,
    has_wiki: true,
    has_pages: false, 
    closed_issues_count: -1000,
    open_pr_count: 104,
    closed_pr_count: 2738,
    week_issue_change: 14,
  },
  {
    id: 224663696,
    name: 'alpine',
    full_name: 'alpinejs/alpine',
    html_url: 'https://github.com/alpinejs/alpine',
    description:
      'A rugged, minimal framework for composing JavaScript behavior in your markup. ',
    created_at: new Date('2019-11-28T13:51:55').toDateString(),
    updated_at: new Date('2021-12-20T08:12:43').toDateString(),
    pushed_at: new Date('2021-12-14T16:02:26').toDateString(),
    homepage: 'https://alpinejs.dev',
    github_stars: 19338,
    language: 'HTML',
    forks_count: 837,
    open_issues_count: -500,
    license: 'MIT License',
    topics: [],
    github_watchers: 202,
    has_projects: false,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 1000,
    open_pr_count: 13,
    closed_pr_count: 546,
    week_issue_change: 21,
  },
  {
    id: 95797174,
    name: 'lit',
    full_name: 'lit/lit',
    html_url: 'https://github.com/lit/lit',
    description:
      'Lit is a simple library for building fast, lightweight web components.',
    created_at: new Date('2017-06-29T16:27:16').toDateString(),
    updated_at: new Date('2021-12-20T07:20:35').toDateString(),
    pushed_at: new Date('2021-12-17T03:45:26').toDateString(),
    homepage: 'https://lit.dev',
    github_stars: 9752,
    language: 'JavaScript',
    forks_count: 528,
    open_issues_count: 0,
    license: 'BSD 3-Clause',
    topics: ['html-templates', 'lit', 'lit-element', 'lit-html'],
    github_watchers: 204,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 1000,
    open_pr_count: 53,
    closed_pr_count: 1138,
    week_issue_change: -45,
  },
  {
    id: 76694515,
    name: 'stimulus',
    full_name: 'hotwired/stimulus',
    html_url: 'https://github.com/hotwired/stimulus',
    description: 'A modest JavaScript framework for the HTML you already have',
    created_at: new Date('2016-12-17T00:19:29').toDateString(),
    updated_at: new Date('2021-12-20T07:20:01').toDateString(),
    pushed_at: new Date('2021-12-17T20:47:34').toDateString(),
    homepage: 'https://stimulus.hotwired.dev/',
    github_stars: 11049,
    language: 'TypeScript',
    forks_count: 316,
    open_issues_count: -500,
    license: 'MIT License',
    topics: [],
    github_watchers: 221,
    has_projects: false,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: -1000,
    open_pr_count: 5,
    closed_pr_count: 191,
    week_issue_change: -11,
  },
  {
    id: 1801829,
    name: 'ember.js',
    full_name: 'emberjs/ember.js',
    html_url: 'https://github.com/emberjs/ember.js',
    description:
      'Ember.js - A JavaScript framework for creating ambitious web applications',
    created_at: new Date('2011-05-25T23:39:40').toDateString(),
    updated_at: new Date('2021-12-19T07:57:31').toDateString(),
    pushed_at: new Date('2021-12-20T07:15:54').toDateString(),
    homepage: 'https://emberjs.com',
    github_stars: 22093,
    language: 'JavaScript',
    forks_count: 4253,
    open_issues_count: 427,
    license: 'MIT License',
    topics: ['ember', 'hacktoberfest', 'javascript', 'javascript-framework'],
    github_watchers: 908,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 6187,
    open_pr_count: 94,
    closed_pr_count: 9574,
    week_issue_change: -22,
  },
  {
    id: 82095231,
    name: 'stencil',
    full_name: 'ionic-team/stencil',
    html_url: 'https://github.com/ionic-team/stencil',
    description:
      'A toolchain for building scalable, enterprise-ready component systems on top of TypeScript.',
    created_at: new Date('2017-02-15T18:57:07').toDateString(),
    updated_at: new Date('2021-12-20T05:46:50').toDateString(),
    pushed_at: new Date('2021-12-16T21:15:17').toDateString(),
    homepage: 'https://stenciljs.com',
    github_stars: 9884,
    language: 'TypeScript',
    forks_count: 641,
    open_issues_count: 499,
    license: 'Other',
    topics: [
      'custom-elements',
      'ionic',
      'progressive-web-app',
      'pwa',
      'ssg',
      'ssr',
      'static-site-generator',
      'stencil',
      'stenciljs',
      'typescript',
      'webcomponents',
    ],
    github_watchers: 203,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 1929,
    open_pr_count: 46,
    closed_pr_count: 743,
    week_issue_change: 12,
  },
  {
    id: 130884470,
    name: 'solid',
    full_name: 'solidjs/solid',
    html_url: 'https://github.com/solidjs/solid',
    description:
      'A declarative, efficient, and flexible JavaScript library for building user interfaces.',
    created_at: new Date('2018-04-24T16:36:27').toDateString(),
    updated_at: new Date('2021-12-20T08:29:47').toDateString(),
    pushed_at: new Date('2021-12-19T21:06:01').toDateString(),
    homepage: 'https://solidjs.com',
    github_stars: 13119,
    language: 'TypeScript',
    forks_count: 330,
    open_issues_count: 21,
    license: 'MIT License',
    topics: [
      'declarative',
      'fine-grained',
      'javascript',
      'jsx',
      'performance',
      'proxies',
      'reactive',
      'solid',
    ],
    github_watchers: 161,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 366,
    open_pr_count: 3,
    closed_pr_count: 164,
    week_issue_change: 23,
  },
  {
    id: 17814354,
    name: 'mithril.js',
    full_name: 'MithrilJS/mithril.js',
    html_url: 'https://github.com/MithrilJS/mithril.js',
    description: 'A JavaScript Framework for Building Brilliant Applications',
    created_at: new Date('2014-03-17T01:59:39').toDateString(),
    updated_at: new Date('2021-12-20T03:17:55').toDateString(),
    pushed_at: new Date('2021-11-24T10:16:47').toDateString(),
    homepage: 'https://mithril.js.org',
    github_stars: 13064,
    language: 'JavaScript',
    forks_count: 940,
    open_issues_count: 173,
    license: 'MIT License',
    topics: [
      'framework',
      'javascript',
      'mithril',
      'router',
      'vdom',
      'virtual-dom',
      'xhr',
    ],
    github_watchers: 324,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 1368,
    open_pr_count: 28,
    closed_pr_count: 1144,
    week_issue_change: 57,
  },
  {
    id: 167174,
    name: 'jquery',
    full_name: 'jquery/jquery',
    html_url: 'https://github.com/jquery/jquery',
    description: 'jQuery JavaScript Library',
    created_at: new Date('2009-04-03T15:20:14').toDateString(),
    updated_at: new Date('2021-12-20T06:13:48').toDateString(),
    pushed_at: new Date('2021-12-17T16:50:04').toDateString(),
    homepage: 'https://jquery.com',
    github_stars: 55666,
    language: 'JavaScript',
    forks_count: 20187,
    open_issues_count: 84,
    license: 'MIT License',
    topics: ['jquery'],
    github_watchers: 3306,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 2083,
    open_pr_count: 13,
    closed_pr_count: 2692,
    week_issue_change: 15,
  },
  {
    id: 5532320,
    name: 'polymer',
    full_name: 'Polymer/polymer',
    html_url: 'https://github.com/Polymer/polymer',
    description: 'Our original Web Component library.',
    created_at: new Date('2012-08-23T20:56:30').toDateString(),
    updated_at: new Date('2021-12-19T05:05:03').toDateString(),
    pushed_at: new Date('2021-12-07T22:20:44').toDateString(),
    homepage: 'https://polymer-library.polymer-project.org/',
    github_stars: 21724,
    language: 'HTML',
    forks_count: 2026,
    open_issues_count: 281,
    license: 'Other',
    topics: ['polymer', 'web-components'],
    github_watchers: 894,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 3648,
    open_pr_count: 26,
    closed_pr_count: 1404,
    week_issue_change: 9,
  },
  {
    id: 952189,
    name: 'backbone',
    full_name: 'jashkenas/backbone',
    html_url: 'https://github.com/jashkenas/backbone',
    description:
      'Give your JS App some Backbone with Models, Views, Collections, and Events',
    created_at: new Date('2010-09-30T19:41:28').toDateString(),
    updated_at: new Date('2021-12-19T05:50:57').toDateString(),
    pushed_at: new Date('2020-05-19T16:52:55').toDateString(),
    homepage: 'http://backbonejs.org',
    github_stars: 27840,
    language: 'JavaScript',
    forks_count: 5608,
    open_issues_count: 85,
    license: 'MIT License',
    topics: [],
    github_watchers: 1365,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 2335,
    open_pr_count: 32,
    closed_pr_count: 1797,
    week_issue_change: -14,
  },
  {
    id: 757363,
    name: 'knockout',
    full_name: 'knockout/knockout',
    html_url: 'https://github.com/knockout/knockout',
    description:
      'Knockout makes it easier to create rich, responsive UIs with JavaScript',
    created_at: new Date('2010-07-05T08:08:34').toDateString(),
    updated_at: new Date('2021-12-18T17:20:52').toDateString(),
    pushed_at: new Date('2021-10-09T07:42:49').toDateString(),
    homepage: 'http://knockoutjs.com/',
    github_stars: 10122,
    language: 'JavaScript',
    forks_count: 1571,
    open_issues_count: 362,
    license: 'Other',
    topics: ['data-binding', 'javascript', 'knockout', 'mvvm'],
    github_watchers: 549,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 1534,
    open_pr_count: 72,
    closed_pr_count: 670,
    week_issue_change: 63,
  },
  {
    id: 191051391,
    name: 'redwood',
    full_name: 'redwoodjs/redwood',
    html_url: 'https://github.com/redwoodjs/redwood',
    description: 'The App Framework for Startups',
    created_at: new Date('2019-06-09T20:17:57').toDateString(),
    updated_at: new Date('2021-12-20T01:41:55').toDateString(),
    pushed_at: new Date('2021-12-20T00:37:09').toDateString(),
    homepage: 'https://redwoodjs.com',
    github_stars: 10334,
    language: 'TypeScript',
    forks_count: 431,
    open_issues_count: 269,
    license: 'MIT License',
    topics: [
      'apollo',
      'graphql',
      'hacktoberfest',
      'jamstack',
      'prisma',
      'react',
    ],
    github_watchers: 80,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 1071,
    open_pr_count: 35,
    closed_pr_count: 2602,
    week_issue_change: 14,
  },
  {
    id: 36040894,
    name: 'gatsby',
    full_name: 'gatsbyjs/gatsby',
    html_url: 'https://github.com/gatsbyjs/gatsby',
    description: 'Build blazing fast, modern apps and websites with React',
    created_at: new Date('2015-05-21T22:43:05').toDateString(),
    updated_at: new Date('2021-12-20T09:04:22').toDateString(),
    pushed_at: new Date('2021-12-20T08:04:34').toDateString(),
    homepage: 'https://www.gatsbyjs.com',
    github_stars: 51931,
    language: 'JavaScript',
    forks_count: 10049,
    open_issues_count: 359,
    license: 'MIT License',
    topics: [
      'blog',
      'compiler',
      'documentation-tool',
      'gatsby',
      'graphql',
      'react',
      'static-site-generator',
      'web-app',
    ],
    github_watchers: 853,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 12975,
    open_pr_count: 180,
    closed_pr_count: 19058,
    week_issue_change: -34,
  },
  {
    id: 26316966,
    name: 'cyclejs',
    full_name: 'cyclejs/cyclejs',
    html_url: 'https://github.com/cyclejs/cyclejs',
    description:
      'A functional and reactive JavaScript framework for predictable code',
    created_at: new Date('2014-11-07T11:28:45').toDateString(),
    updated_at: new Date('2021-12-20T06:39:49').toDateString(),
    pushed_at: new Date('2021-12-17T11:03:37').toDateString(),
    homepage: 'http://cycle.js.org',
    github_stars: 9999,
    language: 'TypeScript',
    forks_count: 421,
    open_issues_count: 102,
    license: 'MIT License',
    topics: [
      'cyclejs',
      'framework',
      'functional-programming',
      'hacktoberfest',
      'javascript',
      'reactive-programming',
      'rxjs',
      'typescript',
    ],
    github_watchers: 205,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 563,
    open_pr_count: 26,
    closed_pr_count: 301,
    week_issue_change: -2,
  },
  {
    id: 42283287,
    name: 'preact',
    full_name: 'preactjs/preact',
    html_url: 'https://github.com/preactjs/preact',
    description:
      '⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.',
    created_at: new Date('2015-09-11T02:40:18').toDateString(),
    updated_at: new Date('2021-12-20T09:02:15').toDateString(),
    pushed_at: new Date('2021-12-17T23:21:58').toDateString(),
    homepage: 'https://preactjs.com',
    github_stars: 30538,
    language: 'JavaScript',
    forks_count: 1702,
    open_issues_count: 222,
    license: 'MIT License',
    topics: [
      'components',
      'dom',
      'jsx',
      'preact',
      'react',
      'vdom',
      'virtual-dom',
    ],
    github_watchers: 425,
    has_projects: true,
    has_wiki: true,
    has_pages: true,
    closed_issues_count: 1309,
    open_pr_count: 78,
    closed_pr_count: 1729,
    week_issue_change: -12,
  },
  {
    id: 13142126,
    name: 'riot',
    full_name: 'riot/riot',
    html_url: 'https://github.com/riot/riot',
    description: 'Simple and elegant component-based UI library',
    created_at: new Date('2013-09-27T05:21:01').toDateString(),
    updated_at: new Date('2021-12-20T05:17:31').toDateString(),
    pushed_at: new Date('2021-12-17T20:09:25').toDateString(),
    homepage: 'https://riot.js.org',
    github_stars: 14597,
    language: 'JavaScript',
    forks_count: 1032,
    open_issues_count: 5,
    license: 'Other',
    topics: [
      'client-side',
      'customelement',
      'customelements',
      'customtags',
      'elegant',
      'framework',
      'javascript',
      'lite',
      'minimal',
      'simple',
      'view',
      'webcomponents',
    ],
    github_watchers: 412,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 2147,
    open_pr_count: 0,
    closed_pr_count: 755,
    week_issue_change: 0,
  },
  {
    id: 121594173,
    name: 'aurelia',
    full_name: 'aurelia/aurelia',
    html_url: 'https://github.com/aurelia/aurelia',
    description:
      'Aurelia 2, a standards-based, front-end framework designed for high-performing, ambitious applications.',
    created_at: new Date('2018-02-15T05:22:58').toDateString(),
    updated_at: new Date('2021-12-19T04:23:43').toDateString(),
    pushed_at: new Date('2021-11-28T16:21:43').toDateString(),
    homepage: '',
    github_stars: 1142,
    language: 'TypeScript',
    forks_count: 121,
    open_issues_count: 143,
    license: 'MIT License',
    topics: [
      'aurelia',
      'cordova',
      'cross-platform',
      'electron',
      'framework',
      'frontend',
      'html',
      'javascript',
      'javascript-framework',
      'mobile',
      'pwa',
      'single-page-applications',
      'spa',
      'typescript',
      'web',
      'web-framework',
      'web-performance',
    ],
    github_watchers: 66,
    has_projects: true,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 214,
    open_pr_count: 17,
    closed_pr_count: 959,
    week_issue_change: 32,
  },
  {
    id: 70107786,
    name: 'next.js',
    full_name: 'vercel/next.js',
    html_url: 'https://github.com/vercel/next.js',
    description: 'The React Framework',
    created_at: new Date('2016-10-05T23:32:51').toDateString(),
    updated_at: new Date('2021-12-20T08:57:47').toDateString(),
    pushed_at: new Date('2021-12-20T08:21:58').toDateString(),
    homepage: 'https://nextjs.org',
    github_stars: 78446,
    language: 'JavaScript',
    forks_count: 15787,
    open_issues_count: 1361,
    license: 'MIT License',
    topics: [
      'blog',
      'browser',
      'compiler',
      'components',
      'hybrid',
      'nextjs',
      'node',
      'react',
      'server-rendering',
      'ssg',
      'static',
      'static-site-generator',
      'universal',
      'vercel',
    ],
    github_watchers: 1224,
    has_projects: false,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 10320,
    open_pr_count: 254,
    closed_pr_count: 9849,
    week_issue_change: 63,
  },
  {
    id: 71995937,
    name: 'nuxt.js',
    full_name: 'nuxt/nuxt.js',
    html_url: 'https://github.com/nuxt/nuxt.js',
    description: 'The Intuitive Vue(2) Framework',
    created_at: new Date('2016-10-26T11:18:47').toDateString(),
    updated_at: new Date('2021-12-20T08:27:45').toDateString(),
    pushed_at: new Date('2021-12-20T08:05:15').toDateString(),
    homepage: 'https://nuxtjs.org',
    github_stars: 38997,
    language: 'JavaScript',
    forks_count: 3157,
    open_issues_count: 464,
    license: 'Other',
    topics: [
      'framework',
      'isomorphic',
      'nuxt',
      'server-rendering',
      'ssr',
      'universal',
      'vue',
      'vue-router',
      'vuex',
      'web-app',
    ],
    github_watchers: 772,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 6129,
    open_pr_count: 30,
    closed_pr_count: 2869,
    week_issue_change: -18,
  },
  {
    id: 3214406,
    name: 'meteor',
    full_name: 'meteor/meteor',
    html_url: 'https://github.com/meteor/meteor',
    description: 'Meteor, the JavaScript App Platform',
    created_at: new Date('2012-01-19T01:58:17').toDateString(),
    updated_at: new Date('2021-12-20T06:36:27').toDateString(),
    pushed_at: new Date('2021-12-17T18:10:08').toDateString(),
    homepage: 'https://www.meteor.com',
    github_stars: 42742,
    language: 'JavaScript',
    forks_count: 5187,
    open_issues_count: 120,
    license: 'Other',
    topics: [
      'build-system',
      'framework',
      'hacktoberfest',
      'javascript',
      'meteor',
      'mongodb',
      'nodejs',
      'npm',
      'reactive-programming',
      'zero-configuration',
    ],
    github_watchers: 1642,
    has_projects: true,
    has_wiki: true,
    has_pages: false,
    closed_issues_count: 8537,
    open_pr_count: 24,
    closed_pr_count: 2998,
    week_issue_change: 21,
  },
  {
    id: 43695474,
    name: 'quasar',
    full_name: 'quasarframework/quasar',
    html_url: 'https://github.com/quasarframework/quasar',
    description:
      'Quasar Framework - Build high-performance VueJS user interfaces in record time',
    created_at: new Date('2015-10-05T15:45:36').toDateString(),
    updated_at: new Date('2021-12-20T08:26:07').toDateString(),
    pushed_at: new Date('2021-12-19T23:18:50').toDateString(),
    homepage: 'https://quasar.dev',
    github_stars: 20095,
    language: 'JavaScript',
    forks_count: 2543,
    open_issues_count: 367,
    license: 'MIT License',
    topics: [
      'android',
      'browser-extension',
      'electron',
      'ios',
      'javascript',
      'material',
      'material-components',
      'material-design',
      'material-theme',
      'pwa',
      'quasar-framework',
      'server-side-rendering',
      'ssr',
      'vue',
      'vue-component',
      'vue-components',
      'vue2',
      'vuejs',
      'vuejs2',
    ],
    github_watchers: 488,
    has_projects: false,
    has_wiki: false,
    has_pages: false,
    closed_issues_count: 6097,
    open_pr_count: 97,
    closed_pr_count: 3424,
    week_issue_change: 1,
  },
];
```

## Negative Values

By default Percent Bars grow from the left edge of the cell.

For columns whose values can go negative this can sometimes be unhelpful (for example, both `+50` and `-50` end up rendered as a small bar on the left).

Accordingly, AdapTable provides an `Origin` property, which controls **where the bar grows from**.

This property supports 4 available values:

| `Origin`           | How Bar Grows                                                                                                                                                                        |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `'Auto'` (default) | From left edge unless any cell value or `CellRanges` endpoint is negative, in which case it grows from `0` (centred axis: positive values extend right, negative values extend left) |
| `'Zero'`           | Always from `0`, even when all values are positive                                                                                                                                   |
| `'Min'`            | Always from the left edge                                                                                                                                                            |
| a number           | From that fixed origin (e.g. `Origin: 100` for "deviation from baseline of 100")                                                                                                     |

```ts
PercentBarStyle: {
  Origin: 'Auto',
  CellRanges: [
    { Min: -200, Max: 0, Color: 'rgba(220, 53, 69, 0.55)' },
    { Min: 0, Max: 200, Color: 'rgba(40, 167, 69, 0.55)' },
  ],
}
```

For variance columns (e.g. "actual vs forecast", "year-on-year change", "P&L vs flat" etc.), `'Auto'` provides a centred-axis Percent Bar for free.

Combine `Auto` with two `CellRanges` (one for negatives, one for positives) to get a red/green diverging visual

**Example: Percent Bar: Negative Values**

Centred-axis bars for signed values

- **Issue Change** uses `Origin: 'Auto'` (default) with two Number ranges: `Col-Min`…`0` (red) and `0`…`Col-Max` (green)
- Positive values extend **right** from `0`; negative values extend **left** — so `+50` and `-50` are visually distinct
- **Cell Value** is merged on the bar with `Horizontal: 'Center'`, `Vertical: 'Merged'`; tooltips show value and percentage
- Sorted ascending on **Issue Change** to scan the diverging bars easily

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Percent Bar Negative Values',
  initialState: {
    Dashboard: {
      ModuleButtons: ['StyledColumn'],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'week_issue_change',
            'language',
            'open_pr_count',
            'closed_pr_count',
            'github_stars',
            'open_issues_count',
            'closed_issues_count',
            'has_projects',
            'has_pages',
            'updated_at',
            'pushed_at',
          ],
          ColumnSorts: [
            {
              ColumnId: 'week_issue_change',
              SortOrder: 'Asc',
            },
          ],
          AutoSizeColumns: true,
        },
      ],
    },
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'week_issue_change',
          Name: 'Issue Change diverging bar',
          PercentBarStyle: {
            Origin: 'Auto',
            RangeValueType: 'Number',
            CellRanges: [
              {
                Min: 'Col-Min',
                Max: 0,
                Color: 'rgba(220, 53, 69, 0.65)',
              },
              {
                Min: 0,
                Max: 'Col-Max',
                Color: 'rgba(40, 167, 69, 0.65)',
              },
            ],
            BackColor: 'rgba(255, 255, 255, 0.08)',
            CellTextProperties: {
              CellTextLayout: {
                CellValue: { Horizontal: 'Center', Vertical: 'Merged' },
              },
            },
            ToolTipText: ['CellValue', 'PercentageValue'],
          },
        },
      ],
    },
  },
};
```

### Custom Numeric Values

`Origin` can also be set to a **fixed number**.

When this happens, the bar renders as a "deviation from baseline" visual, where cells above the baseline grow right and cells below it grow left.

```ts
PercentBarStyle: {
  Origin: 100,
  CellRanges: [
    { Min: 50, Max: 100, Color: 'rgba(220, 53, 69, 0.55)' },
    { Min: 100, Max: 150, Color: 'rgba(40, 167, 69, 0.55)' },
  ],
}
```

- A custom numeric `Origin` is useful for benchmark or target columns
- Here the concern is the gap **above or below a known reference value** (e.g. a price vs par at `100`)

**Example: Percent Bar: Custom Origin**

Bars growing from a fixed baseline

- **Open PRs** uses `Origin: 100` with two ranges: below `100` (red, bar grows **left**) and above `100` (green, bar grows **right**)
- Sorted ascending on **Open PRs** — compare rows under vs over the baseline of 100 open PRs
- Cell text shows value and percentage **below** the bar

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Percent Bar Custom Origin',
  initialState: {
    Dashboard: {
      ModuleButtons: ['StyledColumn'],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'open_pr_count',
            'language',
            'week_issue_change',
            'github_stars',
            'closed_pr_count',
            'open_issues_count',
            'closed_issues_count',
            'has_projects',
            'has_pages',
            'updated_at',
            'pushed_at',
          ],
          ColumnSorts: [
            {
              ColumnId: 'open_pr_count',
              SortOrder: 'Asc',
            },
          ],
          AutoSizeColumns: true,
        },
      ],
    },
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'open_pr_count',
          Name: 'Open PRs baseline 100',
          PercentBarStyle: {
            Origin: 100,
            RangeValueType: 'Number',
            CellRanges: [
              {
                Min: 'Col-Min',
                Max: 100,
                Color: 'rgba(220, 53, 69, 0.65)',
              },
              {
                Min: 100,
                Max: 'Col-Max',
                Color: 'rgba(40, 167, 69, 0.65)',
              },
            ],
            BackColor: 'rgba(255, 255, 255, 0.08)',
            CellTextProperties: {
              CellTextLayout: {
                CellValue: { Horizontal: 'Left', Vertical: 'Below' },
                PercentValue: { Horizontal: 'Right', Vertical: 'Below' },
              },
            },
          },
        },
      ],
    },
  },
};
```

## Decorating Percent Bars

A few additional properties can be added to a Percent Bar to provide the fully required visual effect.

### Back Colour

A Back Colour can be added to the cell containing the Percent Bar.

This will display in the remainder of the cell which is not rendered with the Percent Bar.

This takes precedence over any BackColour which has been added to the Cell's Style in [Column Formatting](https://www.adaptabletools.com/docs/handbook-column-formatting-adaptable-style/index.md)

### Cell Text

The Percent Bar can be configured to additionally display (either or both of) 2 values:

- the underlying (but formatted) cell value
- the percent value (the cell value as a 0–100% reading along the bar's `[Min, Max]` scale)

The `CellTextProperties` object configures the position for both `CellValue` and `PercentValue`:

| Axis         | Options                                                                  |
| ------------ | ------------------------------------------------------------------------ |
| `Horizontal` | `'Left'` _(default)_, `'Center'` or `'Right'`                            |
| `Vertical`   | `'Above'`, `'Below'` _(default)_ or `'Merged'` (drawn on top of the bar) |

- This provides 9 possibilities for both `CellValue` and `PercentValue` 
- If they are both in the same slot, they are concatenated with single space (Cell Value first, then Percent Value)

- For example, you can put cell value below-left and percentage below-right of the same bar (see demo below)
- Leave `CellTextProperties` unset to render the bar with no overlay text

The cell text inherits any matching [Column Formatting](https://www.adaptabletools.com/docs/handbook-column-formatting-adaptable-style/index.md) font (e.g. colour) unless overridden by the optional [`Font`](#font) slice on the Percent Bar itself.

### Tooltip

The Percent Bar can be provided with a Tooltip which shows the cell value when hovering over it.

The Tooltip can display the actual value in the cell, or its value as a percentage, or both.

### Font

The text overlay on a Percent Bar can be styled independently of the rest of the column via the `Font` property.

`Font` is a `CellFontStyle` slice that accepts the standard text properties:

- `ForeColor` — text colour
- `FontWeight` — `Normal` or `Bold`
- `FontStyle` — `Normal` or `Italic`
- `FontSize` — e.g. `Small`, `Medium`, `Large`
- `FontFamily` — any CSS font family

- `Font` only applies when `CellTextProperties` is set; it has no effect on the bar itself
- When `Font` is set, AdapTable strips any matching [Format Column](https://www.adaptabletools.com/docs/handbook-column-formatting-adaptable-style/index.md) font properties for that column
- Horizontal alignment of the overlay text is driven by `CellTextLayout` (`Horizontal` per token)

**Example: Percent Bar: Cell Properties**

Percent Bars with Back Colour, Cell Text and Tooltip

- Five columns illustrate decoration options (all use Number ranges unless noted):
  - **GitHub Stars** — track **Back Colour** (grey)
  - **Closed PRs** — **Tooltip** with cell value and percentage on hover
  - **Open Issues** — **Cell Value** below-left and **Percent Value** below-right of the bar (two tokens, same `Vertical` slot but different `Horizontal`)
  - **Open PRs** — **Cell Value** merged center on the bar; inherits [Column Formatting Style](https://www.adaptabletools.com/docs/handbook-column-formatting-adaptable-style/index.md) (white)
  - **GitHub Watchers** — **Cell Value** above-left of the bar

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Percent Bar Properties',
  initialState: {
    Dashboard: {
      ModuleButtons: ['StyledColumn'],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'github_stars',
            'language',
            'closed_pr_count',
            'has_pages',
            'open_issues_count',
            'open_pr_count',
            'week_issue_change',
            'github_watchers',
            'has_projects',
            'updated_at',
            'pushed_at',
          ],
          AutoSizeColumns: true,
        },
      ],
    },
    StyledColumn: {
      StyledColumns: [
        {
          ColumnId: 'github_stars',
          Name: 'github_stars Percent Bar',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellRanges: [
              {
                Min: 0,
                Max: 10000,
                Color: 'red',
              },
              {
                Min: 10000,
                Max: 100000,
                Color: 'orange',
              },
              {
                Min: 100000,
                Max: 191435,
                Color: 'green',
              },
            ],
            BackColor: 'var(--ab-color-palette-15)',
          },
        },
        {
          ColumnId: 'open_issues_count',
          Name: 'open_issues_count Percent Bar',
          PercentBarStyle: {
            CellRanges: [
              {
                Min: 5,
                Max: 1889,
                Color: 'purple',
              },
            ],
            CellTextProperties: {
              CellTextLayout: {
                CellValue: { Horizontal: 'Left', Vertical: 'Below' },
                PercentValue: { Horizontal: 'Right', Vertical: 'Below' },
              },
            },
          },
        },
        {
          ColumnId: 'closed_pr_count',
          Name: 'closed_pr_count Percent Bar',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellRanges: [
              {
                Min: 'Col-Min',
                Max: 'Col-Max',
                Color: 'blue',
              },
            ],
            ToolTipText: ['CellValue', 'PercentageValue'],
          },
        },
        {
          ColumnId: 'open_pr_count',
          Name: 'open_pr_count Percent Bar',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellTextProperties: {
              CellTextLayout: {
                CellValue: { Horizontal: 'Center', Vertical: 'Merged' },
              },
            },
            CellRanges: [
              {
                Min: 'Col-Min',
                Max: 'Col-Max',
                Color: 'Brown',
              },
            ],
            BackColor: 'var(--ab-color-palette-16)',
          },
        },
        {
          ColumnId: 'github_watchers',
          Name: 'github_watchers Percent Bar',
          PercentBarStyle: {
            RangeValueType: 'Number',
            CellTextProperties: {
              CellTextLayout: {
                CellValue: { Horizontal: 'Left', Vertical: 'Above' },
              },
            },
            CellRanges: [
              {
                Min: 0,
                Max: 'Col-Max',
                Color: '#dc143c',
              },
            ],
          },
        },
      ],
    },
    FormatColumn: {
      FormatColumns: [
        {
          Name: 'formatColumn-open_pr_count',
          Scope: {
            ColumnIds: ['open_pr_count'],
          },
          Style: {
            ForeColor: 'var(--ab-color-palette-14)',
            Alignment: 'Right',
          },
        },
      ],
    },
  },
};
```

## Defining Percent Bars

Percent Bar Styles can be created at design-time using Styled Column Initial State.

### Providing a Percent Bar Style in Styled Column State

Supply 3 properties:

- `ColumnId` of Styled Column showing Percent Bar
- `Name` of Styled Column - should be descriptive
- A `PercentBarStyle` object

A Number Range (`RangeValueType` of `'Number'`) has 3 properties:

- `Min` — lower end of the band (can be a number or `'Col-Min'`)
- `Max` — upper end of the band (can be a number, `'Col-Max'`)
- `Color` — bar colour for values that fall in that band (a [Colour](https://www.adaptabletools.com/docs/ui-tutorial-providing-adaptable-style/index.md) string)

`Col-Min` and `Col-Max` can only appear at the ends of the range group

A Percent Range (`RangeValueType` of `'Percentage'`) also has 3 properties, but the axis is **0–100%** and each band’s `Min` / `Max` are percentages.

- `Min` — lower end of the band (can be a number, or a percentage)
- `Max` — upper end of the band (can be a number or a percentage)
- `Color` — bar colour for values that fall in that band (a [Colour](https://www.adaptabletools.com/docs/ui-tutorial-providing-adaptable-style/index.md) string)

`Origin` controls where the bar grows from (`'Auto'` default, `'Zero'`, `'Min'`, or a fixed number). Use `'Auto'` or `'Zero'` with negative/positive `CellRanges` for a centred diverging bar; use a numeric origin for a benchmark baseline.

For **column comparison** mode, supply `ColumnComparison` instead of `CellRanges`:

- `MinValue` — lower end of the scale (often `0`)
- `MaxValue` — upper end; usually another column id so the bar compares this cell to that column’s value
- `Color` — bar colour when a cell colour is resolved for the bar

This [colour](https://www.adaptabletools.com/docs/ui-tutorial-providing-adaptable-style/index.md) fills the part of the cell **not** covered by the coloured bar (track / background).

You can control what appears in the cell and tooltip:

- **`CellTextProperties.CellTextLayout`** — per-token placement of the bar overlay. Set `CellValue` and/or `PercentValue`, each as a `{ Horizontal, Vertical }` object:
  - `Horizontal`: `'Left'` _(default)_, `'Center'` or `'Right'`
  - `Vertical`: `'Above'`, `'Below'` _(default)_, or `'Merged'` (drawn over the bar)
- **`ToolTipText`** — lists the tokens to show on hover (`'CellValue'`, `'PercentageValue'`, both, or neither — see [`CellTextOptions`](https://www.adaptabletools.com/docs/reference/celltextoptions.md))

A token only renders when its key is present in `CellTextLayout`; omit either to hide it. When both land on the same slot they concatenate with a single space (Cell Value first, then Percent Value).

**`Font`** (optional) is a text-style slice (`CellFontStyle`: e.g. `ForeColor`, `FontWeight`, `FontSize`) applied to the `CellTextProperties` overlay; see [Adaptable Style Object](https://www.adaptabletools.com/docs/ui-tutorial-providing-adaptable-style/index.md).

Horizontal alignment of the overlay text is controlled by `CellTextLayout` (per-token `Horizontal`); `Font.Alignment` is not consulted for the overlay.

```js [[1, 5, "ColumnId"],[1, 6, "Name"],[1, 7, "PercentBarStyle"],[2, 8,"RangeValueType: 'Number'"],[3, 51,"RangeValueType: 'Percentage'"],[2, 9, "CellRanges"],[3, 52, "CellRanges"],[4, 40, "ColumnComparison"],[5, 26, "BackColor"],[6, 27, "CellTextProperties"],[6, 33, "ToolTipText"],[6, 58, "CellTextProperties"],[7, 64, "Font"]]
const initialState: InitialState = {
  StyledColumn: {
    StyledColumns: [
      {
        ColumnId: 'github_stars',
        Name: 'Github Stars Bar',
        PercentBarStyle: {
          RangeValueType: 'Number',
          CellRanges: [
            {
              Min: 'Col-Min',
              Max: 10000,
              Color: 'red',
            },
            {
              Min: 10000,
              Max: 100000,
              Color: 'orange',
            },
            {
              Min: 100000,
              Max: 'Col-Max',
              Color: 'green',
            },
          ],
          BackColor: 'var(--ab-color-palette-15)',
          CellTextProperties: {
            CellTextLayout: {
              CellValue: { Horizontal: 'Left', Vertical: 'Merged' },
              PercentValue: { Horizontal: 'Right', Vertical: 'Merged' },
            },
          },
          ToolTipText: ['CellValue', 'PercentageValue'],
        },
      },
      {
        ColumnId: 'open_issues_count',
        Name: 'Open Issues Bar',
        PercentBarStyle: {
          ColumnComparison: {
            MinValue: 0,
            MaxValue: 'closed_issues_count',
            Color: 'Brown',
          },
        },
      },
      {
        ColumnId: 'market_share',
        Name: 'Market Share Bar',
        PercentBarStyle: {
          RangeValueType: 'Percentage',
          CellRanges: [
            { Min: 0, Max: 33, Color: '#aed581' },
            { Min: 33, Max: 66, Color: '#7cb342' },
            { Min: 66, Max: 100, Color: '#33691e' },
          ],
          BackColor: '#eceff1',
          CellTextProperties: {
            CellTextLayout: {
              PercentValue: { Horizontal: 'Center', Vertical: 'Above' },
            },
          },
          ToolTipText: ['CellValue'],
          Font: {
            ForeColor: '#0d47a1',
            FontWeight: 'Bold',
            FontSize: 'Small',
          },
        },
      },
    ],
  },
};
```

## Creating Percent Bars

Percent Bar Styles can be created at run-time using the Styled Column UI Wizard.

### Creating a Percent Bar Style using the Styled Column Wizard

The Wizard guides you through the following steps:

In the **Settings** step:

- Enter a **Name** for the Styled Column (must be unique within the Grid)
- Pick **Percent Bar** from the list of Styled Column Types

The **Scope** step is shared by every Styled Column. Use it to:

- Pick the **Column** to apply the Percent Bar to — only **numeric** columns (without an existing Styled Column) are listed.
- Choose which **row kinds** the Percent Bar renders on: `Data`, `Group`, `Summary` and `Total`.

Percent Bar renders on Data rows by default. Toggle the others on if you also want the bar to appear on aggregated cells in Grouped / Summary / Total rows (aggregated values often make no sense as a percentage, so these are off by default).

The **Ranges** step is where the Percent Bar scale is configured. It exposes three mutually-exclusive tabs — switching tab discards anything configured in the previous tab:

- **Number Range** _(default)_ — any number of value-bounded ranges with hard-coded numeric `Min` / `Max` thresholds, each with its own colour. Use this for traffic-light style banding or arbitrary thresholds.
  - Each Range has a `Min`, a `Max` and a `Color` (for which transparency can also be set)
  - `Min` and `Max` can be a hard-coded number or a `DynamicRangeEndpoint` (`Col-Min`, `Col-Max`)
  - Click `Add New Range` to add more

- **Percentage Range** — same shape as **Number Range** but `Min` and `Max` are expressed as `0`–`100` along the column's overall span. The first band always starts at `0`, the last always ends at `100`.

- **Column Comparison** — render each cell relative to **another column** on the same row.
  - Supply a `Min Value` and a `Max Value` — each can be a number or another column id (picked from a dropdown)
  - Supply a single `Color`

- You cannot mix and match Ranges; they need to be all Number or all Percentage based
- `Col-Min` and `Col-Max` can only appear at the very start / end of a Number Range set

There is no limit on the number of Ranges which can be created

The **Style** step configures how the Percent Bar renders. It is divided into three card sections:

- **Bar Position** — sets the bar's `Origin`, i.e. where the bar grows from:
  - `Auto` — anchors to the left edge, but centres at `0` when the scale has negatives
  - `Zero` — centres at `0`; positives extend right, negatives extend left
  - `Min` — always anchored at the column's minimum (left edge)

- **Cell Text** — choose whether and how to display text on the bar (font properties take precedence over Format Column):
  - **Cell Value** and **Percent Value** — each token has its own **Horizontal** (`Left` / `Center` / `Right`) and **Vertical** (`Above` / `Below` / `Merged`) placement so they can be positioned independently
  - **Font** — optional font properties (colour, weight, italic, size, family) applied to the bar text overlay

- **Cell Style** — extra cell-level decoration around the bar:
  - **Tooltip Display** — show the `Cell Value`, the `Percent Value`, both, or neither on hover
  - **Back Colour** — fills the part of the cell not covered by the bar; takes precedence over any background set in [Format Column](https://www.adaptabletools.com/docs/handbook-column-formatting-adaptable-style/index.md)

Two further wizard steps — **Tags** (when the workspace has tags enabled) and **Summary** (a read-only review of every previous step) — are shared by all AdapTable modules and not specific to Percent Bars.

### FAQ

**Can we see the underlying value in a Percent Bar Style cell?**
Yes — set `CellTextProperties.CellTextLayout.CellValue` to a `{ Horizontal, Vertical }` placement (and/or `PercentValue` for the percent reading), either at Design Time or at Run Time.

**Can we right align the cell value in a Percent Bar Style cell?**
Yes — set `Horizontal: 'Right'` on the token's placement (e.g. `CellValue: { Horizontal: 'Right', Vertical: 'Merged' }`). Each token is placed independently, so you can have the cell value right-aligned and the percent value left-aligned within the same bar.

**Can I show negative and positive values in opposite colours?**
Yes — leave `Origin` as `'Auto'` (or set it to `'Zero'`) and supply two `CellRanges`, one with a negative `Min`/`Max` and one with a positive `Min`/`Max`. The bar will then render as a centred-axis diverging visual.

**Can I make the bar grow from a custom baseline rather than 0 or Min?**
Yes — set `Origin` to a number (e.g. `Origin: 100`). Cells above the baseline grow right and cells below it grow left. Useful for benchmark / target columns.

**Can I customise the font of the bar text?**
Yes — set the `Font` slice on the `PercentBarStyle` (`ForeColor`, `FontWeight`, `FontStyle`, `FontSize`, `FontFamily`). It takes precedence over the font on any matching [Format Column](https://www.adaptabletools.com/docs/handbook-column-formatting-adaptable-style/index.md).

**Can I show a Percent Bar on Group / Summary / Total rows?**
Yes — toggle the row kinds you want in the **Scope** step of the wizard (or set `RowScope` in Initial State). Percent Bars render on Data rows only by default because aggregated values rarely make sense as a percentage.

**Can the Min and Max update automatically as data ticks?**
Yes — use `Col-Min` / `Col-Max` (or `Col-Avg` / `Col-Median` via state) as range endpoints. AdapTable re-evaluates these against the column's visible rows in real time and the bars re-render automatically.

**Can I make a Percent Bar semi-transparent?**
Yes — supply an `rgba(...)` colour string for the Range `Color` (e.g. `'rgba(40, 167, 69, 0.55)'`), or use the colour picker's transparency slider in the wizard.

**Can a Percent Bar span multiple columns?**
No — a Percent Bar applies to a single numeric column. For cross-column comparisons use the `ColumnComparison` mode, which compares each cell to another column on the same row.
