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. ChartView: Dynamically creating a series with a right axis (at a different scaling)

ChartView: Dynamically creating a series with a right axis (at a different scaling)

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 689 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.
  • E Offline
    E Offline
    EvilMav
    wrote on last edited by EvilMav
    #1

    I'm trying to generate a chart every second line of which is referenced to an y axis on the right.

    I have a ChartView with multiple axis created inside:

        ChartView {
            id: uiChart
            anchors.fill: parent
    
            // @disable-check M17
            legend.visible: false
    
            antialiasing: true
            animationOptions: ChartView.NoAnimation
    
            ValueAxis {
                id: xaxisI
    
                minorTickCount: 4
                tickCount: 5
    
                titleText: "I / µA"
            }
    
            ValueAxis {
                id: yaxisU
    
                minorTickCount: 4
                tickCount: 5
    
                titleText: "U / µV"
            }
    
            ValueAxis {
                id: yaxisR
    
                gridVisible: false
                minorTickCount: yaxisU.minorTickCount
                tickCount: yaxisU.tickCount
           }    
    

    The limits for the axes are set dynamically. Now I want to generate two series, one against yaxisU on the left, other agains yaxisR on the right:

    var uSeries = uiChart.createSeries(ChartView.SeriesTypeLine, a, xaxisI, yaxisU)
    var rSeries = uiChart.createSeries(ChartView.SeriesTypeLine, a, xaxisI, yaxisR)
    

    If I do it like so, it does work, but both axis apear near each other to the left of the chart. If I try to set rSeries.axisYRight = yaxisR later, it doesn't change anything. On the other hand, if I try to omit yaxisR in the createSeries call and only set it later via rSeries.axisYRight, the R axis does appear on the right but the uSeries appears scaled to yaxisR rather then yaxisU.

    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