chartjs / chartjs-chart-financial

Chart.js module for charting financial securities
MIT License
721 stars 196 forks source link

Chart complete freeze app on drawing or zoom #72

Open cyberluke opened 4 years ago

cyberluke commented 4 years ago

Hi, it happens also with zoom plugin, so I disabled it to verify and it happens also without zoom.

Am I doing something wrong here? I get json very fast, then it freezes for at least 10s. For more data, it can freeze for minutes even!


            for (const candle of candleResponse.candles) {
                console.log(candle);
                const luxonDate: luxon.DateTime = luxon.DateTime.fromISO(candle.time);
                this.chartLabels.push(luxonDate.toString());
                this.chartData[0].data.push({
                    t: luxonDate.valueOf(),
                    o: candle.mid.o,
                    h: candle.mid.h,
                    l: candle.mid.l,
                    c: candle.mid.c
                });
            }
        });```
benmccann commented 4 years ago

You probably have to call chart.update at some point

I'm not sure if any plugins will work with this chart at the moment because I just upgraded it to use chartjs-3.0.0.alpha and most plugins haven't been updated to work with chart.js 3.0 yet

cyberluke commented 4 years ago

Yes, I work on a commit before 3.0 to make it compatible. So I am on 2.9 and your revision f0c37e1dc24923a02c7793df8a292921db4b46cb.

I found Ionic Youtube video tutorial using your Chart.js and I also use ng4-charts wrapper for Angular, which according to their Github Issues, might have some bottlenecks in comparison with plain Chart.js.

So I was more interested in some best practice how to insert first time data into chart. The additional streaming should be ok.