taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

Add or remove curves using Checkbox #1153

Closed hayg25 closed 3 years ago

hayg25 commented 3 years ago

Hi everyone, is there a way to add or remove curves on TaurusTrend by using for example a TaurusValueCheckBox.

thanks

cpascual commented 3 years ago

Hi, first, just to be able to be more precise, can you specify if you are talking about the qwt5 (old implementation) or the pyqtgraph based TaurusTrend?

Apart from that, you mention a TaurusValueCheckBox, but I do not see how that precise widget can be used here (a TaurusValueCheckBox is used to write the value of a boolean taurus attribute). AFAICT, what you probably want is a pure Qt QCheckBox. For this you should create your own subclass that stores the curve model name and connects its stateChanged(or toggled) signal to a method that adds/removes that curve from the trend (or hides/shows it, whatever you prefer).

If you are using the qwt5 trend , a similar thing is already implemented by clicking on the legend (clicking a curve in the legend toggles it between Y1 axis, Y2 axis and hidden). In the new taurus_pyqtgraph application this is not yet implemented, but it has been already asked, so it could be done as well

hayg25 commented 3 years ago

Hi @cpascual, thanks for your answer. Yes I realized after my post that clicking on the legend works fine and that's exactly what I need. So nothing to develop there :) one more question : I am actually using qwt5 TaurusTrend. Do you see advantages on using pyqtgraph based taurustrend ? same question for the other plotting (images, etc) Many thanks !

cpascual commented 3 years ago

I am glad to hear that what is already implemented works for your use case.

Regarding the qwt5 vs pyqtgraph implementations:

In conclusion, my advice is to test replacing your old plots with the newer implementation, and unless you find some blocker issue with them, use them.