Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Resizing axis causes artifacts in a LineSeries binded to QAbstractTableModel

Resizing axis causes artifacts in a LineSeries binded to QAbstractTableModel

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qtchartsqmlmodeldataqtquick2
1 Posts 1 Posters 895 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.
  • N Offline
    N Offline
    nickaein
    wrote on 11 Aug 2016, 21:10 last edited by
    #1

    I've built a sample QtQuick 2 application which plots a line series dynamically using QtCharts.

    The data for the Line series comes from C++ using a model derived from QAbstractTableModel class and exposed by a QVXYModelMapper.

    The problem is that during resizing the axis, some artifacts are produced in the plotted series. Specifically, a straight line appears which goes from the previous plotted point to the current plotting position.

    This issue only happens for the QAbstractTableModel-based series. You can see an example of this happening several times because of resize in the following screenshot:

    The buggy series is the green one. Note that the data for blue series is generated completely in QML and it doesn't have this issue.

    The source code of reproducing this problem is available here:

    https://github.com/nickaein/qtcharts_dynamic_series

    Here is the main.qml from this source code just for reference:

    import QtQuick 2.7
    import QtQuick.Window 2.2
    import QtQuick.Controls 2.0
    import QtCharts 2.0
    
    ApplicationWindow {
    	visible: true
    	width: 600
    	height: 300
    	property int timeStep: 0
    
    	ChartView {
    		id: chartView
    		anchors.fill: parent
    
    		ValueAxis {
    			id: axisX
    			min: 0
    			max: 400
    		}
    
    		Component.onCompleted:  {
    			mapper.series = series2
    		}
    
    		LineSeries {
    			id: series1
    			axisX: axisX
    		}
    
    		LineSeries {
    			id: series2
    			axisX: axisX
    		}
    	}
    
    	Timer {
    		interval: 100
    		repeat: true
    		running: true
    		onTriggered: {
    			timeStep++;
    			var y = (1+Math.cos(timeStep/10.0))/2.0;
    			series1.append(timeStep, y);
    		}
    	}
    }
    
    1 Reply Last reply
    0

    1/1

    11 Aug 2016, 21:10

    • Login

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