From 65476d40444d656cb8bdc021f3a533af73a1927f Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 22 Mar 2019 15:40:17 -0700 Subject: [PATCH] don't use process timeseries --- packages/grafana-ui/src/types/data.ts | 17 --------- .../app/plugins/panel/graph2/GraphPanel.tsx | 35 +++++++++---------- .../plugins/panel/piechart/PieChartPanel.tsx | 2 +- 3 files changed, 18 insertions(+), 36 deletions(-) diff --git a/packages/grafana-ui/src/types/data.ts b/packages/grafana-ui/src/types/data.ts index fcbf95f9f4a..f589e1c4e29 100644 --- a/packages/grafana-ui/src/types/data.ts +++ b/packages/grafana-ui/src/types/data.ts @@ -20,27 +20,10 @@ export interface TimeSeriesVM { label: string; color: string; data: TimeSeriesValue[][]; - stats: TimeSeriesStats; allIsNull: boolean; allIsZero: boolean; } -export interface TimeSeriesStats { - [key: string]: number | null; - total: number | null; - max: number | null; - min: number | null; - logmin: number; - avg: number | null; - current: number | null; - first: number | null; - delta: number; - diff: number | null; - range: number | null; - timeStep: number; - count: number; -} - export enum NullValueMode { Null = 'null', Ignore = 'connected', diff --git a/public/app/plugins/panel/graph2/GraphPanel.tsx b/public/app/plugins/panel/graph2/GraphPanel.tsx index 5d3bdca5dca..bdcade365d7 100644 --- a/public/app/plugins/panel/graph2/GraphPanel.tsx +++ b/public/app/plugins/panel/graph2/GraphPanel.tsx @@ -2,17 +2,9 @@ import _ from 'lodash'; import React, { PureComponent } from 'react'; -import { - Graph, - PanelProps, - NullValueMode, - colors, - TimeSeriesVMs, - ColumnType, - getFirstTimeColumn, - processTimeSeries, -} from '@grafana/ui'; +import { Graph, PanelProps, NullValueMode, colors, TimeSeriesVMs, ColumnType, getFirstTimeColumn } from '@grafana/ui'; import { Options } from './types'; +import { getFlotPairs } from '@grafana/ui/src/utils/flotPairs'; interface Props extends PanelProps {} @@ -33,16 +25,23 @@ export class GraphPanel extends PureComponent { // Show all numeric columns if (column.type === ColumnType.number) { - const tsvm = processTimeSeries({ - data: [table], - xColumn: timeColumn, - yColumn: i, + // Use external calculator just to make sure it works :) + const points = getFlotPairs({ + rows: table.rows, + xIndex: timeColumn, + yIndex: i, nullValueMode: NullValueMode.Null, - })[0]; + }); - const colorIndex = vmSeries.length % colors.length; - tsvm.color = colors[colorIndex]; - vmSeries.push(tsvm); + vmSeries.push({ + label: column.text, + data: points, + color: colors[vmSeries.length % colors.length], + + // TODO (calculate somewhere) + allIsNull: false, + allIsZero: false, + }); } } } diff --git a/public/app/plugins/panel/piechart/PieChartPanel.tsx b/public/app/plugins/panel/piechart/PieChartPanel.tsx index 5082b162f96..4982a0f3498 100644 --- a/public/app/plugins/panel/piechart/PieChartPanel.tsx +++ b/public/app/plugins/panel/piechart/PieChartPanel.tsx @@ -29,7 +29,7 @@ export class PieChartPanel extends PureComponent { const serie = vmSeries[i]; if (serie) { datapoints.push({ - value: serie.stats[valueOptions.stat], + value: 7, // serie.stats[valueOptions.stat], name: serie.label, color: serie.color, });