@equinor/videx-wellog
Version:
Visualisation components for wellbore log data
49 lines (48 loc) • 1.78 kB
TypeScript
import { D3Selection } from '../common/interfaces';
import { Track } from '../tracks';
export type LegendRowsFunction = (track: Track) => number;
export type LegendTriggerFunction = () => void;
export type LegendOnInitFunction = (elm: Element, track: Track, updateTrigger: LegendTriggerFunction) => void;
export interface LegendBounds {
top: number;
left: number;
height: number;
width: number;
}
export type LegendOnUpdateFunction = (elm: Element, bounds: LegendBounds, track: Track) => void;
interface BasicVerticalLinkLabelConfig {
label: string;
abbr: string;
onClick: () => void;
title?: string;
}
export interface LegendConfig {
elementType: string;
getLegendRows(track: Track): number;
onInit: LegendOnInitFunction;
onUpdate: LegendOnUpdateFunction;
}
/**
* Helper functions for creating track legends.
*/
export default class LegendHelper {
/**
* Creates a basic legend config required by the wellog component
*/
static basicLegendSvgConfig(trackRowsFunc: LegendRowsFunction, updateFunc: LegendOnUpdateFunction): LegendConfig;
/**
* Renders a simple rotated text label that is scaled to fit bounds
*/
static renderBasicVerticalSvgLabel(g: D3Selection, bounds: LegendBounds, label: string, abbr: string, horizontal?: boolean): D3Selection;
/**
* Convenience function for quickly creating a legend config object for
* a rotated label legend.
*/
static basicVerticalLabel(label: string, abbr: string): LegendConfig;
/**
* Convenience function for creating a legend config object for
* a clickable rotated label legend.
*/
static basicVerticalLinkLabel({ label, abbr, onClick, title, }: BasicVerticalLinkLabelConfig): LegendConfig;
}
export {};