Lattice Grid

blog

Word Cloud of Support Ticket Subjects

Building…
Loading a live grid…

If you lead a support team, the question you bring to the monthly review is what people actually wrote to you about. Not which tickets were tagged as what, but which words kept turning up in the subject lines, including the theme nobody filed a bug for.

A word cloud answers that by size. Each word is drawn as large as the number of tickets that used it, so the loudest theme is the first thing you see. The chart above is bound to the grid beneath it, one row per queue and word, so filtering the rows redraws the cloud. Filter the Queue column to one queue and see what that queue is asking about. Click a word and the grid filters to the rows that contain it.

Why a word cloud and not a bar chart

A bar chart ranks a short list of known categories well. Subject lines are not a short list: there are dozens of words, most of them small, and what you are hunting for is the odd one that is bigger than you expected. A cloud holds that whole vocabulary on one screen and lets size do the ranking, where a bar chart would need a scroll.

The chart over a grid

The x option is the word column and y the count, and the chart sums the counts for each distinct word, so a word that appears in several queues is drawn once, at its combined size. The word cloud 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-wordcloud';

const rows = [
  { id: 1, queue: 'Billing', word: 'invoice', count: 46 },
  { id: 2, queue: 'Billing', word: 'refund', count: 31 },
  { id: 3, queue: 'Accounts', word: 'login', count: 38 },
  { id: 4, queue: 'Accounts', word: 'password', count: 29 },
  { id: 5, queue: 'Reports', word: 'export', count: 52 },
  { id: 6, queue: 'Reports', word: 'filter', count: 24 },
  { id: 7, queue: 'Integrations', word: 'export', count: 23 },
  { id: 8, queue: 'Integrations', word: 'import', count: 34 },
];
const gridEl = document.createElement('div');
const chartEl = document.createElement('div');
gridEl.style.height = '240px';
chartEl.style.height = '360px';
document.body.append(gridEl, chartEl);

const grid = createGrid(gridEl, {
  rowKey: 'id', rows,
  columns: [
    { field: 'queue', title: 'Queue', filter: { type: 'set' } },
    { field: 'word', title: 'Word', filter: { type: 'set' } },
    { field: 'count', title: 'Tickets', type: 'number' },
  ],
});
createChart({ grid, container: chartEl, type: 'wordCloud', x: 'word', y: 'count',
  title: 'Words in last month\'s ticket subjects',
  minSize: 14, maxSize: 54, rotate: [0, 90], seed: 3 });

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

const LatticeGrid = createLatticeGrid({ React, createGrid });
const rows = [
  { id: 1, queue: 'Billing', word: 'invoice', count: 46 },
  { id: 2, queue: 'Billing', word: 'refund', count: 31 },
  { id: 3, queue: 'Accounts', word: 'login', count: 38 },
  { id: 4, queue: 'Accounts', word: 'password', count: 29 },
  { id: 5, queue: 'Reports', word: 'export', count: 52 },
  { id: 6, queue: 'Reports', word: 'filter', count: 24 },
];
const columns = [
  { field: 'queue', title: 'Queue', filter: { type: 'set' } },
  { field: 'word', title: 'Word', filter: { type: 'set' } },
  { field: 'count', title: 'Tickets', type: 'number' },
];

export function TicketWords() {
  const gridRef = useRef(null);
  const chartRef = useRef(null);
  useEffect(() => {
    const chart = createChart({ grid: gridRef.current.grid, container: chartRef.current,
      type: 'wordCloud', x: 'word', y: 'count', minSize: 14, maxSize: 54, seed: 3 });
    return () => chart.destroy();
  }, []);
  return (<>
    <LatticeGrid ref={gridRef} rowKey="id" columns={columns} rows={rows} style={{ height: 240 }} />
    <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 'wordCloud' here, words sized by how much there is of them.
x string The word column, one word per distinct value.
y string The value column, summed for each word and used for its size.
minSize number Font size in pixels for the smallest word. Default 12.
maxSize number Font size in pixels for the biggest word. Default 48.
rotate number, number[] or 'random' Angles in degrees: one angle, a list to choose among, or 'random'. Default 0.
seed number Placement seed, so the same data and seed draw the same picture. Default 1.
title string Drawn above the plot.

Reading the cloud

Look first at the biggest word, then ask whether it is a word you expected. In the example, export is drawn largest, and it turns up in every one of the five queues. Nobody filed a bug about it, and it is the theme that runs through the most of them. Filter to a single queue and the cloud turns over, so you can see which queue is carrying the theme before you decide who should own it.

Next

See the word cloud 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

  • 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.

  • Pictorial Chart of Fleet by Vehicle Type

    Bind a pictorial chart to a grid of vehicle counts, one icon for every ten vehicles. Filter the rows by depot and the icons redraw.

  • Pyramid Chart for a Content Audience

    Bind a pyramid chart to a grid of audience counts: reach, engaged, subscribers, customers. Filter the rows by channel to redraw the layers.

All posts RSS