Comments (5)
@akshit-dev101 in our case it happened because we use Google Maps as well.
When charts are loaded and then a user goes to GoogleMap screen, the problem you mentioned appears. It happens because google map react library deletes window.google
object on component unmount.
In the same time in the charts library, it is expected that if there is a script on the page, there should be window.google
object. Which never happens, and the library is stuck on the loading state.
from react-google-charts.
@davoam any luck with the solution?
from react-google-charts.
We just work around the problem. This is code inside our component which shows charts. It removes script from the dom and forces the library to load chart again
useLayoutEffect(() => {
if (!window.google) {
const script = document.querySelector('script[src="https://www.gstatic.com/charts/loader.js"]');
const scriptLoaded = script?.getAttribute('data-loaded');
if (script && scriptLoaded) {
script.remove();
}
}
}, []);
I think you need to investigate your case. Probably, there is another reason. You can begin with checking value window.google
in browser console
from react-google-charts.
Currently, I have window.google as shown below, I tried using the code you provide, didn't work, but if I hard refresh the whole page the chart is visible @davoam, also I have the window.object , its not deleted as you said in the first comment.
"charts": {
"loader": {
"VersionSpecific": {}
}
},
"loader": {
"LoadFailure": false
},
"visualization": {
"ModulePath": {},
"Version": "51",
"Locale": "",
"isDebug": false,
"isPseudo": false,
"mapsApiKey": {},
"data": {},
"errors": {
"rV": "google-visualization-errors",
"s6": "google-visualization-errors-",
"v6": "google-visualization-errors:",
"mV": "google-visualization-errors-all-",
"r6": "google-visualization-errors: container is null",
"tia": "background-color: #c00000; color: white; padding: 2px;",
"Qja": "background-color: #fff4c2; color: black; white-space: nowrap; padding: 2px; border: 1px solid black;",
"Sja": "font: normal 0.8em arial,sans-serif; margin-bottom: 5px;",
"qja": "font-size: 1.1em; color: #00c; font-weight: bold; cursor: pointer; padding-left: 10px; color: black;text-align: right; vertical-align: top;"
},
"events": {},
"datautils": {}
}
}`
from react-google-charts.
Sorry, I have no ideas what else may cause the problem. Most likely, in your case, there is another reason. Try setting breakpoints in devtools inside the library code and check what happens.
from react-google-charts.
Related Issues (20)
- Storage size formats
- [Bug]: addOneTimeListener this doesn't seem to be supported?
- [Bug]: Can't seem to get MutationObserver to work inside an event, but it works with the underlying library
- [Bug]: Bar Chart (and Other?) Examples Broken
- [Bug]: No Material UI Support?
- [Bug]: Scatter chart options not recognized (Material)
- Remove deprecated dependency react-scripts
- [Bug]: Diff tooltips prefix option
- [Bug]: Stacked Column Chart - Show Annotation on Bars HOT 1
- [Bug]: ReferenceError: Property 'document' doesn't exist
- [Bug]: sort and page events are not working with Table chart HOT 1
- [Bug]: Geo chart (maybe other) doesn't respect React@18 StrictMode
- [Bug]: Select event is not working in strict mode. HOT 1
- [Bug]: Org Chart does not render label on top node HOT 1
- [Bug]: Charts with spreadsheets does not work
- [Bug]: can't only show lable in tooltip
- [Bug]: ready event executed once if we have multiple table
- [Bug]: Incorrect Bar chart in react-google-charts HOT 2
- [Bug]: this.Ay.xq is not a function
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-google-charts.