Last active
December 16, 2022 05:36
-
-
Save JenniferFuBook/fdc4bf6d6e98f35665ad317389be97c9 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 HighchartsExporting from 'highcharts/modules/exporting'; | |
import HighchartsAccessibility from 'highcharts/modules/accessibility'; | |
import HighchartsStreamgraph from 'highcharts/modules/streamgraph'; | |
HighchartsExporting(Highcharts); | |
HighchartsAccessibility(Highcharts); | |
HighchartsStreamgraph(Highcharts); | |
const getOptions = (type) => ({ | |
chart: { | |
type, | |
width: 800, | |
height: 600, | |
}, | |
title: { | |
text: _.startCase(`${type} chart`), | |
}, | |
xAxis: { | |
categories: ['A', 'B', 'C', 'D', 'E', 'F'], | |
}, | |
series: [ | |
{ | |
name: 'Group 1', | |
data: [0, 3, 5, 5, 6, 2], | |
}, | |
{ | |
name: 'Group 2', | |
data: [0, 1, 3, 6, 1, 9], | |
}, | |
{ | |
name: 'Group 3', | |
data: [1, 2, 5, 4, 9, 11], | |
}, | |
{ | |
name: 'Group 4', | |
data: [1, 3, 2, 8, 7, 5], | |
}, | |
], | |
credits: { | |
enabled: false, | |
}, | |
}); | |
function App() { | |
return ( | |
<HighchartsReact highcharts={Highcharts} options={getOptions('streamgraph')} /> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment