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. QML chart not shown

QML chart not shown

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 4 Posters 1.8k 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.
  • Y Offline
    Y Offline
    ymhsieh
    wrote on last edited by
    #1

    I'm experimenting QML chart with data loaded by JS. I'm almost certain the following UML is correct, but all I got is blank. Any tip/hint so that I can get it displayed correctly?
    (p.s. The UML is modified from the example at: https://doc.qt.io/qt-5/qml-qtcharts-candlestickseries.html)

    import QtQuick 2.5
    import QtCharts 2.2

    ChartView {
    title: "Candlestick Series"

    CandlestickSeries {
        id: s2
        name: "Another Ltd."
        increasingColor: "white"
        decreasingColor: "black"
    }
    
    Component.onCompleted: {
        var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1435708800000; open: 690; high: 694; low: 599; close: 660 }", s2);
        s2.append( tmp )
        var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1435795200000; open: 669; high: 669; low: 669; close: 669 }", s2);
        s2.append( tmp )
        var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1436140800000; open: 485; high: 623; low: 485; close: 600 }", s2);
        s2.append( tmp )
        var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1436227200000; open: 589; high: 615; low: 377; close: 569 }", s2);
        s2.append( tmp )
        // var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1436313600000; open: 464; high: 464; low: 254; close: 254 }", s2);
        // s2.append( tmp )
    }
    

    }

    P 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Are you able to run the example given on your box ? Side note.. It is QML !UML:)

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      Y S 2 Replies Last reply
      2
      • dheerendraD dheerendra

        Are you able to run the example given on your box ? Side note.. It is QML !UML:)

        Y Offline
        Y Offline
        ymhsieh
        wrote on last edited by
        #3

        @dheerendra
        Yes, the original examples are okay. Sorry for typo, there are just too many acronyms... XD

        1 Reply Last reply
        0
        • dheerendraD dheerendra

          Are you able to run the example given on your box ? Side note.. It is QML !UML:)

          S Offline
          S Offline
          serg_ganz
          wrote on last edited by
          #4

          @dheerendra

          the same problem

          would you please provide a 100% working example.

          thnx

          1 Reply Last reply
          0
          • Y ymhsieh

            I'm experimenting QML chart with data loaded by JS. I'm almost certain the following UML is correct, but all I got is blank. Any tip/hint so that I can get it displayed correctly?
            (p.s. The UML is modified from the example at: https://doc.qt.io/qt-5/qml-qtcharts-candlestickseries.html)

            import QtQuick 2.5
            import QtCharts 2.2

            ChartView {
            title: "Candlestick Series"

            CandlestickSeries {
                id: s2
                name: "Another Ltd."
                increasingColor: "white"
                decreasingColor: "black"
            }
            
            Component.onCompleted: {
                var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1435708800000; open: 690; high: 694; low: 599; close: 660 }", s2);
                s2.append( tmp )
                var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1435795200000; open: 669; high: 669; low: 669; close: 669 }", s2);
                s2.append( tmp )
                var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1436140800000; open: 485; high: 623; low: 485; close: 600 }", s2);
                s2.append( tmp )
                var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1436227200000; open: 589; high: 615; low: 377; close: 569 }", s2);
                s2.append( tmp )
                // var tmp = Qt.createQmlObject("import QtCharts 2.2; CandlestickSet { timestamp: 1436313600000; open: 464; high: 464; low: 254; close: 254 }", s2);
                // s2.append( tmp )
            }
            

            }

            P Offline
            P Offline
            pra7
            wrote on last edited by
            #5

            @ymhsieh

            Before looking to the issue i was getting lot of errors in the console "PainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call" .

            Comming to the code:

            1. Assign width and height to the chartView.
            2. Assign a Axis to the CandlestickSeries.
            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