Skip to content

plugin-api/PlotActionRegistry#

usePlotActionButtons()#

function usePlotActionButtons(): PlotActionButtonDef[];

React hook that returns all registered plot action buttons, re-rendering on changes.

Returns#

PlotActionButtonDef[]


PlotActionPriority#

const PlotActionPriority: {
  Essential: 100;
  Navigation: 10;
  Passive: 5;
  Primary: 70;
  Secondary: 30;
  Unspecified: 50;
};

Rail survival tiers. A short rail collapses the lowest priority first.

  • Essential — adjusted while reading any spectrum; collapses only once nothing else is left.
  • Primary — analysis surfaces opened per sample rather than per glance.
  • Unspecified — the default, including every plugin action: ranked below core analysis but above core one-shots, so a plugin lands mid-rail rather than at either extreme.
  • Secondary — occasional or specialist tools and read-only records.
  • Navigation — leaves the plot for another page, so the rail slot buys nothing that the overflow menu does not.
  • Passive — a read-only record consulted when something looks wrong, neither a destination nor a tool that changes the spectrum; collapses first.

Type Declaration#

Essential#

readonly Essential: 100;

readonly Navigation: 10;

Passive#

readonly Passive: 5;

Primary#

readonly Primary: 70;

Secondary#

readonly Secondary: 30;

Unspecified#

readonly Unspecified: 50;

plotActionRegistry#

const plotActionRegistry: PlotActionRegistry;

PlotActionButtonDef#

Static definition for a plot action button (registered at module load time).

Properties#

group?#

optional group?: string;

Optional visual group key for clustering buttons in the sidebar.

icon#

icon: ComponentType<{
  fontSize?: "small" | "medium" | "inherit" | "large";
}>;

id#

id: string;

isDisabled?#

optional isDisabled?: (ctx) => boolean;

Dynamic disabled state.

Parameters#
Parameter Type
ctx PlotContext
Returns#

boolean

isLoading?#

optional isLoading?: (ctx) => boolean;

Dynamic loading state.

Parameters#
Parameter Type
ctx PlotContext
Returns#

boolean

isToggle?#

optional isToggle?: boolean;

Whether this button acts as a toggle (active/inactive). Default: true.

kind?#

optional kind?: "view" | "panel" | "mode" | "navigate" | "action";

Interaction outcome; used to distinguish destinations, inspectors and view toggles.

order#

order: number;

Sort order. Built-in buttons use 100–700.

panelComponent?#

optional panelComponent?: ComponentType<{
  activePage: string;
  onClose: () => void;
  plotId: string | undefined;
}>;

For plugin buttons: panel component rendered in PopoutWindow when active.

panelConfig?#

optional panelConfig?: {
  height: number;
  title: string;
  width: number;
  windowId: string;
};

PopoutWindow config (only used if panelComponent is set).

height#
height: number;
title#
title: string;
width#
width: number;
windowId#
windowId: string;

plotClickHandler?#

optional plotClickHandler?: (dataX, dataY) => void;

For plugin buttons: called when user clicks the plot while this button is active.

Parameters#
Parameter Type
dataX number
dataY number
Returns#

void

priority?#

optional priority?: number;

How long the button keeps its rail slot before collapsing into the overflow menu; higher survives longer. See PlotActionPriority. Defaults to PlotActionPriority.Unspecified.

tooltip#

tooltip: string | ((ctx) => string);

visibilityCondition#

visibilityCondition: (ctx) => boolean;
Parameters#
Parameter Type
ctx PlotContext
Returns#

boolean


PlotContext#

Context describing the current plot state, passed to visibility conditions.

Properties#

experimentType#

experimentType: ExperimentType;

The loaded scan's experiment, for an action that only makes sense on one kind of plane — a DOSY map needs a diffusion set, and cross-peaks mean nothing on a J-resolved plane whose F1 carries coupling rather than a second shift.

hasData#

hasData: boolean;

is2D#

is2D: boolean;

Whether the current VIEW draws a 2D plot (heatmap/contour trace present).

isContourPlot#

isContourPlot: boolean;

isData2D#

isData2D: boolean;

Whether the DATA is 2D, which the surface and ridge views render with 1D trace types. An action whose backend rejects 2D data must gate on this, not on is2D, or those views let a 2D scan reach a 1D endpoint.

isPhaseSensitive2D?#

optional isPhaseSensitive2D?: boolean;

2D only: the plane was recorded with a phase-sensitive F1 scheme, so it can be phased.

isRidgePlot#

isRidgePlot: boolean;

isSpectrumPlot#

isSpectrumPlot: boolean;

isSurface#

isSurface: boolean;

legendVisible#

legendVisible: boolean;

Whether the plot legend is currently shown (plotSettings.legend.show).

overrideHandlerId#

overrideHandlerId: string;

plotId#

plotId: string | undefined;

referenceFrequencyHz#

referenceFrequencyHz: number | undefined;

solventDisplayName#

solventDisplayName: string | null;