Can I make QVariant invaild not be expressed as 0 in qtchart?
-
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
-
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.