typed-xlsx
Charts and Pivots

Axes and Styling

Titles, axes, a secondary axis, legends, colors and data labels.

Chart-level options sit next to marks.

createWorkbook
()
.
sheet
("Sales")
.
table
("sales", {
schema
:
sales
,
rows
: [] })
.
chart
("performance", ({
refs
}) => ({
title
: "Revenue, target and margin",
marks
: [
refs
.
table
("sales").
bar
({
x
: "month",
y
: "revenue",
color
: "#2563EB" }),
refs
.
table
("sales").
line
({
x
: "month",
y
: "target",
color
: "#94A3B8",
dashed
: true }),
refs
.
table
("sales").
line
({
x
: "month",
y
: "marginRate",
color
: "#F59E0B",
axis
: "y2" }),
],
axes
: {
y
: {
title
: "EUR",
min
: 0 },
y2
: {
title
: "Margin",
format
: "0%" },
},
legend
: "top",
}));

Axes

axes.x is the category axis (or the horizontal value axis of a scatter chart), axes.y the main value axis, and axes.y2 the secondary axis used by marks with axis: "y2".

OptionApplies toEffect
titleallAxis title
hiddenallHides the axis
gridlinesallMajor gridlines. On by default for y
reverseallReverses the order
min, maxvalue axesFixed bounds
stepvalue axesDistance between ticks
formatvalue axesExcel number format such as "#,##0" or "0%"
logBasevalue axesLogarithmic scale, such as 10

Without format, axes use the number format of the plotted cells, so a column styled with numFmt: "0%" gets a percentage axis.

Legend

The legend shows at the bottom when a chart has several series or slices, and is hidden for a single series. Set legend to "top", "bottom", "left", "right", or false.

Colors

Set color on a mark (single series) or on a { column, color } entry, as a hex string such as "#2563EB". A chart-level colors list colors the remaining series in order, and the slices of a pie.

createWorkbook
()
.
sheet
("Regions")
.
table
("regions", {
schema
:
regions
,
rows
: [] })
.
chart
("share", ({
refs
}) => ({
marks
: [
refs
.
table
("regions").
pie
({
label
: "region",
value
: "revenue" })],
colors
: ["#2563EB", "#10B981", "#F59E0B", "#8B5CF6"],
}));

Without colors, Excel uses the workbook theme's palette.

Data labels

labels: true shows each point's value. Pass an object to choose what to show:

createWorkbook
()
.
sheet
("Regions")
.
table
("regions", {
schema
:
regions
,
rows
: [] })
.
chart
("ranked", ({
refs
}) => ({
marks
: [
refs
.
table
("regions").
bar
({
x
: "region",
y
: "revenue",
horizontal
: true,
labels
: {
value
: true,
format
: "#,##0" },
}), ], }));
OptionEffect
valueThe value (on by default)
categoryThe category or slice label
seriesThe series name
percentThe share of the total, for pies and doughnuts
formatNumber format of the labels
Copyright © 2026 Cyprien Thao. Released under the MIT License.