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. Overlay rectangle on ChartView

Overlay rectangle on ChartView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 600 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.
  • B Offline
    B Offline
    BobbyG
    wrote on last edited by
    #1

    I want to put a number of rectangles as overlays to show regions of interest on a ChartView of ScatterSeries. However when I try to do this it is clearly using a different coordinate system to that of the ScatterSeries as it is drawn in a completely different place.

    For example the following is intended to draw a rectangle that captures all of the ScatterSeries but it just draws a small green rectangle top left as shown in the screenshot.

            ChartView {
                Layout.fillWidth : true
                Layout.fillHeight : true
                Rectangle {
                    x: 30
                    y: 50
                    width: 40
                    height: 10
                    color: "green"
                }
                ScatterSeries{
                    XYPoint { x: 30; y: 50 }
                    XYPoint { x: 50; y: 60 }
                    XYPoint { x: 60; y: 50 }
                    XYPoint { x: 70; y: 60 }
                    axisX: ValueAxis {
                        min: 0
                        max: 100
                    }
                    axisY: ValueAxis {
                        min: 0
                        max: 100
                    }
                }
    

    0_1565274205462_d568bbaa-6306-4ac2-ac97-e820b859532e-image.png

    The documentation suggests that the rectangle should use the coordinate system of the parent ChartView. I assume I actually want it to use the coordinate system of the ChartView scene. How do I do this?

    1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by
      #2

      Cannot test charts right now, but you can set, for example z: 10 to your rectangle or declare it after ScatterSeries.

      B 1 Reply Last reply
      0
      • IntruderExcluderI IntruderExcluder

        Cannot test charts right now, but you can set, for example z: 10 to your rectangle or declare it after ScatterSeries.

        B Offline
        B Offline
        BobbyG
        wrote on last edited by
        #3

        @intruderexcluder - That does not change the coordinate system to match that of the plot area so it is still too small and in the wrong place.

        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