Created
July 8, 2020 00:11
-
-
Save sshh12/e45ed870ea3a9e5af36cb1635a787787 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { ResponsiveLine } from '@nivo/line' | |
import logo from './logo.svg'; | |
import './App.css'; | |
let data = require('./data.json') | |
function App() { | |
return ( | |
<div className="App"> | |
<Visualization title="My Vis"/> | |
</div> | |
); | |
} | |
function Visualization({ title }) { | |
let points = []; | |
for (let item of data) { | |
points.push({ x: item.DATE, y: item.A191RL1Q225SBEA }); | |
} | |
let visData = [ | |
{ | |
id: "us-gdp", | |
data: points, | |
}, | |
]; | |
console.log(visData); | |
return ( | |
<div style={{width: window.innerWidth + 'px', height: window.innerHeight + 'px'}}> | |
<h2>{title}</h2> | |
<ResponsiveLine | |
enableGridX={false} | |
curve={'natural'} | |
useMesh={true} | |
enablePoints={false} | |
data={visData} | |
/> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment