Skip to content

Instantly share code, notes, and snippets.

@gpDA
Created May 3, 2019 01:49
Show Gist options
  • Save gpDA/c032706bbc1ed8da9d65cfb7d0ff5819 to your computer and use it in GitHub Desktop.
Save gpDA/c032706bbc1ed8da9d65cfb7d0ff5819 to your computer and use it in GitHub Desktop.
import {Doughnut, Line} from 'react-chartjs-2';
import ReactHeatmap from 'react-heatmap-grid';
...
//Doughnut
<Doughnut
data={this.state.piechartData}
width={1000}
height={400}
options={{
maintainAspectRatio: false,
title:{
display: true,
text: 'Number of tweets by NYU schools',
fontSize: 15
},
legend:{
display: true,
}
}}
/>
//ReactHeatmap
<ReactHeatmap
xLabels={this.state.heatmapData.xLabels}
yLabels={this.state.heatmapData.yLabels}
yLabelTextAlign={"right"}
xLabelsLocation={"bottom"}
onMouseEnter={() => alert(`hi`)}
cellStyle={(background, value, min, max, data, x, y) => ({
background: `rgb(87, 6, 140, ${1 - (max - value) / (max - min)})`,
fontSize: "10px",
})}
cellRender={value => value && `${value}`}
data={this.state.heatmapData.data}
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment