Skip to content

Instantly share code, notes, and snippets.

@hadnazzar
Created July 1, 2020 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hadnazzar/091baa73149d220860581c3ab4e1bded to your computer and use it in GitHub Desktop.
Save hadnazzar/091baa73149d220860581c3ab4e1bded to your computer and use it in GitHub Desktop.
import React from 'react';
import {HorizontalBar} from 'react-chartjs-2';
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June'],
datasets: [
{
label: 'Dataset',
backgroundColor: 'rgba(255,99,132,0.2)',
borderColor: 'rgb(11,227,210)',
borderWidth: 1,
hoverBackgroundColor: 'rgba(255,0,54,0.4)',
hoverBorderColor: 'rgb(0,88,101)',
data: [65, 59, 80, 81, 56, 55, 40]
}
]
};
export default () => (
<div>
<h2>Horizontal Bar Example</h2>
<HorizontalBar
data={data}
width={400}
height={400}
/>
</div>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment