Comments (22)
I had been struggling with this issue all day, and 5 minutes after posting my issue i found the solution.
For other who might have the same problem, the solution is to us bundled version of highstock and non bundled version of highcharts. The non bundled version, expects highcharts to already be loaded
var Highstocks = require('react-highcharts/dist/bundle/highstock');
var Highcharts = require('react-highcharts');
from react-highcharts.
Thanks Mads, feel free to PR a readme update if you feel this info belongs there.
from react-highcharts.
@mspe87 Thanks for this, although I seem to get this error
Error: Starting with version 3 of react-highcharts, Highcharts is not bundled by default. use "react-highcharts/bundle/highcharts" instead, or include highcharts
from react-highcharts.
@joshhornby That was the same problem i had. You need to use it like this:
var Highstocks = require('react-highcharts/dist/bundle/highstock');
var Highcharts = require('react-highcharts');
And not like this:
var Highstock = require('react-highcharts/dist/bundle/highstock');
var Highcharts = require('react-highcharts/dist/bundle/highcharts');
from react-highcharts.
@mspe87 I was doing that, I have re-run my build and the errors seem to have code away. But of been webpack playing up!
from react-highcharts.
@mspe87 I can actually confirm that this isn't a webpack caching issue. I still get the error when using the packages like you stated.
from react-highcharts.
Which version are you using?
I got rid of the dist part in the latest version
from react-highcharts.
I am using version 5.0.2
. I still see the dist
directory in my node modules
from react-highcharts.
Can you show me how exactly your code looks like?
from react-highcharts.
Highchart
render() {
let Highcharts = require('react-highcharts');
Highcharts.Highcharts.setOptions({
global: {
useUTC: false
}
});
return (
<div>
<Highcharts config={this.props.chartData} />
</div>
);
};
Highstock
render() {
let Highstock = require('react-highcharts/dist/bundle/highstock');
Highstock.Highcharts.setOptions({
global: {
useUTC: false
}
});
return (
<div>
<Highstock config={this.props.chartData} />
</div>
);
};
}
from react-highcharts.
That was fast. Which exact error do you get?
What's the stack trace?
from react-highcharts.
The odd thing is I don't get the error on every render.
from react-highcharts.
I think the case here is that require('react-highcharts/dist/bundle/highstock');
should be required before require('react-highcharts');
, because it's the one who's getting the Highcharts in the code base.
Also try getting rid of the dist part, it should work without it.
from react-highcharts.
How would this work with two separate files though? This might explain why it sometimes errors and one chart may load before another?
from react-highcharts.
Do require('react-highcharts/dist/bundle/highstock');
somewhere on the top level of the app.
That should fix it.
from react-highcharts.
Doing this throws Highcharts error #16: www.highcharts.com/errors/16
from react-highcharts.
Use non-bundled highstock in Highstock
file
from react-highcharts.
So require('react-highcharts/highstock');
from react-highcharts.
Yes, not on top level, but in highstock file
from react-highcharts.
Adding const Highcharts = require('react-highcharts/bundle/highstock');
at the top of the file seems to have fixed this. Thanks for the help @kirjs I will continue testing tomorrow. Can we leave this issue open for next 24 hours until I can 100% confirm its fixed? If so I will PR the docs.
from react-highcharts.
Sure, this seems like a good place for the docs.
Also this makes me want to get rid of bundles and just better document including highcharts release in the bundle in the future.
from react-highcharts.
I'll close it, feel free to reopen if needed
from react-highcharts.
Related Issues (20)
- Questions about copyright HOT 1
- [Bug]: multi-data & category => xAxis is dislocation HOT 1
- Update an issue template to use stackblitz for an example HOT 1
- Update all the dependencies HOT 2
- Highcharts export functionality HOT 1
- react 16.8 hooks addPlotLine not work?
- Why opposite:true doesn't work in ReactHighstock?
- Demo project doesn't work.
- outside: true on Tooltip - Error when trying to trigger the tooltip manually
- Upgrade Highcharts - Cross Site Scripting vuln HOT 3
- HighCharts events not getting triggered
- Tooltip.positioner function not working
- cannot use boost HOT 1
- Chart not resizing with container
- All Bars are starting from 0 value in Stacked bar when render happens
- npm vulnerability issue Cross-site Scripting (XSS), need to upgrade highcharts dependency
- Cannot read property 'series' of undefined
- Wrong ordering with temporal data
- Can we do reset on navigator when we switch between custom zoom buttons.
- Incorrect Date Display on Highchart ReactHighstock X-Axis.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-highcharts.