Created
December 8, 2022 05:56
-
-
Save JenniferFuBook/78a03721bf6fd3b0ec24089f18accc78 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'; | |
| 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], | |
| }, | |
| ], | |
| }); | |
| 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