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. [Qt charts 2.1] Problem with DateTimeAxis
Forum Updated to NodeBB v4.3 + New Features

[Qt charts 2.1] Problem with DateTimeAxis

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.7k Views 2 Watching
  • 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.
  • GeoffroyG Offline
    GeoffroyG Offline
    Geoffroy
    wrote on last edited by
    #1

    Hi everybody,

    I'm facing to an issue with qt charts 2.1
    I need to draw a line series within a 10 seconds interval. I have created a DateTimeAxis with min and max parameters set accordingly to my need. It seems that when the time resolution is too high (interval less than few seconds), points are located at the same x position .. Here is a minimalist code which reproduce the problem :

    import QtQuick 2.5
    import QtQuick.Window 2.2
    import QtCharts 2.1
    
    
    Window {
    
        visible: true
        width: 640
        height: 480
    
        ChartView {
            id: chartView
            anchors.fill: parent
            property bool openGL: true
    
            ValueAxis {
                id: axisY1
                min: -1.5
                max: 1.5
                tickCount: 5
                minorTickCount: 5
            }
    
            DateTimeAxis {
                id: axisX
                tickCount: 10
                min: new Date(new Date() - 10000)
                max: new Date()
                format: "mm:ss"
            }
    
            LineSeries {
                id: lineSeries1
                name: "signal 1"
                axisX: axisX
                axisY: axisY1
                useOpenGL: chartView.openGL
                XYPoint { x: toMsecsSinceEpoch(new Date(new Date() - 10000)); y: -1 }
                XYPoint { x: toMsecsSinceEpoch(new Date()); y: 1 }
            }
        }
    
        function toMsecsSinceEpoch(date) {
            var msecs = date.getTime();
            return msecs;
        }
    }
    
    

    The visual result is a vertical line located at the left of the chart ..
    Any ideas for solve that ?

    1 Reply Last reply
    0
    • TrevorEdrisT Offline
      TrevorEdrisT Offline
      TrevorEdris
      wrote on last edited by
      #2

      Hello,
      I am also having this same issue. It seems as though this problem with the DateTimeAxis only persists when used in QML, as I created a simple example using my same dataset with a strictly c++ approach and the dataset was displayed correctly. When used in QML, the points are all mapped to the same X position, as you have stated.

      1 Reply Last reply
      0

      • Login

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