QCustomPlot Discussion and Comments

add/remove element from a chartReturn to overview


I would like to add/remove a custom indicator to my financial chart like this: https://www.tradingview.com/x/fmE6qhpG/

There is an addElement to add a graph to a chart but how to remove it if the user wants so.


For the indicators, have a look at QCP's item system. The "Items" tutorial should get you started, and then the documentation (e.g. of QCPAbstractItem as starting point). Also, the "dynamic axis tags" tutorial might give you an Idea how to go forward constructing your own indicators.

You also mentioned "adding graphs": Graphs you can add with addGraph, and remove with removeGraph. If you just want it invisible temporarily, use QCPGraph::setVisible. See the respective documentation.

Thank you. I will have al look.