-1

I have recently downloaded the trial version of ChartIQ SDK from here and it is working fine on a React project. But when i switched to Next.js, some features are not usable anymore. I'm facing three problems on my Next.js project.

  1. CIQ.Studies is undefined so I cannot add studies to my chart.
  2. Also stxx.changeVectorType is undefined so I cannot use drawing tools.
  3. And only candleSticks , mountain and line types are available.

I am using the same chartiq-8.3.0.tgz file both on my React and Next projects and it is all working fine on React but I am experiencing what I just said on Next.js. Can anyone help with me with possible solutions on that?

  • Does this help answer your question: [Why do I get ReferenceError: RTCPeerConnection is not defined in Next.js?](https://stackoverflow.com/a/68846372/1870780)? Make sure you call ChartIQ methods within a `useEffect` so it only gets called on the client-side. – juliomalves Sep 05 '21 at 20:10
  • 1
    @juliomalves hi thanks for your reply. but this was no exactly the problem. I contacted chartIQ tech support and the solution was to include advance.js file instead of chartiq.js – Mehdi Hamze Sep 16 '21 at 07:58

2 Answers2

0

Nextjs load libraries on server side, where CHARTIQ is client library that works with document object on the browser. You need to import the libraries with SSR (Server Side Rendering) disabled

doc : https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr

Chemi Adel
  • 1,964
  • 1
  • 10
  • 18
0

I contacted chartIQ technical support. And the solution is to include advance.js instead of chartiq.js