Skip to content

Instantly share code, notes, and snippets.

@JenniferFuBook
Created December 23, 2022 04:19
Show Gist options
  • Save JenniferFuBook/0573e92e4c5e9dca1f33fafb3a02c601 to your computer and use it in GitHub Desktop.
Save JenniferFuBook/0573e92e4c5e9dca1f33fafb3a02c601 to your computer and use it in GitHub Desktop.
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