Skip to content

Instantly share code, notes, and snippets.

@sshh12
Created July 8, 2020 00:11
Show Gist options
  • Save sshh12/e45ed870ea3a9e5af36cb1635a787787 to your computer and use it in GitHub Desktop.
Save sshh12/e45ed870ea3a9e5af36cb1635a787787 to your computer and use it in GitHub Desktop.
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