1- import React from "react" ;
2- import { AppBar , Toolbar , Typography , CssBaseline , withStyles } from "@material-ui/core" ;
3- import { generateRandomData } from " ../utils" ;
4- import Header from "./Header" ;
5- import { XYDataPoint } from "../../../../src/types" ;
6- import Chart from "./Chart" ;
7- import { DownsamplingMethod } from "../../types" ;
1+ import { AppBar , CssBaseline , Toolbar , Typography , withStyles } from '@material-ui/core' ;
2+ import { DownsamplingMethod } from '../../types' ;
3+ import { XYDataPoint } from ' ../../../../src/types' ;
4+ import { generateRandomData } from '../utils' ;
5+ import Chart from './Chart' ;
6+ import Header from './Header' ;
7+ import React from 'react' ;
88
99const style = theme => ( {
1010 chart : {
11- padding : theme . spacing . unit * 2
12- }
11+ padding : theme . spacing . unit * 2 ,
12+ } ,
1313} ) ;
1414
1515export interface AppProps {
1616 classes : {
17- chart : string
18- }
17+ chart : string ;
18+ } ;
1919}
2020
2121export interface AppState {
@@ -37,54 +37,59 @@ class App extends React.Component<AppProps, AppState> {
3737 numConfirmedRawDataPoints : 1000 ,
3838 numDownsampledDataPoints : 100 ,
3939 numConfirmedDownsampledDataPoints : 100 ,
40- data : generateRandomData ( 1000 )
40+ data : generateRandomData ( 1000 ) ,
4141 } ;
4242 }
4343
44- private onActiveDownsamplingMethodsChange = ( activeDownsamplingMethods : DownsamplingMethod [ ] ) => this . setState ( { activeDownsamplingMethods } )
44+ private onActiveDownsamplingMethodsChange = ( activeDownsamplingMethods : DownsamplingMethod [ ] ) =>
45+ this . setState ( { activeDownsamplingMethods } ) ;
4546
46- private onNumRawDataPointsChange = ( numRawDataPoints : number ) : void => this . setState ( ( ) => ( { numRawDataPoints } ) )
47+ private onNumRawDataPointsChange = ( numRawDataPoints : number ) : void => this . setState ( ( ) => ( { numRawDataPoints } ) ) ;
4748
4849 private onNumRawDataPointsConfirm = ( ) : void => {
4950 const numConfirmedRawDataPoints = this . state . numRawDataPoints ;
5051 const data : XYDataPoint [ ] = generateRandomData ( numConfirmedRawDataPoints ) ;
5152
5253 this . setState ( ( ) => ( { data, numConfirmedRawDataPoints } ) ) ;
53- }
54+ } ;
5455
55- private onNumDownsampledDataPointsChange = ( numDownsampledDataPoints : number ) : void => this . setState ( { numDownsampledDataPoints } ) ;
56+ private onNumDownsampledDataPointsChange = ( numDownsampledDataPoints : number ) : void =>
57+ this . setState ( { numDownsampledDataPoints } ) ;
5658
5759 render ( ) : React . ReactNode {
58- return < React . Fragment >
59- < CssBaseline />
60+ return (
61+ < React . Fragment >
62+ < CssBaseline />
6063
61- < AppBar position = "static" color = "default" >
62- < Toolbar >
63- < Typography variant = "title" color = "inherit" >
64- Downsample
65- </ Typography >
66- </ Toolbar >
67- </ AppBar >
64+ < AppBar position = "static" color = "default" >
65+ < Toolbar >
66+ < Typography variant = "title" color = "inherit" >
67+ Downsample
68+ </ Typography >
69+ </ Toolbar >
70+ </ AppBar >
6871
69- < Typography component = "div" >
70- < Header
71- numRawDataPoints = { this . state . numRawDataPoints }
72- numDownsampledDataPoints = { this . state . numDownsampledDataPoints }
73- onNumRawDataPointsChange = { this . onNumRawDataPointsChange }
74- onNumDownsampledDataPointsChange = { this . onNumDownsampledDataPointsChange }
75- onNumRawDataPointsConfirm = { this . onNumRawDataPointsConfirm }
76- />
77-
78- < div className = { this . props . classes . chart } >
79- < Chart
80- activeDownsamplingMethods = { this . state . activeDownsamplingMethods }
81- data = { this . state . data }
72+ < Typography component = "div" >
73+ < Header
74+ numRawDataPoints = { this . state . numRawDataPoints }
8275 numDownsampledDataPoints = { this . state . numDownsampledDataPoints }
83- onActiveDownsamplingMethodsChange = { this . onActiveDownsamplingMethodsChange } />
84- </ div >
85- </ Typography >
86- </ React . Fragment > ;
76+ onNumRawDataPointsChange = { this . onNumRawDataPointsChange }
77+ onNumDownsampledDataPointsChange = { this . onNumDownsampledDataPointsChange }
78+ onNumRawDataPointsConfirm = { this . onNumRawDataPointsConfirm }
79+ />
80+
81+ < div className = { this . props . classes . chart } >
82+ < Chart
83+ activeDownsamplingMethods = { this . state . activeDownsamplingMethods }
84+ data = { this . state . data }
85+ numDownsampledDataPoints = { this . state . numDownsampledDataPoints }
86+ onActiveDownsamplingMethodsChange = { this . onActiveDownsamplingMethodsChange }
87+ />
88+ </ div >
89+ </ Typography >
90+ </ React . Fragment >
91+ ) ;
8792 }
8893}
8994
90- export default withStyles ( style ) ( App ) ;
95+ export default withStyles ( style ) ( App ) ;
0 commit comments