highfestiva / finplot

Performant and effortless finance plotting for Python
MIT License
935 stars 187 forks source link

[Question] how to code these features on fplt.add_rect #454

Closed alexgiul closed 1 year ago

alexgiul commented 1 year ago

Requirements (place an x in each of the [ ])**

Hi Sir, and thanks for this great library!!!

I am playing a lot with and I am here to ask how can I code these features:

image

Thanks a lot for the help, Alessandro

highfestiva commented 1 year ago

You could set the alpha (transparency) color using CSS' 8-digit hex codes. The border you set with the pen. Like so:

rect = fplt.add_rect((x1, y1), (x2, y2), color='#8c85', interactive=True)
rect.setPen(fplt._makepen('#000'))

Opening a context-sensitive menu is a bit more involved, and I don't know how. finplot is built on top of pyqtgraph. Go over to their support page and ask how to do that on an instance of RectROI (which is the base class for FinRect, which is what is rendered in finplot). If this all sounds too complicated, I'm afraid having some kind of menu system in finplot might be too.

alexgiul commented 1 year ago

Thanks a lot, @highfestiva , I will try to work with RectROI and if I find a solution, I ll put it here just in case anyone needs it