import * as React from 'react' import DateFormatter from '../helper/DateFormatter' import { default as ReactResizeDetector } from 'react-resize-detector' import { Theme } from '@material-ui/core' import { withTheme } from '@material-ui/styles' import 'react-vis/dist/style.css' const { XYPlot, LineMarkSeries, Hint, XAxis, YAxis, HorizontalGridLines } = require('react-vis') const abbreviate = require('number-abbreviate') interface Props { data: Array<{ x: number; y: number }> theme: Theme } interface Stats { width: number value?: any } class PlotHistory extends React.Component { constructor(props: Props) { super(props) this.state = { width: 300 } } private resize = (width: number, height: number) => { this.setState({ width: width - 12 }) } private hintFormatter = (point: any) => { return [ { title: Time, value: }, { title: Value, value: point.y }, ] } private _forgetValue = () => { this.setState({ value: undefined, }) } private _rememberValue = (value: any) => { this.setState({ value }) } public render() { const data = this.props.data return (
abbreviate(num)} /> {this.state.value ? : null}
) } } export default withTheme(PlotHistory)