Comments (8)
same here, my next.js complains about this
ReferenceError: window is not defined
at Object.<anonymous> (Z:\xx\StockDashboard\next\node_modules\hammerjs\hammer.js:2643:4)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Z:\xx\StockDashboard\next\node_modules\chartjs-plugin-zoom\dist\chartjs-plugin-zoom.js:8:110
at Object.<anonymous> (Z:\xx\StockDashboard\next\node_modules\chartjs-plugin-zoom\dist\chartjs-plugin-zoom.js:11:3)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
from react-chartjs-2.
@tbvjwodn2 What fixed it for me in NextJS at least(So maybe even if you don't use NextJS some stuff on that page can be useful) is I had to import the parent component that contained the chart dynamically
import dynamic from 'next/dynamic'
const SidePanel = dynamic(() => import('./components/sidePanel'), { ssr: false });
That side panel component has my line chart chart from reach chart.
from react-chartjs-2.
Hey @mira-thakkar,
Thanks for reaching out.
When doing server rendering there is no window
available thus you are unable to render them server side.
The error you are getting is directly from the chart.js library, unfortunately as per my knowledge there isn't much we can do..
from react-chartjs-2.
If you manage to find a workaround please do post it to this issue so other people will be able to reference it.
Closing till then.
Thank you for reporting.
from react-chartjs-2.
This is horrible but it works.. reactjs/react-chartjs#57
from react-chartjs-2.
This error is happening for my next.js application, did anybody got a solution for this?
from react-chartjs-2.
@tbvjwodn2 What fixed it for me in NextJS at least(So maybe even if you don't use NextJS some stuff on that page can be useful) is I had to import the parent component that contained the chart dynamically
import dynamic from 'next/dynamic' const SidePanel = dynamic(() => import('./components/sidePanel'), { ssr: false });
That side panel component has my line chart chart from reach chart.
Thank you for the help! :)
from react-chartjs-2.
@tbvjwodn2 What fixed it for me in NextJS at least(So maybe even if you don't use NextJS some stuff on that page can be useful) is I had to import the parent component that contained the chart dynamically
import dynamic from 'next/dynamic' const SidePanel = dynamic(() => import('./components/sidePanel'), { ssr: false });
That side panel component has my line chart chart from reach chart.
This works perfectly!
from react-chartjs-2.
Related Issues (20)
- [Bug]: Unnecessary whitespace in tooltip visible only in Firefox on Windows
- [Bug]: TypeError: Cannot read properties of undefined (reading '_adapters') HOT 2
- [Bug]: README.md. QuickStart HOT 1
- Application of observer design pattern in the file stories/chart.tsx
- Implementation of Abstract Factory design pattern in charts
- Add title for each axis
- [Bug]: Line disappears when calling zoomScale() multiple times HOT 3
- [Bug]: Code sandbox for Scatter Chart on example website not working
- [Bug]: re-rendering chart component that is responsive causes computation bugs
- It would be great if we can add text inside the bubble in bubble chart. HOT 1
- [Bug]: type issue with options.plugins.legend.position and options.plugins.legend.align HOT 3
- Implementation with chartjs-plugin-annotation
- [Bug]: A undifined canvas error occuring in react-native HOT 1
- [Bug]: using <Chart> in production builds has a chart type error HOT 1
- [Bug]: Background color for chart is not working
- HTML Legend Support
- [Bug]: The canvas created in headless mode looks distorted
- [Bug]: Chart shakes during resize
- [Bug]: Remembering options at charts based on same element
- [Bug]: canβt resolve HOT 1
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-chartjs-2.