Charts

The package ships no renderer and no plotting dependency. What it ships is data already shaped like a series, so generating a chart is a map rather than an integration.

Why There Is No Chart API

A level progression is a series: the level is the x-axis and every measured field on that level is a line. Once that is true, a chart helper would only be wrapping Array.map and forcing an opinion about rendering on you. So the catalogs are the chart API, and the drawing stays yours — Chart.js, D3, Vega, a spreadsheet, an SVG you write by hand.

One Entity Across Its Levels

import { uwStoneChartData } from 'thetowersdk/data'
import { formatNumberForDisplay } from 'thetowersdk/formatting'

const gt = Object.values(uwStoneChartData).find((w) => w.name === 'Golden Tower')
const multiplier = gt.stats.find((s) => s.name === 'Multiplier')

// Level, value, cost, running total — the table players actually want.
let running = 0
const rows = multiplier.levels.map((l) => {
  if (typeof l.cost === 'number') running += l.cost
  return [l.level, l.value, l.cost, formatNumberForDisplay(running)]
})

Many Entities At Once

The comparison charts people actually want are the same operation applied across a catalog.

import { uwStoneChartData } from 'thetowersdk/data'

// One series per ultimate weapon: stone cost to reach each cooldown level.
const datasets = Object.values(uwStoneChartData).map((weapon) => {
  const cooldown = weapon.stats.find((s) => s.name === 'Cooldown')
  return {
    label: weapon.name,
    data: (cooldown?.levels ?? [])
      .filter((l) => typeof l.cost === 'number')
      .map((l) => ({ x: l.level, y: l.cost })),
  }
})

// Hand the points to Chart.js, D3, Vega, or a spreadsheet.
chart.data = { datasets }

How Much Is Chartable

Counted from the installed package, the shipped catalogs support 786 distinct series — one per measurable field that varies across a level range:

  • Labs — coin cost and research time for every lab.
  • Workshop — stat value, cash cost, and coin cost per upgrade.
  • Cards — level values and mastery values.
  • Ultimate weapons — stat value and stone cost per stat.
  • Bots — per-stat progressions, including plus variants.
  • Guardians — chip stat value and cost.

That figure is the raw floor, not a ceiling. It counts only fields that already vary by level, and deliberately excludes catalogs with nothing to plot — relics carry a single flat value, module substats are cluster metadata, and vault nodes are identifiers. Anything you derive, combine, or compute from the formulas is additional.

More Examples →