TimeSeries: Don't re-init chart with bars style on data updates (#83355)

This commit is contained in:
Leon Sorokin
2024-02-26 19:41:39 -06:00
committed by GitHub
parent 2c3596854f
commit 93fef224ae
3 changed files with 23 additions and 24 deletions

View File

@@ -61,6 +61,11 @@ export interface JoinOptions {
*/
keepDisplayNames?: boolean;
/**
* @internal -- Optionally specify how to treat null values
*/
nullMode?: (field: Field) => JoinNullMode;
/**
* @internal -- Optionally specify a join mode (outer or inner)
*/
@@ -95,6 +100,9 @@ export function joinDataFrames(options: JoinOptions): DataFrame | undefined {
return;
}
const nullMode =
options.nullMode ?? ((field: Field) => (field.config.custom?.spanNulls === true ? NULL_REMOVE : NULL_EXPAND));
if (options.frames.length === 1) {
let frame = options.frames[0];
let frameCopy = frame;
@@ -186,8 +194,7 @@ export function joinDataFrames(options: JoinOptions): DataFrame | undefined {
}
// Support the standard graph span nulls field config
let spanNulls = field.config.custom?.spanNulls;
nullModesFrame.push(spanNulls === true ? NULL_REMOVE : spanNulls === -1 ? NULL_RETAIN : NULL_EXPAND);
nullModesFrame.push(nullMode(field));
let labels = field.labels ?? {};
let name = field.name;
@@ -374,9 +381,9 @@ export type AlignedData =
| [xValues: number[] | TypedArray, ...yValues: Array<Array<number | null | undefined> | TypedArray>];
// nullModes
const NULL_REMOVE = 0; // nulls are converted to undefined (e.g. for spanGaps: true)
const NULL_RETAIN = 1; // nulls are retained, with alignment artifacts set to undefined (default)
const NULL_EXPAND = 2; // nulls are expanded to include any adjacent alignment artifacts
export const NULL_REMOVE = 0; // nulls are converted to undefined (e.g. for spanGaps: true)
export const NULL_RETAIN = 1; // nulls are retained, with alignment artifacts set to undefined (default)
export const NULL_EXPAND = 2; // nulls are expanded to include any adjacent alignment artifacts
type JoinNullMode = number; // NULL_IGNORE | NULL_RETAIN | NULL_EXPAND;