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. DateTimeAxis - How to set min and max?
Qt 6.11 is out! See what's new in the release blog

DateTimeAxis - How to set min and max?

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

    Hi,

    I'm working on a chart which should show the time from 0 to 24 h on the x axis. Is there any example out there?

    My code snippet:

    @
    import QtQuick 2.3
    import QtQuick.Controls 1.2
    import QtCharts 2.0

    Rectangle {
    id: detailRectangle
    anchors.fill: parent

    ChartView {
        title: "Line"
        anchors.fill: parent
        antialiasing: true
    
        LineSeries {
            axisY: ValueAxis {
                min: 0
                max: 1
                titleText: "kWh"
            }
    
            axisX: DateTimeAxis {
                format: "hh:mm"
                tickCount: 5
                min: new Date("October 13, 2014 11:13:00");
                max: new Date("October 13, 2014 13:13:00");
            }
    
            name: "LineSeries"
            XYPoint { x: 0; y: 0 }
            XYPoint { x: 1.1; y: 2.1 }
            XYPoint { x: 1.9; y: 3.3 }
            XYPoint { x: 2.1; y: 2.1 }
            XYPoint { x: 2.9; y: 4.9 }
            XYPoint { x: 3.4; y: 3.0 }
            XYPoint { x: 4.1; y: 3.3 }
        }
    }
    

    }
    @

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Following the QDateTime doc i'd try with "HH:mm"

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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