react-plot
Version:
Library of React components to render SVG 2D plots.
30 lines • 935 B
TypeScript
import type { Dispatch } from 'react';
import type { ActionType, Shape } from '../types.js';
interface LegendLabelState {
id: string;
isVisible: boolean;
label?: string;
shape?: {
figure: Shape;
color: string;
hidden: boolean;
};
range?: {
rangeColor?: string;
};
colorLine?: string;
}
export interface LegendState {
labels: LegendLabelState[];
}
export type LegendActions = ActionType<'ADD_LEGEND_LABEL', Omit<LegendLabelState, 'isVisible'>> | ActionType<'REMOVE_LEGEND_LABEL', {
id: string;
}> | ActionType<'TOGGLE_VISIBILITY', {
id: string;
}>;
export type LegendDispatch = Dispatch<LegendActions>;
export type LegendContext = readonly [LegendState, LegendDispatch];
export declare const legendContext: import("react").Context<LegendContext | null>;
export declare function useLegend(): LegendContext;
export {};
//# sourceMappingURL=legendContext.d.ts.map