@grafana/ui
Version:
Grafana Components Library
1 lines • 1.63 kB
Source Map (JSON)
{"version":3,"file":"types.mjs","sources":["../../../../src/components/uPlot/types.ts"],"sourcesContent":["import * as React from 'react';\nimport uPlot, { Options, AlignedData } from 'uplot';\n\nimport { UPlotConfigBuilder } from './config/UPlotConfigBuilder';\n\n/**\n * @internal -- not a public API\n */\nexport const FIXED_UNIT = '__fixed';\n\nexport type PlotConfig = Pick<\n Options,\n 'mode' | 'series' | 'scales' | 'axes' | 'cursor' | 'bands' | 'hooks' | 'select' | 'tzDate' | 'padding'\n>;\n\nexport type FacetValues = any[];\nexport type FacetSeries = FacetValues[];\nexport type FacetedData = [_: null, ...series: FacetSeries];\n\nexport interface PlotProps {\n data: AlignedData | FacetedData;\n width: number;\n height: number;\n config: UPlotConfigBuilder;\n children?: React.ReactNode;\n // Reference to uPlot instance\n plotRef?: (u: uPlot) => void;\n}\n\nexport abstract class PlotConfigBuilder<P, T> {\n constructor(public props: P) {}\n abstract getConfig(): T;\n}\n\n/**\n * @alpha\n */\nexport type PlotTooltipInterpolator = (\n updateActiveSeriesIdx: (sIdx: number | null) => void,\n updateActiveDatapointIdx: (dIdx: number | null) => void,\n updateTooltipPosition: (clear?: boolean) => void,\n u: uPlot\n) => void;\n\nexport interface PlotSelection {\n min: number;\n max: number;\n\n // selection bounding box, relative to canvas\n bbox: {\n top: number;\n left: number;\n width: number;\n height: number;\n };\n}\n"],"names":[],"mappings":";AAQO,MAAM,UAAA,GAAa;AAqBnB,MAAe,iBAAA,CAAwB;AAAA,EAC5C,YAAmB,KAAA,EAAU;AAAV,IAAA,IAAA,CAAA,KAAA,GAAA,KAAA;AAAA,EAAW;AAEhC;;;;"}