ngfelixl / nodeplotlib

NodeJS plotting library for JavaScript and TypeScript. On top of plotly.js. Inspired by matplotlib.
https://www.npmjs.com/package/nodeplotlib
MIT License
195 stars 24 forks source link

feat: Candlesticks #22

Closed magicjase11 closed 3 years ago

magicjase11 commented 4 years ago

Hi, Will this support candlesticks?

https://plot.ly/javascript/candlestick-charts/

Thanks!

ngfelixl commented 4 years ago

Hi @magicjase11, the latest nodeplotlib version uses plotly 1.44.4 which supports candlesticks, see changelog. So, yes, you should be able to use candlestick plots.

Let me know if you have any issues! Cheers!

magicjase11 commented 4 years ago

hi @ngfelixl thanks for the reply,

after some investigation, it seems that open, close, high and low are missing from the PlotData Interface (src/models/plotly.js/index.d.ts) - so typescript throws an error that those attributes don't exist in the Plot partial.

I tried fixing it myself by adding them in (and it works), but the plotly.js file is git ignored so I can't actually make a merge request for any of those changes?

Not sure why that file would be git ignored?

Thanks.

ngfelixl commented 4 years ago

Hi @magicjase11 thanks for the investigation! Currently the scripts are copied over from the node_modules directly from the plotly.js installation. If you have a look in the scripts/prepare.js file there you can see all the copies which are made. This script executes with the npm prepare action.

In this way no "custom" plotly files are used and they are directly used from the plotly npm package. For sure this is not the best solution. If you have a refactoring idea, you are absolutely welcome!

magicjase11 commented 4 years ago

so I guess the issue is with the typings library then :(

What if you extended the interface with another interface rather than copy them in (then import your extended interface) - like an override, if that's even possible?

That way it would remain up to date with the node_modules version and you could extend it yourself (although quick fixing bugs like this would still get messy most likely)

anyway, thanks for the help :)

hesa2020 commented 4 years ago

+1 on that one, i would love being able to draw some candlesticks and some lines at the same time.

Right now im looking for an alternative.

ngfelixl commented 3 years ago

@hesa2020 @magicjase11 I've implemented refactorings for nodeplotlib and updated the plotly version. It now supports candlesticks.

The following screenshot uses the first plot script from https://plotly.com/javascript/candlestick-charts/ with nodeplotlib.

Screenshot 2021-01-05 at 15 27 09