-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
40 lines (32 loc) · 1023 Bytes
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React, { Component, useMemo } from "react";
import "./App.css";
import { REPLReact } from "./REPLReact";
// this is an example to bundle SQL Frames directly into the app
// Destructuring assignment of the exported namespaces
import { sqlframes } from '@sqlframes/repl-app';
import SQLFramesComponent from "./SQLFramesComponent";
// All the top level classes and objects exported in the namespaces
const { DataFrame, SQL, Time, View } = sqlframes;
class App extends Component{
render(){
return <REPLReact/>
}
}
const ChartApp = () => {
const [df,chart] = useMemo(() => {
const df = DataFrame.fromURL('https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv');
const { groupBy, where: { eq }, agg: { count } } = SQL;
const gdf = df.gdf(groupBy('type'));
return [df,gdf.chart.bar('type','Count')
.resize(600,400)
.svg()];
},[]);
return (
<>
<SQLFramesComponent value={chart}/>
<SQLFramesComponent value={df}/>
</>
)
}
export default App;
export { ChartApp };