Last active
December 9, 2022 05:57
-
-
Save JenniferFuBook/1ad88abf9288943fca3b39e7a5575269 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 Highcharts from 'highcharts'; | |
import HighchartsReact from 'highcharts-react-official'; | |
import _ from 'lodash'; | |
import './App.css'; | |
import HighchartsExporting from 'highcharts/modules/exporting'; | |
HighchartsExporting(Highcharts); | |
const getOptions = (type) => ({ | |
chart: { | |
type, | |
width: 500, | |
height: 300, | |
}, | |
title: { | |
text: _.startCase(`${type} chart`), | |
}, | |
yAxis: { | |
title: { | |
text: 'Values', | |
}, | |
}, | |
series: [ | |
{ | |
data: [1, 2, 1, 4, 3, 6], | |
}, | |
{ | |
data: [2, 7, 0, 4, 6, 2], | |
}, | |
], | |
credits: { | |
enabled: false, | |
}, | |
}); | |
function App() { | |
return ( | |
<div> | |
<HighchartsReact highcharts={Highcharts} options={getOptions('line')} /> | |
<HighchartsReact highcharts={Highcharts} options={getOptions('spline')} /> | |
<HighchartsReact highcharts={Highcharts} options={getOptions('area')} /> | |
<HighchartsReact highcharts={Highcharts} options={getOptions('areaspline')} /> | |
<HighchartsReact highcharts={Highcharts} options={getOptions('column')} /> | |
<HighchartsReact highcharts={Highcharts} options={getOptions('bar')} /> | |
<HighchartsReact highcharts={Highcharts} options={getOptions('pie')} /> | |
<HighchartsReact highcharts={Highcharts} options={getOptions('scatter')} /> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment