Skip to Content
DataCards 2.2.4 is released 🎉

Radial Chart Card

Card type: radialChart

Radial chart card

The radial chart card displays a radial bar chart from tabular data. Radial charts are ideal for showing progress, completion rates, or comparing values in a circular format, such as task completion, or performance metrics.

In addition to the common parameters the radialChart card has the following configuration options:

NameTypeRequiredDefaultDescription
valuelist of dictYes—The data to be plotted. Each dict represents a data point.
fillCardboolNofalseWhen set to True, the chart will fill the entire card space including the header area. When False (default), the chart will be positioned below the header.
label_overridedictNo—Optional: pretty labels for data series.
chart_optionsdictYes—Chart configuration options. See table below.

Chart Options

NameTypeRequiredDefaultDescription
nameKeystrYes—The property in each dict to use for the name of the bars.
dataKeystrYes—The property in each dict to use for the data value of the bars.
fillKeystrNo—The property in each dict to use for the fill color of the bars.
innerRadiusnumber or strNo"30%"Inner radius of the chart (e.g., 30 or “30%”).
outerRadiusnumber or strNo"90%"Outer radius of the chart (e.g., 110 or “110%”).
startAnglenumberNo0Starting angle in degrees. n.b. 0 degrees is pointing to the right i.e. 3’o’clock.
endAnglenumberNo360Ending angle in degrees. n.b. 0 degrees is pointing to the right i.e. 3’o’clock.
defaultColors”monochrome” or “multicolor”No"monochrome"Fallback color scheme if no color is provided in the data.
fontSizestrNo(auto)Font size for labels/tooltips. (if not set, this scales with the card size).
showLegendboolNofalseWhether to show the legend below the chart. Cannot be used with showCentralText.
margindictNo{top: 15, right: 15, bottom: 15, left: 15}Chart margins.
backgroundboolNotrueWhether to show background bars.
cornerRadiusnumberNo0Corner radius of the bars.
showGridboolNofalseWhether to show the polar grid.
gridType”polygon” or “circle”No"circle"Type of grid to display.
showCentralTextboolNofalseWhether to show text in the center of the chart. Cannot be used with showLegend.
centralTextValuestrNo—Text to display in the center. If not provided and showCentralText is true, shows the total sum of all values.
centralTextLabelstrNo—Label to show below the main central text.

Legend vs Central Text

  • Legend vs Central Text: showLegend and showCentralText cannot be used simultaneously. If both are enabled, the legend will be disabled.

Grid Types

  • "circle": Circular grid pattern (default)
  • "polygon": Polygonal grid pattern

Examples

Simple Radial Chart

This example shows a basic radial chart for browser usage statistics.

import polars as pl # Create some data df = pl.DataFrame({ "browser": ["chrome", "safari", "firefox", "edge", "other"], "visitors": [275, 200, 187, 173, 90], }) # Convert to the format expected by the radial chart data = df.to_dicts() # Override labels label_override = { "visitors": {"label": "Visitors"}, "chrome": {"label": "Chrome"}, "safari": {"label": "Safari"}, "firefox": {"label": "Firefox"}, "edge": {"label": "Edge"}, "other": {"label": "Other"}, } datacards.publish.card( type='radialChart', value=data, label="Browser Usage", chart_options={ "nameKey": "browser", "dataKey": "visitors", }, label_override=label_override, logic_view_size=(4,2), )
Simple radial chart example

Radial Chart with Grid

This example shows a radial chart with a circular grid for better visual reference.

import polars as pl # Create some data df = pl.DataFrame({ "browser": ["chrome", "safari", "firefox", "edge", "other"], "visitors": [275, 200, 187, 173, 90], }) # Convert to the format expected by the radial chart data = df.to_dicts() # Override labels label_override = { "visitors": {"label": "Visitors"}, "chrome": {"label": "Chrome"}, "safari": {"label": "Safari"}, "firefox": {"label": "Firefox"}, "edge": {"label": "Edge"}, "other": {"label": "Other"}, } datacards.publish.card( type='radialChart', value=data, label="Browser Usage with Grid", chart_options={ "nameKey": "browser", "background": False, "dataKey": "visitors", "showGrid": True, "gridType": "circle", "innerRadius": "30%", "outerRadius": "100%", }, label_override=label_override, logic_view_size=(4,2), )
Radial chart with grid example

Radial Chart with Custom Colors

This example demonstrates how to specify custom colors for each bar using the fillKey option.

import polars as pl # Create some data df = pl.DataFrame({ "task": ["Design", "Development", "Testing", "Deployment", "Documentation"], "progress": [85, 70, 90, 45, 60], "color": ["#10b981", "#3b82f6", "#f59e0b", "#ef4444", "#8b5cf6"], }) # Convert to the format expected by the radial chart data = df.to_dicts() # Override labels label_override = { "progress": {"label": "Progress (%)"}, "Design": {"label": "Design"}, "Development": {"label": "Development"}, "Testing": {"label": "Testing"}, "Deployment": {"label": "Deployment"}, "Documentation": {"label": "Documentation"}, } datacards.publish.card( type='radialChart', value=data, label="Project Progress", chart_options={ "nameKey": "task", "dataKey": "progress", "fillKey": "color", "innerRadius": "40%", "outerRadius": "80%", "showGrid": True, "gridType": "circle", }, label_override=label_override, logic_view_size=(4,2), )
Radial chart with custom colors example

Radial Chart with Custom Angles

This example shows a radial chart with custom start and end angles, creating a semi-circular chart. N.b. that the start and end angles are relative to the 0 degrees being the right i.e. 3’o’clock.

import polars as pl # Create some data df = pl.DataFrame({ "metric": ["Speed", "Accuracy", "Efficiency", "Quality"], "score": [85, 92, 78, 88], }) # Convert to the format expected by the radial chart data = df.to_dicts() # Override labels label_override = { "score": {"label": "Score"}, "Speed": {"label": "Speed"}, "Accuracy": {"label": "Accuracy"}, "Efficiency": {"label": "Efficiency"}, "Quality": {"label": "Quality"}, } datacards.publish.card( type='radialChart', value=data, label="Performance Metrics", chart_options={ "nameKey": "metric", "dataKey": "score", "startAngle": 180, "endAngle": 0, "innerRadius": "20%", "outerRadius": "100%", "defaultColors": "multicolor", }, label_override=label_override, logic_view_size=(4,2), )
Radial chart with custom angles example

Radial Chart with Central Text - Goal Progress

This example demonstrates a radial chart with central text showing percentage of goal reached.

import polars as pl # Create some data df = pl.DataFrame({ "goal": ["Sales", "Marketing", "Development", "Support"], "achieved": [85, 92, 78, 88], "target": [100, 100, 100, 100], }) # Calculate percentage of goal reached df = df.with_columns([ (pl.col("achieved") / pl.col("target") * 100).alias("percentage") ]) # Convert to the format expected by the radial chart data = df.to_dicts() # Override labels label_override = { "percentage": {"label": "Goal Progress (%)"}, "Sales": {"label": "Sales"}, "Marketing": {"label": "Marketing"}, "Development": {"label": "Development"}, "Support": {"label": "Support"}, } # Calculate overall goal progress overall_progress = round(df["percentage"].mean(), 1) datacards.publish.card( type='radialChart', value=data, label="Goal Progress", chart_options={ "nameKey": "goal", "dataKey": "percentage", "showCentralText": True, "centralTextValue": f"{overall_progress}%", "centralTextLabel": "Overall Goal", "innerRadius": "40%", "outerRadius": "80%", "defaultColors": "multicolor", "showLegend": False, }, label_override=label_override, logic_view_size=(4,2), )
Radial chart with goal progress example
Last updated on