Created
December 23, 2022 04:19
-
-
Save JenniferFuBook/0573e92e4c5e9dca1f33fafb3a02c601 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 HighchartsNetworkGraph from 'highcharts/modules/networkgraph'; | |
| HighchartsExporting(Highcharts); | |
| HighchartsAccessibility(Highcharts); | |
| HighchartsNetworkGraph(Highcharts); | |
| const getOptions = (type) => ({ | |
| chart: { | |
| type, | |
| width: 800, | |
| height: 600, | |
| }, | |
| title: { | |
| text: _.startCase(`${type} chart`), | |
| }, | |
| series: [ | |
| { | |
| keys: ['from', 'to'], | |
| dataLabels: { | |
| enabled: true, | |
| linkFormat: '', | |
| }, | |
| data: [ | |
| ['A', 'B'], | |
| ['A', 'C'], | |
| ['A', 'D'], | |
| ['B', 'C'], | |
| ['C', 'D'], | |
| ['E', 'D'], | |
| ['E', 'F'], | |
| ], | |
| }, | |
| ], | |
| credits: { | |
| enabled: false, | |
| }, | |
| }); | |
| function App() { | |
| return ( | |
| <HighchartsReact highcharts={Highcharts} options={getOptions('networkgraph')} | |
| /> | |
| ); | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment