chartjs / chartjs/chartjs-chart-financial
Trying to make it work with NodeJS and ChartjsNodeCanvas
- Dominant language
- JavaScript
- Stars
- 809
- Forks
- 199
- PR merge metrics
- No merged PRs in 30d
Description
Hello, thank you for the great plugin!
I do:
Git clone https://github.com/chartjs/chartjs-chart-financial/
cd chartjs-chart-financial
npm install
gulp build
As result I get a file in /dist directory and copy it to me NodeJS project folder.
In my NodeJS app I do:
const Chart = require(‘chart.js’)
const ChartFinancial = require(‘./chartjs-chart-financial.js’)
When I run the app I get:
chartjs-chart-financial.js:227
globalOpts.elements.financial = {
TypeError: Cannot set property ‘financial’ of undefined
I have checked content of Chart.defaults and found that .elements is in ‘global’ so I changed
225 const globalOpts = Chart.defaults.global
316 const globalOpts$1 = Chart.defaults.global
401 const globalOpts$2 = Chart.defaults.global
And eventually Error
Chart.defaults.set(‘ohlc’ ...
on line 446
So I changed them to:
446 Chart.defaults.ohlc.datasets.barPercentage = 1.0,
447 Chart.defaults.ohlc.datasets.categoryPercentage = 1.0
Then I got
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'data' of undefined
at CandlestickController.draw (C:\inetpub\github\telegram-stream-trades\chartjs-chart-financial.js:213:32)
So I chagned:
213 const rects = me.getMeta();
That handled all the errors. But still no candles drawn.
So probably the way I initially started is incorrect
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.