Lattice Grid

blog

Radial Bar Chart for Goal Completion by Team

Building…
Loading a live grid…

If you lead a programme, the question you bring to the review is how far each team has got against its goal. Not a table of percentages to read down one by one, but a single picture where the teams that are close to done and the teams that are not can be told apart at a glance.

A radial bar chart answers that with arcs. Each team gets its own ring, and the ring sweeps round as far as that team’s completion, with the end of the track standing for the goal. The chart above is bound to the grid beneath it, one row per team, so filtering the rows redraws the rings. The example opens on one programme; clear the filter on the Programme column to see all nine teams.

Why a radial bar and not a bar chart

A bar chart compares lengths well, but it leaves the goal implied. Here every ring is measured against the same track, drawn faintly behind it, so a team that has reached the goal fills its track to the end and a team that is halfway fills half of it. How much is left is visible without reading a number.

The chart over a grid

The x option is the team column and y the completion, and max is set to 100 so that a full track means the whole goal rather than the best team. The radial bar is its own small module, so import it after the charts module. Here is the example in plain JavaScript, with sample rows inline in place of your own.

import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { createChart } from '@toclocoinc/lattice-grid/modules/charts';
import '@toclocoinc/lattice-grid/modules/chart-radialbar';

const rows = [
  { id: 1, team: 'Onboarding', programme: 'Growth', completion: 92 },
  { id: 2, team: 'Activation', programme: 'Growth', completion: 78 },
  { id: 3, team: 'Referrals', programme: 'Growth', completion: 64 },
  { id: 4, team: 'Search', programme: 'Product', completion: 88 },
  { id: 5, team: 'Mobile', programme: 'Product', completion: 57 },
  { id: 6, team: 'Accessibility', programme: 'Product', completion: 100 },
  { id: 7, team: 'Billing', programme: 'Operations', completion: 83 },
  { id: 8, team: 'Payments', programme: 'Operations', completion: 52 },
  { id: 9, team: 'Compliance', programme: 'Operations', completion: 100 },
];
const gridEl = document.createElement('div');
const chartEl = document.createElement('div');
gridEl.style.height = '240px';
chartEl.style.height = '400px';
document.body.append(gridEl, chartEl);

const grid = createGrid(gridEl, {
  rowKey: 'id', rows,
  columns: [
    { field: 'team', title: 'Team' },
    { field: 'programme', title: 'Programme', filter: { type: 'set' } },
    { field: 'completion', title: 'Completion %', type: 'number' },
  ],
});
createChart({ grid, container: chartEl, type: 'radialBar', x: 'team', y: 'completion',
  title: 'Goal completion by team (%)',
  max: 100, polar: { sort: 'desc' } });

The same thing in React

The React adapter is a factory, so you build the component once at module scope. The ref’s grid is the real grid, which is what the chart binds to.

import React, { useEffect, useRef } from 'react';
import { createGrid } from '@toclocoinc/lattice-grid';
import '@toclocoinc/lattice-grid/css';
import { createLatticeGrid } from '@toclocoinc/lattice-grid/modules/react';
import { createChart } from '@toclocoinc/lattice-grid/modules/charts';
import '@toclocoinc/lattice-grid/modules/chart-radialbar';

const LatticeGrid = createLatticeGrid({ React, createGrid });
const rows = [
  { id: 1, team: 'Onboarding', programme: 'Growth', completion: 92 },
  { id: 2, team: 'Activation', programme: 'Growth', completion: 78 },
  { id: 3, team: 'Search', programme: 'Product', completion: 88 },
  { id: 4, team: 'Mobile', programme: 'Product', completion: 57 },
  { id: 5, team: 'Billing', programme: 'Operations', completion: 83 },
  { id: 6, team: 'Payments', programme: 'Operations', completion: 52 },
];
const columns = [
  { field: 'team', title: 'Team' },
  { field: 'programme', title: 'Programme', filter: { type: 'set' } },
  { field: 'completion', title: 'Completion %', type: 'number' },
];

export function GoalCompletion() {
  const gridRef = useRef(null);
  const chartRef = useRef(null);
  useEffect(() => {
    const chart = createChart({ grid: gridRef.current.grid, container: chartRef.current,
      type: 'radialBar', x: 'team', y: 'completion', max: 100 });
    return () => chart.destroy();
  }, []);
  return (<>
    <LatticeGrid ref={gridRef} rowKey="id" columns={columns} rows={rows} style={{ height: 240 }} />
    <div ref={chartRef} style={{ height: 400 }} />
  </>);
}

The options used

These are the rows of the charts reference for the options in the listings above.

Option Type What it does
grid Grid Required. The grid to read.
container Element or string Required. Where to draw.
type string 'radialBar' here, one ring per category.
x string The team column, one ring per distinct value.
y string The value column, the share of the track each ring covers.
max number The value that fills a ring. Defaults to the largest value, so set it to read against a goal.
polar object Options for the polar types. sort: 'asc' or 'desc' orders the rings by value, and track: false hides the tracks.
title string Drawn above the plot.

Reading the rings

Look first for the rings that stop short. In the example, opened on the Product programme, Mobile sits at 57, so it is furthest from the goal, while Accessibility is at 100 and has filled its track. Clear the filter and the rings turn over to all nine teams, or pick another programme to see which one is carrying the gap before you decide where to put the effort.

Next

See the radial bar beside the other circular charts in the polar family demo, read the full list of chart types on the charts page, or follow the how-to for a chart that follows the grid.

Read next

  • Polar Area Chart for Incidents by Month

    Bind a polar area chart to a grid of incidents: twelve months around a circle, each wedge grows in area with its count. Filter the rows and it redraws.

  • Word Cloud of Support Ticket Subjects

    Bind a word cloud to a grid of ticket subject words and counts. Filter the rows by queue and the cloud redraws, so the loudest theme shows.

  • Venn Chart for Customers Across Products

    Bind a venn chart to a grid of customers: who uses product A, product B, and both. Filter the rows by region or plan and the circles redraw.

All posts RSS