Results 1 to 5 of 5

Thread: Is it possible to programmatically delete the QValueAxis axis.

  1. #1
    Join Date
    Aug 2019
    Posts
    12
    Thanks
    5
    Qt products
    Platforms
    Windows

    Default Is it possible to programmatically delete the QValueAxis axis.

    At first, I couldn't set the scatters on the candle chart.
    The candlestick chart disappeared when the scatter was set.
    Default axes were used for the scatter.
    I tried setting the axis for the scatter separately and the candlestick chart stopped disappearing.

    Now, when I delete the scatter, the axes remain. Is it possible to programmatically delete them.

    Below I attach a GIF file for clarity.
    https://gifyu.com/image/6Y1R

    I asked the same question on stackoverflow.com. https://stackoverflow.com/questions/...re-not-deleted
    The code is in Python(Pyqt5), but I can probably understand the code in C++.

  2. #2
    Join Date
    Aug 2019
    Posts
    12
    Thanks
    5
    Qt products
    Platforms
    Windows

    Default Re: Is it possible to programmatically delete the QValueAxis axis.

    Can of course try to do this:

    chart.axisX(serie).setVisible(False)
    But will the axes remain in memory?

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,714
    Thanks
    259
    Thanked 759 Times in 749 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Is it possible to programmatically delete the QValueAxis axis.

    But will the axes remain in memory?
    Most likely. All you are changing is the visibility status.

    Why does it matter whether the memory is freed or not?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  4. The following user says thank you to d_stranz for this useful post:

    quant (11th October 2020)

  5. #4
    Join Date
    Aug 2019
    Posts
    12
    Thanks
    5
    Qt products
    Platforms
    Windows

    Default Re: Is it possible to programmatically delete the QValueAxis axis.

    Quote Originally Posted by d_stranz View Post
    Most likely. All you are changing is the visibility status.

    Why does it matter whether the memory is freed or not?
    I plan to add and remove various series from the chart many times.
    Over time, the app will start to hang, work incorrectly, and so on. I think so, but I'm not sure.

    I created a GIF where I add scatters many times and then delete them.https://gifyu.com/image/61Mb

    You can see that the graph stops changing diagonally.

    Although, if I make the axes immediately invisible, then there is no problem with diagonal stretching.
    I don't have much programming experience. So I decided to ask about it.
    Last edited by quant; 10th October 2020 at 21:26.

  6. #5
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,714
    Thanks
    259
    Thanked 759 Times in 749 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Is it possible to programmatically delete the QValueAxis axis.

    I plan to add and remove various series from the chart many times.
    Over time, the app will start to hang, work incorrectly, and so on. I think so, but I'm not sure.
    It shouldn't, if you are using the chart API correctly. If you are actually -removing- series from the plot instead of just making them invisible then python should be freeing up the memory for the items that have been removed. If all you are doing to "remove" a series is to make it invisible, then yes, you are basically forcing python and Qt to allocate more and more memory which will cause your app to bog down and probably eventually crash if you run it long enough..
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  7. The following user says thank you to d_stranz for this useful post:

    quant (11th October 2020)

Similar Threads

  1. Replies: 2
    Last Post: 28th March 2020, 19:44
  2. Replies: 0
    Last Post: 23rd January 2017, 12:55
  3. Replies: 9
    Last Post: 3rd May 2011, 22:21
  4. Replies: 0
    Last Post: 9th August 2010, 11:46
  5. Replies: 4
    Last Post: 19th February 2009, 12:10

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.