Commit 755715fb by Leon Sorokin Committed by GitHub

GraphNG: uPlot 1.5.1 (#29789)

parent 77d6100b
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
"react-transition-group": "4.4.1", "react-transition-group": "4.4.1",
"slate": "0.47.8", "slate": "0.47.8",
"tinycolor2": "1.4.1", "tinycolor2": "1.4.1",
"uplot": "1.5.0" "uplot": "1.5.1"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-commonjs": "16.0.0", "@rollup/plugin-commonjs": "16.0.0",
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
FieldMatcherID, FieldMatcherID,
} from '@grafana/data'; } from '@grafana/data';
import { AlignedFrameWithGapTest } from '../uPlot/types'; import { AlignedFrameWithGapTest } from '../uPlot/types';
import uPlot, { AlignedData } from 'uplot'; import uPlot, { AlignedData, JoinNullMode } from 'uplot';
import { XYFieldMatchers } from './GraphNG'; import { XYFieldMatchers } from './GraphNG';
// the results ofter passing though data // the results ofter passing though data
...@@ -43,7 +43,7 @@ export function mapDimesions(match: XYFieldMatchers, frame: DataFrame, frames?: ...@@ -43,7 +43,7 @@ export function mapDimesions(match: XYFieldMatchers, frame: DataFrame, frames?:
export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers): AlignedFrameWithGapTest | null { export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers): AlignedFrameWithGapTest | null {
const valuesFromFrames: AlignedData[] = []; const valuesFromFrames: AlignedData[] = [];
const sourceFields: Field[] = []; const sourceFields: Field[] = [];
const skipGaps: boolean[][] = []; const nullModes: JoinNullMode[][] = [];
// Default to timeseries config // Default to timeseries config
if (!fields) { if (!fields) {
...@@ -64,12 +64,12 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers): ...@@ -64,12 +64,12 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers):
throw new Error('Only a single x field is supported'); throw new Error('Only a single x field is supported');
} }
let skipGapsFrame: boolean[] = []; let nullModesFrame: JoinNullMode[] = [];
// Add the first X axis // Add the first X axis
if (!sourceFields.length) { if (!sourceFields.length) {
sourceFields.push(dims.x[0]); sourceFields.push(dims.x[0]);
skipGapsFrame.push(true); nullModesFrame.push(0);
} }
const alignedData: AlignedData = [ const alignedData: AlignedData = [
...@@ -79,15 +79,15 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers): ...@@ -79,15 +79,15 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers):
// Add the Y values // Add the Y values
for (const field of dims.y) { for (const field of dims.y) {
let values = field.values.toArray(); let values = field.values.toArray();
let spanNulls = field.config.custom.spanNulls || false; let joinNullMode = field.config.custom.spanNulls ? 0 : 2;
if (field.config.nullValueMode === NullValueMode.AsZero) { if (field.config.nullValueMode === NullValueMode.AsZero) {
values = values.map(v => (v === null ? 0 : v)); values = values.map(v => (v === null ? 0 : v));
spanNulls = true; joinNullMode = 0;
} }
alignedData.push(values); alignedData.push(values);
skipGapsFrame.push(spanNulls); nullModesFrame.push(joinNullMode);
// This will cache an appropriate field name in the field state // This will cache an appropriate field name in the field state
getFieldDisplayName(field, frame, frames); getFieldDisplayName(field, frame, frames);
...@@ -95,7 +95,7 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers): ...@@ -95,7 +95,7 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers):
} }
valuesFromFrames.push(alignedData); valuesFromFrames.push(alignedData);
skipGaps.push(skipGapsFrame); nullModes.push(nullModesFrame);
} }
if (valuesFromFrames.length === 0) { if (valuesFromFrames.length === 0) {
...@@ -103,7 +103,7 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers): ...@@ -103,7 +103,7 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers):
} }
// do the actual alignment (outerJoin on the first arrays) // do the actual alignment (outerJoin on the first arrays)
let { data: alignedData, isGap } = uPlot.join(valuesFromFrames, skipGaps); let { data: alignedData, isGap } = uPlot.join(valuesFromFrames, nullModes);
if (alignedData!.length !== sourceFields.length) { if (alignedData!.length !== sourceFields.length) {
throw new Error('outerJoinValues lost a field?'); throw new Error('outerJoinValues lost a field?');
......
...@@ -25703,10 +25703,10 @@ update-notifier@^2.5.0: ...@@ -25703,10 +25703,10 @@ update-notifier@^2.5.0:
semver-diff "^2.0.0" semver-diff "^2.0.0"
xdg-basedir "^3.0.0" xdg-basedir "^3.0.0"
uplot@1.5.0: uplot@1.5.1:
version "1.5.0" version "1.5.1"
resolved "https://registry.yarnpkg.com/uplot/-/uplot-1.5.0.tgz#c2814cd7a073ed12b0a1d2fc985f3d9cd33bf0cd" resolved "https://registry.yarnpkg.com/uplot/-/uplot-1.5.1.tgz#5d5e846f76af2fd913ae980c00249f953072ea90"
integrity sha512-ghzlTe4rgoYiM98pMUJCplQhSmhyJV8Pv+obV3sHDoC+VBrZDc8fxXnUNGUVcKhUW2eqyeO5D0huardirwOmHw== integrity sha512-R4SfT2P60jKlZdh+mW40U2WzrN7976XLKdA9IsZ1SWLgVryvrqx6uFY5lF+o7GsFUWIW0pJOzaE/03+1gzuhOw==
upper-case@^1.1.1: upper-case@^1.1.1:
version "1.1.3" version "1.1.3"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment