1

I googled and they said I need highstock module, but I don't want use <script type="text/javascript" src="http://code.highcharts.com/stock/highstock.js"></script> (I don't know where to import it..) is there a react way to import highstock module?

I have tried this:

import Highcharts from 'highcharts/highstock';
import HighchartsReact from 'highcharts-react-official';
import HC_more from 'highcharts/highcharts-more';
    <HighchartsReact
                    allowChartUpdate={true}
                    updateArgs={[true, true, true]}
                    hicharts={Highcharts}
                    options={chartConfig}
                    ref={chart}
                ></HighchartsReact>

and the chartConfig:

const chartOption = {
    chart: {
      type: "bar"
    },
    scrollbar: {
      enabled: true
    },
    xAxis: {
      scrollbar: {
        enabled: true
      },
      min: 0,
      max: 2,
    },
    series: [
      {
        name: "Browsers",
        colorByPoint: true,
        data: chartData
      }
    ]
  };

it just not work for me . here is the demo: https://stackblitz.com/edit/react-highchart-jjzjx118

jjzjx118_2
  • 419
  • 7
  • 23
  • Your title and your question is entirely different, what are you really looking for – Akhil Aravind Jan 20 '20 at 11:03
  • sorry, I am looking for the way enable scroll bar with react-highcharts, I have tried some way but not work. I'm not sure the problem is about import highstock module or else. – jjzjx118_2 Jan 20 '20 at 15:15

1 Answers1

2

You have already imported Highcharts here:

import Highcharts from 'highcharts/highstock';

You should be able to enable the scrollbar in this way:

scrollbar: {
  enabled: true
}

Live demo: https://codesandbox.io/s/highcharts-react-demo-2dwcc

ppotaczek
  • 36,341
  • 2
  • 14
  • 24