Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can I make QVariant invaild not be expressed as 0 in qtchart?
Qt 6.11 is out! See what's new in the release blog

Can I make QVariant invaild not be expressed as 0 in qtchart?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 264 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LISP
    wrote on last edited by
    #1

    I am mapping QAbstractItemModel and QtChart(LineSeries) using QXYModelMapper.

    I set the x-axis of the mapper. And the x-axis data has already been inserted.

    When y-axis data is sequentially inserted, data that has not yet been inserted is expressed as 0 (QVariant invaild). But I don't want it to be represented as zero in the graph.

    Since it is expressed as 0, the graph is already drawn and is updated when y-axis data is inserted.

    I want to draw a graph sequentially when the y-axis data is inserted while the x-axis data is included.

    I don't want the data to be modified in an already completed graph.

    What better way to do it?

    sequence 1 x : 100, 200, 300 y:

    sequence 2 x : 100, 200, 300 y : 10

    sequence 3 x : 100, 200, 300 y : 10, 20

    sequence 4 x : 100, 200, 300 y : 10, 20, 30

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      I think you want to do two things at the same time:

      • Present the user with a table to fill in that has prefilled X value and blank Y values.
      • Plot a line chart using only those rows of the table where both X and Y cells are non-blank as the user fills it in.

      You are being annoyed by the chart's default behaviour of treating null/invalid cell contents as zero rather than missing.

      If that is correct then one approach would be to place a proxy model (QSortFilterProxyModel might be best) between the model driving the input table and the chart. In the filter accept any row where both X and Y value are valid.

      If you have more than one data series then this become more complicated.

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved