Back to column formats
Column formattingSharePoint Online

Number Circle in Circle

This sample shows how the percentage value in a column can be displayed as the area of a circle within another circle.

Number Circle in Circle formatting preview
Sample preview · View original image

Copy. Apply. Make it yours.

Get this format

1 definition

Review the requirements below, then paste this JSON into the matching formatting panel. Show me where.

Use your list's internal column names and replace any tenant-specific URLs or flow IDs. Formatting is presentation, not a way to secure data.

Column formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "display": "flex",
    "padding": "4px",
    "align-items": "center"
  },
  "children": [
    {
      "elmType": "div",
      "style": {
        "display": "inline-block",
        "border-radius": "100%",
        "fill": "currentColor",
        "width": "100px",
        "height": "100px"
      },
      "attributes": {
        "class": "ms-bgColor-themeLight ms-fontColor-themePrimary"
      },
      "children": [
        {
          "elmType": "svg",
          "children": [
            {
              "elmType": "path",
              "attributes": {
                "d": "='M 0,50' + 'a '+ pow(50*@currentField,0.5) + ','+pow(50*@currentField,0.5) + ' 0 1,1 ' + 100*pow(@currentField,0.5) +',0' + 'a '+ pow(50*@currentField,0.5) + ','+pow(50*@currentField,0.5) + ' 0 1,1 ' + -100*pow(@currentField,0.5) +',0'"
              }
            }
          ]
        }
      ]
    },
    {
      "elmType": "div",
      "txtContent": "@currentField.displayValue",
      "style": {
        "position": "absolute",
        "z-index": "10",
        "left": "45px",
        "width": "40px",
        "text-align": "center",
        "white-space": "nowrap",
        "border-radius": "0.2em"
      },
      "attributes": {
        "class": "ms-bgColor-white ms-fontColor-themeDarker"
      }
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample shows how the percentage value in a column can be displayed as the area of a circle within another circle.

screenshot of the sample

View requirements

  • This format can be applied to a Number column. It is expected that the values will be from 0 to 1 (percent)

Sample

Solution Author(s)
number-circle-in-circle.json Geert de Kooter

Version history

Version Date Comments
1.0 November 14, 2021 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.


Additional notes

None