Skip to content

LegendLayer.setSubtitle

Summary

LegendLayer.setSubtitle sets the optional legend subtitle. An empty string hides the subtitle element.

Syntax

LegendLayer.setSubtitle(subtitle: string): this
layer.setSubtitle(subtitle);

Parameters

Name Type Required Description
subtitle string Yes Secondary heading, or empty string to hide it.

Returns

this - The same instance for method chaining.

Type Details

The subtitle element is shown only for a non-empty value.

Example

const legend = wgpu.createOverlay.legend({
  source: {
    scaleTransform: { mode: "linear", domainMin: 0, domainMax: 100 },
    colormap: "viridis",
  },
});
legend.setSubtitle("Time-averaged");

See Also