Lattice Grid

blog

Funnel Chart for a Sales Pipeline

Building…
Loading a live grid…

If you lead a sales team, the question you carry into every pipeline review is where deals are lost. Out of every thousand leads, how many are qualified, how many get a proposal, and how many are won, and which step loses the most?

A funnel chart answers that. Each stage is a band whose width is its count, stacked from leads at the top to won at the bottom, so the narrowing between bands is the drop. The chart above is bound to the grid beneath it, one row per region and stage, so filtering the rows redraws the funnel. Filter the Region column to one team and see only its pipeline.

Why a funnel and not a bar chart

A bar chart of the same four counts is accurate, but it reads as four separate quantities. A funnel reads as one flow that narrows, and the eye goes straight to the widest loss. It suits stages that happen in order, where each count is a subset of the one before, which is exactly what a pipeline is.

The chart over a grid

The stage column is the band and the count column is its width. Rows for the same stage are summed, so the grid can hold one row per region and the funnel still shows the total for the regions left after filtering. Funnel is built in, so there is no extra module to import. 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';

const stages = ['Lead', 'Qualified', 'Proposal', 'Won'];
const counts = { North: [1200, 640, 310, 120], South: [980, 480, 220, 90], East: [1500, 720, 330, 150] };
const rows = Object.entries(counts).flatMap(([region, list]) =>
  list.map((count, i) => ({ id: `${region}-${stages[i]}`, region, stage: stages[i], count })));

const gridEl = document.createElement('div');
const chartEl = document.createElement('div');
gridEl.style.height = '240px';
chartEl.style.height = '420px';
document.body.append(gridEl, chartEl);

const grid = createGrid(gridEl, {
  rowKey: 'id', rows,
  columns: [
    { field: 'region', title: 'Region', filter: { type: 'set' } },
    { field: 'stage', title: 'Stage', filter: { type: 'set' } },
    { field: 'count', title: 'Count', type: 'number' },
  ],
});
createChart({ grid, container: chartEl, type: 'funnel', x: 'stage', y: 'count',
  title: 'Sales pipeline' });

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';

const LatticeGrid = createLatticeGrid({ React, createGrid });
const stages = ['Lead', 'Qualified', 'Proposal', 'Won'];
const counts = { North: [1200, 640, 310, 120], South: [980, 480, 220, 90], East: [1500, 720, 330, 150] };
const rows = Object.entries(counts).flatMap(([region, list]) =>
  list.map((count, i) => ({ id: `${region}-${stages[i]}`, region, stage: stages[i], count })));
const columns = [
  { field: 'region', title: 'Region', filter: { type: 'set' } },
  { field: 'stage', title: 'Stage' },
  { field: 'count', title: 'Count', type: 'number' },
];

export function PipelineFunnel() {
  const gridRef = useRef(null);
  const chartRef = useRef(null);
  useEffect(() => {
    const chart = createChart({ grid: gridRef.current.grid, container: chartRef.current,
      type: 'funnel', x: 'stage', y: 'count', title: 'Sales pipeline' });
    return () => chart.destroy();
  }, []);
  return (<>
    <LatticeGrid ref={gridRef} rowKey="id" columns={columns} rows={rows} style={{ height: 200 }} />
    <div ref={chartRef} style={{ height: 360 }} />
  </>);
}

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 'funnel' here, one band per stage.
x string The stage column, one band each.
y string The measure column, here the count at that stage.
title string Drawn above the plot.

Reading the pipeline

Look first for the narrowest step between two bands, because that is where the pipeline leaks. In the example, most regions lose about half their leads before qualification, while the Online team starts with the most leads and keeps the smallest share. Filter the Region column to compare a team against the whole, and clear it to see the total again.

Next

See the funnel beside the other specialist charts in the specialist 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

All posts RSS