Skip to content

GridLayer.setTickFormatter

Summary

GridLayer.setTickFormatter sets the callback used to format U- and V-axis tick values. The formatter receives the numeric value and "u" or "v".

Syntax

GridLayer.setTickFormatter(formatter: (value: number, axis: GridAxis) => string): this
layer.setTickFormatter(formatter);

Parameters

Name Type Required Description
formatter (value: number, axis: GridAxis) => string Yes Callback producing each tick label.

Returns

this - The same instance for method chaining.

Type Details

type GridAxis = "u" | "v";

Example

const grid = wgpu.createOverlay.grid();
grid.setTickFormatter((value, axis) => `${axis}:${value.toFixed(1)}`);

See Also