Developer Guide — Charts from your own data¶
Part of the Developer Guide. The options and types are in the API reference.
Experimental. This entry point (
@wafertools/wafermap/experimental/charts) may change or be removed without notice, and it is not part of the stable API. It is on its own subpath so that nothing imports it by accident. Build on it knowing that.
Charts from your own data¶
Insights draws charts from the wafers you load into wafermap. Your application may also hold other data: summaries with one row for each wafer, lot
or order, with a date, a count of dies in each bin, a revenue. This entry point draws the same charts from such data, wherever your application gets it
(a database, an API, a file). You give it as a table: one array per column, one value per row. There are no dies to hand to renderWaferMap and no test
values to load, so a page that only needs yield by lot does not have to invent them.
What this is for¶
This is not a general-purpose charting library, and it is not meant to become one. It has one purpose: to let an application that already shows wafermap's charts in Insights show the same charts in other parts of the application, over data it holds itself. Readers then meet one familiar set of charts and features everywhere: the same chart types, the same editor and filter, the same colours and words, the same ⋯ menu, scrolling and zoom.
That sets what you can expect from it:
- The chart types are the ones Insights draws, in the cases a table can fill (bar charts, line charts, box plots, scatter plots, histograms, control charts and heatmaps). A new chart type arrives here when it arrives in Insights, not on request for this entry point alone.
- The look is the library's own. There is no styling layer for building a chart from nothing. A page chooses which charts to draw, over which rows, and which parts of each chart's chrome to show.
- If you need a chart that Insights does not have, or a look of your own, a general charting library is the right tool, and it can sit beside this one.
You can draw it two ways:
- Charts you choose (
renderCharts): the page picks the charts and the library draws them, with no editor and no buttons.
Live example: charts only - A builder for your readers (
renderChartsTab): readers press New chart and build a chart from your data's columns, and the page keeps what they build.
Live example: build your own

The same data shape works for rows that are not wafers (an order, a region and a month): see Rows that are not wafers.
Getting your data in¶
However your application gets its data, give the library one array per column:
const col = (name: string) => rows.map(r => r[name]);
const table = {
labelField: 'wafer', // the column that names each row
fields: { wafer: col('wafer'), device: col('device'), lot: col('lot'), tested: col('tested') },
outcomes: { 1: col('bin_1'), 2: col('bin_2'), 3: col('bin_3') }, // how many dies fell in each bin, for each wafer
goodOutcomes: [1], // which bins count as good: you must say
};
- Columns are named by you, and the names are what readers see. A column of numbers is a number to chart; text is a category;
2026-03-14(or with a time, or aDate) is a date and draws on a date axis. - Counts can arrive as numbers,
bigintor text ("1042"), as a database driver returns them. A missing count is none. outcomesis optional. Without it there are columns only, and no yield (see below).goodOutcomeshas no default. A table cannot know which bins pass, so a table withoutcomesand nogoodOutcomesis refused, with the reason.- Prepare special cases on your side. "The first wafer of each lot" is easiest as a column (a rank, a flag) that readers then use as an ordinary filter.
A table that cannot be read is not drawn. The container shows the reason as an alert, setTable returns it, and the handle's issues holds it.
A page of charts you choose¶
import { renderCharts } from '@wafertools/wafermap/experimental/charts';
const handle = renderCharts({
container: document.getElementById('charts')!,
table,
plots: [yieldByLot], // one plot is one chart; several are a grid
onSelect: (s) => show(s.labels), // a click tells you which rows the mark stands for
targets: [{ id: 'lot', label: 'Open the lot page', run: (s) => openLot(s.rows[0].lot) }],
height: '320px',
});
A plot is the definition of a chart, a small piece of JSON. This one is a bar for each lot:
{ "id": "yield-by-lot", "title": "Yield by lot", "chart": "bar",
"fields": { "x": { "meta": "lot" }, "y": { "builtin": "yield" }, "color": { "none": true } },
"valueLabels": true }
Using a chart's JSON describes the format and gives an example of each chart type. A table can draw bar charts, line charts, box plots, scatter plots, histograms, control charts and heatmaps; the other charts need tests.
By default each chart has its title and colour legend, on the page's own background. The border, the ⋯ menu, the expand button and the statement
under the title are off. Turn any back on with chrome: { menu: true, expand: true, footnote: true, frame: true }, or hide the title and legend with
chrome: { title: false, legend: false }. handle.setTable(...) redraws the charts over a changed table (other rows, other good bins) and
handle.setPlots(...) draws other plots over the same table.
A builder for your readers¶
import { renderChartsTab } from '@wafertools/wafermap/experimental/charts';
const handle = renderChartsTab({
container: document.getElementById('tab')!,
table,
plots: savedPlots, // your starting charts, plus each reader's own
onPlotsChange: (plots) => saveSomewhere(plots), // called a moment after a reader changes anything
onSelect: (s) => console.log(s.category, s.labels),
targets: [
{ id: 'lot', label: 'Open the lot page',
unavailable: (s) => (new Set(s.rows.map(r => r.lot)).size === 1 ? null : 'Pick wafers from one lot'),
run: (s) => location.assign(`/lots/${s.rows[0].lot}`) },
],
});

Readers get the same cards, filter, Edit, Duplicate and Delete as the My charts tab. New chart starts from your data's columns: the type, what goes along the bottom, what the bars measure, the colour, and a filter such as one device or wafers below 90% yield. Their charts are the same kind of JSON as the one above.
The library keeps nothing. Your page gives the saved plots in and is told of every change by onPlotsChange, so you decide where they live: per person, per project
or shared. The same list works for an export and an import (Export charts…, Import charts…), and readPlotsFile and writePlotsFile read and write the file.
When a mark is clicked¶
A click on a bar, box or point tells the page what it stands for. onSelect gets a selection:
{
"category": "L03",
"group": "Bin 2",
"wafers": [12, 13, 14, 15],
"labels": ["L03-01", "L03-02", "L03-03", "L03-04"],
"rows": [ { "device": "Alpha", "lot": "L03", "tested": "2026-01-19" }, "…" ],
"at": { "x": 420, "y": 310 }
}
wafers are positions in your table, and rows carries the columns for just those rows, so a link can be built from them.
With targets, the click also opens a menu. On the builder it holds Charts for these wafers (a new chart of just those rows, and each saved chart
drawn over them) and a section of your own places: another page, another tool, a web address. On a page of charts, the menu holds your places only. A target
can say it cannot take this selection (unavailable returns the reason) and is then greyed in the menu, with the reason beside it. With no targets, a
click only calls onSelect. On the builder, drilldown: false turns the menu off too.
Rows that are not wafers¶
Nothing in the charts has to say wafer, die or bin. Say what your rows are and what they hold:
const table = {
labelField: 'row',
fields: { /* your columns */ },
outcomes: { 1: onTime, 2: late, 3: cancelled }, // optional
goodOutcomes: [1],
words: { row: ['region-month', 'region-months'], item: 'order', rate: 'On-time rate', outcome: { field: 'Delivery' } },
outcomeNames: { 1: 'On time', 2: 'Late', 3: 'Cancelled' },
};
Live example: rows that are not wafers
wordsrenames what the rows (row), the things counted (item) and the good share (rate) are called. Titles, axes, footnotes, the builder and the click menu then use them.outcomeNamesnames the outcomes instead of "Bin 1", "Bin 2".- Counts are optional. A table of columns only (a revenue column and a region column) draws sums, averages and counts of rows, and offers no yield.
- Counts and sums with no unit are written in full, with thousands separators (767,168), never as an exponent.
Many categories, and zooming¶
These work on every chart, not only the ones drawn from your own data:
- Many categories scroll. A vertical bar or box chart with more categories than fit at a readable width shows a window of them, with a scroll bar underneath and a note such as "1–44 of 3,000". Scroll with the bar, a sideways swipe, or Shift and the wheel; the ordinary wheel still scrolls the page. Save as PNG holds every category.
- Line charts, scatter plots, control charts, histograms and probability plots zoom. Ctrl (or Cmd) and the wheel, or a trackpad pinch, zoom about the pointer. Shift and drag zooms to a box, and the keys +, −, the arrows, 0 and Esc do the same from the keyboard once the chart has focus. A Reset zoom button appears at the top right of the plot while zoomed, and a double click resets too. A zoom is a view only: the chart's data is unchanged.
The build your own example has a table of 3,000 wafers to try both on.
Notes¶
- Size. The charts suit a table of up to a few hundred rows. With thousands, a bar for each wafer cannot be read: draw lots or devices instead, or filter first.
- Not included. Test values, die maps and retests need dies. The table does not load, cache or paginate your data: the page hands over the arrays.
- Stability. The shape of the table, the names and the plot JSON may change between versions. The plot format is the one the My charts tab keeps, so a saved chart carries across.