Open domoskanonos opened 2 years ago
this lines cause the error (TypeError: Cannot read property 'prototype' of undefined) :
isForType(type) { return Object.prototype.isPrototypeOf.call(this.type.prototype, type.prototype); }
type is undefined
I have the same error. Did you fix it?
no :-( , i change library to https://apexcharts.com/ this works better for me...
I got it working, you have to use the fork from SeanSobey (https://github.com/SeanSobey/ChartjsNodeCanvas). You have to require it in your file and also a date adapter.
Hi, i try to use your library without browser (pure nodejs/typescript). There ist a problem in usage discussed here:
https://github.com/SeanSobey/ChartjsNodeCanvas/issues/47
I got this error:
return Object.prototype.isPrototypeOf.call(this.type.prototype, type.prototype); ^
TypeError: Cannot read property 'prototype' of undefined at TypedRegistry.isForType (E:_dev\vhs\git\mmproject\node_modules\chart.js\dist\chart.js:5980:74) at Registry._getRegistryForType (E:_dev\vhs\git\mmproject\node_modules\chart.js\dist\chart.js:6123:15) at E:_dev\vhs\git\mmproject\node_modules\chart.js\dist\chart.js:6103:41 at Array.forEach ()
at Registry._each (E:_dev\vhs\git\mmproject\node_modules\chart.js\dist\chart.js:6102:15)
at Registry.add (E:_dev\vhs\git\mmproject\node_modules\chart.js\dist\chart.js:6060:10)
at Function.value [as register] (E:_dev\vhs\git\mmproject\node_modules\chart.js\dist\chart.js:7357:16)
at Object. (E:_dev\vhs\git\mmproject\lib\index.js:22:16)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
my node dependencys:
"dependencies": { "chartjs-chart-financial": "0.1.1", "@babel/core": "7.16.0", "@babel/preset-env": "7.16.4", "@babel/preset-typescript": "7.16.0", "@types/chart.js": "2.9.34", "@types/jest": "27.0.3", "@types/jsdom": "16.2.13", "babel-jest": "27.4.4", "canvas": "2.8.0", "chart.js": "3.6.2", "dotenv": "10.0.0", "ftx-api": "1.0.19", "jest": "27.4.3", "jsdom": "19.0.0", "npm-check-updates": "12.0.3", "prettier": "2.5.1", "trading-signals": "3.2.0", "ts-jest": "27.1.0", "ts-loader": "9.2.6", "typescript": "4.5.4" }
try to register candlestick Controller
import { OhlcElement, OhlcController, CandlestickElement, CandlestickController } from 'chartjs-chart-financial' import Chart from 'chart.js/auto' // Easy way of importing everything
Chart.register(OhlcElement, OhlcController, CandlestickElement, CandlestickController)
please help me :-)