2018-12-17 20:55:25 +08:00
|
|
|
// Libraries
|
|
|
|
|
import _ from 'lodash';
|
2019-01-08 17:30:00 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
2019-01-11 13:48:17 +08:00
|
|
|
import { colors } from '@grafana/ui';
|
2018-12-17 20:55:25 +08:00
|
|
|
|
2018-12-25 17:20:20 +08:00
|
|
|
// Components & Types
|
|
|
|
|
import { Graph, PanelProps, NullValueMode, processTimeSeries } from '@grafana/ui';
|
2018-12-17 20:55:25 +08:00
|
|
|
import { Options } from './types';
|
|
|
|
|
|
|
|
|
|
interface Props extends PanelProps<Options> {}
|
|
|
|
|
|
2019-01-08 17:30:00 +08:00
|
|
|
export class GraphPanel extends PureComponent<Props> {
|
2018-12-17 20:55:25 +08:00
|
|
|
render() {
|
2019-01-08 20:32:08 +08:00
|
|
|
const { timeSeries, timeRange, width, height } = this.props;
|
2018-12-17 20:55:25 +08:00
|
|
|
const { showLines, showBars, showPoints } = this.props.options;
|
|
|
|
|
|
2018-12-24 21:14:06 +08:00
|
|
|
const vmSeries = processTimeSeries({
|
2018-12-17 20:55:25 +08:00
|
|
|
timeSeries: timeSeries,
|
|
|
|
|
nullValueMode: NullValueMode.Ignore,
|
2018-12-24 21:14:06 +08:00
|
|
|
colorPalette: colors,
|
2018-12-17 20:55:25 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Graph
|
|
|
|
|
timeSeries={vmSeries}
|
|
|
|
|
timeRange={timeRange}
|
|
|
|
|
showLines={showLines}
|
|
|
|
|
showPoints={showPoints}
|
|
|
|
|
showBars={showBars}
|
|
|
|
|
width={width}
|
|
|
|
|
height={height}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|