2021-09-29 12:14:15 -05:00
|
|
|
import {
|
|
|
|
OptionsWithTooltip,
|
|
|
|
OptionsWithLegend,
|
|
|
|
LineStyle,
|
|
|
|
VisibilityMode,
|
|
|
|
HideableFieldConfig,
|
|
|
|
AxisConfig,
|
|
|
|
AxisPlacement,
|
|
|
|
} from '@grafana/schema';
|
|
|
|
import {
|
|
|
|
ColorDimensionConfig,
|
|
|
|
DimensionSupplier,
|
|
|
|
ScaleDimensionConfig,
|
|
|
|
TextDimensionConfig,
|
|
|
|
} from 'app/features/dimensions';
|
|
|
|
|
2022-09-27 10:18:42 -05:00
|
|
|
// export enum ScatterLineMode {
|
|
|
|
// None = 'none',
|
|
|
|
// Linear = 'linear',
|
|
|
|
// Smooth
|
|
|
|
// r2, etc
|
|
|
|
// }
|
|
|
|
|
|
|
|
export enum ScatterShow {
|
|
|
|
Points = 'points',
|
|
|
|
Lines = 'lines',
|
|
|
|
PointsAndLines = 'points+lines',
|
|
|
|
}
|
|
|
|
|
|
|
|
export enum SeriesMapping {
|
|
|
|
Auto = 'auto',
|
|
|
|
Manual = 'manual',
|
2021-09-29 12:14:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ScatterFieldConfig extends HideableFieldConfig, AxisConfig {
|
2022-09-27 10:18:42 -05:00
|
|
|
show?: ScatterShow;
|
|
|
|
|
2021-09-29 12:14:15 -05:00
|
|
|
lineWidth?: number;
|
|
|
|
lineStyle?: LineStyle;
|
|
|
|
lineColor?: ColorDimensionConfig;
|
|
|
|
|
|
|
|
pointSize?: ScaleDimensionConfig; // only 'fixed' is exposed in the UI
|
|
|
|
pointColor?: ColorDimensionConfig;
|
|
|
|
pointSymbol?: DimensionSupplier<string>;
|
|
|
|
|
|
|
|
label?: VisibilityMode;
|
|
|
|
labelValue?: TextDimensionConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Configured in the panel level */
|
|
|
|
export interface ScatterSeriesConfig extends ScatterFieldConfig {
|
|
|
|
x?: string;
|
|
|
|
y?: string;
|
2022-09-05 03:03:17 -05:00
|
|
|
name?: string;
|
2021-09-29 12:14:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export const defaultScatterConfig: ScatterFieldConfig = {
|
2022-09-27 10:18:42 -05:00
|
|
|
show: ScatterShow.Points,
|
2021-09-29 12:14:15 -05:00
|
|
|
lineWidth: 1,
|
|
|
|
lineStyle: {
|
|
|
|
fill: 'solid',
|
|
|
|
},
|
|
|
|
pointSize: {
|
|
|
|
fixed: 5,
|
|
|
|
min: 1,
|
|
|
|
max: 20,
|
|
|
|
},
|
|
|
|
axisPlacement: AxisPlacement.Auto,
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Old config saved with 8.0+ */
|
|
|
|
export interface XYDimensionConfig {
|
|
|
|
frame: number;
|
|
|
|
x?: string; // name | first
|
|
|
|
exclude?: string[]; // all other numbers except
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface XYChartOptions extends OptionsWithLegend, OptionsWithTooltip {
|
2022-09-27 10:18:42 -05:00
|
|
|
seriesMapping?: SeriesMapping;
|
2021-09-29 12:14:15 -05:00
|
|
|
dims: XYDimensionConfig;
|
|
|
|
|
|
|
|
series?: ScatterSeriesConfig[];
|
|
|
|
}
|