highfestiva/finplot

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

alexgiul opened this issue · 2 comments

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

  • I realize finplot is not a web lib. (Hint: it's native!)
  • I've read the snippets and not found what I'm looking for.
  • I've searched for any related issues and avoided creating a duplicate issue.
  • I've updated finplot (pip install -U finplot).
  • I've supplied the required data to run my code below.

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:

  • in the case of fplt.add_rect is it possible to have it transparent and with a border? Actually, when I draw it, the rectangle is filled.

image

  • how can I add a signal in order to open a contextual menu on the add_rect feature?

Thanks a lot for the help,
Alessandro

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.

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