Commit 65476d40 by ryan

don't use process timeseries

parent 0f0f76b6
...@@ -20,27 +20,10 @@ export interface TimeSeriesVM { ...@@ -20,27 +20,10 @@ export interface TimeSeriesVM {
label: string; label: string;
color: string; color: string;
data: TimeSeriesValue[][]; data: TimeSeriesValue[][];
stats: TimeSeriesStats;
allIsNull: boolean; allIsNull: boolean;
allIsZero: 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 { export enum NullValueMode {
Null = 'null', Null = 'null',
Ignore = 'connected', Ignore = 'connected',
......
...@@ -2,17 +2,9 @@ ...@@ -2,17 +2,9 @@
import _ from 'lodash'; import _ from 'lodash';
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { import { Graph, PanelProps, NullValueMode, colors, TimeSeriesVMs, ColumnType, getFirstTimeColumn } from '@grafana/ui';
Graph,
PanelProps,
NullValueMode,
colors,
TimeSeriesVMs,
ColumnType,
getFirstTimeColumn,
processTimeSeries,
} from '@grafana/ui';
import { Options } from './types'; import { Options } from './types';
import { getFlotPairs } from '@grafana/ui/src/utils/flotPairs';
interface Props extends PanelProps<Options> {} interface Props extends PanelProps<Options> {}
...@@ -33,16 +25,23 @@ export class GraphPanel extends PureComponent<Props> { ...@@ -33,16 +25,23 @@ export class GraphPanel extends PureComponent<Props> {
// Show all numeric columns // Show all numeric columns
if (column.type === ColumnType.number) { if (column.type === ColumnType.number) {
const tsvm = processTimeSeries({ // Use external calculator just to make sure it works :)
data: [table], const points = getFlotPairs({
xColumn: timeColumn, rows: table.rows,
yColumn: i, xIndex: timeColumn,
yIndex: i,
nullValueMode: NullValueMode.Null, nullValueMode: NullValueMode.Null,
})[0]; });
const colorIndex = vmSeries.length % colors.length; vmSeries.push({
tsvm.color = colors[colorIndex]; label: column.text,
vmSeries.push(tsvm); data: points,
color: colors[vmSeries.length % colors.length],
// TODO (calculate somewhere)
allIsNull: false,
allIsZero: false,
});
} }
} }
} }
......
...@@ -29,7 +29,7 @@ export class PieChartPanel extends PureComponent<Props> { ...@@ -29,7 +29,7 @@ export class PieChartPanel extends PureComponent<Props> {
const serie = vmSeries[i]; const serie = vmSeries[i];
if (serie) { if (serie) {
datapoints.push({ datapoints.push({
value: serie.stats[valueOptions.stat], value: 7, // serie.stats[valueOptions.stat],
name: serie.label, name: serie.label,
color: serie.color, color: serie.color,
}); });
......
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