chartjs / chartjs-chart-financial

Chart.js module for charting financial securities
MIT License
725 stars 197 forks source link

Candles degrade into lines on some data #47

Open Pinelab opened 5 years ago

Pinelab commented 5 years ago

Browser Google Chrome 71.0.3578.98 download download2

In MS Edge on Windows 10 the similar full test folder in app. below::

Test.zip

benmccann commented 5 years ago

Thanks for sharing this! I'm pretty busy at the moment working on fixes and improvements in the main Chart.js repo in order to improve the finance chart, so it may be quite awhile before I get a chance to look at this. If you're able to track down the problem I'd be happy to help in reviewing any fixes

benmccann commented 5 years ago

@Pinelab can you describe what the difference between the first and second charts are? I'm not sure why it'd work on the second, but not the first

FLYBYME commented 4 years ago

I seem to be having the same problem.

graph

cyberluke commented 4 years ago

I have same problem.

FelixTrulsson commented 4 years ago

This occurred in my app when I had multiple dataset entries with identical time value. End result being the horizontal bar size is clamped to 0 as Chart.js attempts to calculate the geometry. Filter for unique time / x values resolved issue.

ewmailing commented 2 years ago

I have a similar problem, but with some additional criteria.

I have a chart with 2148 bars (can be thought of as 8 years of daily stock data). Obviously, with so much data, the bars will be small when drawing everything to fit. So this part is acceptable. And they do not look like single lines at this point, which is good.

However, I am also using the zoom plugin so I can zoom in to user selected parts of the graph. When zooming in, things start looking better, up until a certain point. Things start looking good zooming in to around 3-6 months of data.

But once you zoom in to around less than 1.5 months worth of data, the bars then degrade into single vertical lines.

Unlike the post above, I do not believe there are any problems with my dataset, such as identical time values. I am able to use the parsing:false option for my graphs and get the same results either way.

UPDATE: If I use a substantially smaller data set, I can reproduce this problem if I zoom in really, really close. For example, if I take the above data set, and then delete everything except say the first 70 elements, the graph seems to behaves fine. I can zoom in close that I can get a single fat bar on my screen. But if I really push it, and zoom in even further where I select a range that is less than that width of that fat bar, the bar degrades into a single vertical line.