grafana/public/app/plugins/panel/graph2/GraphPanel.tsx

36 lines
908 B
TypeScript
Raw Normal View History

2018-12-17 20:55:25 +08:00
// Libraries
import _ from 'lodash';
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> {}
export class GraphPanel extends PureComponent<Props> {
2018-12-17 20:55:25 +08:00
render() {
const { timeSeries, timeRange, width, height } = this.props;
2018-12-17 20:55:25 +08:00
const { showLines, showBars, showPoints } = this.props.options;
const vmSeries = processTimeSeries({
2018-12-17 20:55:25 +08:00
timeSeries: timeSeries,
nullValueMode: NullValueMode.Ignore,
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}
/>
);
}
}