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 ChartView how to remove axis and scale?
Forum Updated to NodeBB v4.3 + New Features

QML ChartView how to remove axis and scale?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 5.2k 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.
  • M Offline
    M Offline
    MikhailG
    wrote on 26 Dec 2016, 07:22 last edited by MikhailG
    #1

    Hello! I encounter some difficulties with managing to remove axis and scale from this view. Red arrows are pointing out what I want to remove. In documentation I did not find any relevant information to this problem. Please any piece of advice would be great! Thank you.!
    image

    I use OSCILLOSCOPE example.

    ChartView {
        id: chartView
        animationOptions: ChartView.NoAnimation
        theme: ChartView.ChartThemeDark
        legend.visible: false
    
        property bool openGL: true
        onOpenGLChanged: {
            series("signal 1").useOpenGL = openGL;
            series("signal 2").useOpenGL = openGL;
        }
    
        ValueAxis {
            id: axisY1
            min: -1
            max: 4
    
            color: "transparent"
        }
    
        ValueAxis {
            id: axisX
            min: 0
            max: 1024
    
            color: "transparent"
        }
    
        LineSeries {
            id: lineSeries1
            name: "signal 1"
            axisX: axisX
            axisY: axisY1
            useOpenGL: chartView.openGL
        }
    
        Timer {
            id: refreshTimer
            interval: 1 / 60 * 1000 // 60 Hz
            running: true
            repeat: true
            onTriggered: {
                dataSource.update(chartView.series(0));
                dataSource.update(chartView.series(1));
            }
        }
    
        function changeSeriesType(type) {
            chartView.removeAllSeries();
    
            if (type == "line") {
                var series1 = chartView.createSeries(ChartView.SeriesTypeLine, "signal 1",
                                                     axisX, axisY1);
                series1.useOpenGL = chartView.openGL
    
            } else {
                var series1 = chartView.createSeries(ChartView.SeriesTypeScatter, "signal 1",
                                                     axisX, axisY1);
                series1.markerSize = 2;
                series1.borderColor = "transparent";
                series1.useOpenGL = chartView.openGL
            }
        }
    
        function createAxis(min, max) {
            // The following creates a ValueAxis object that can be then set as a x or y axis for a series
            return Qt.createQmlObject("import QtQuick 2.0; import QtCharts 2.0; ValueAxis { min: "
                                      + min + "; max: " + max + " }", chartView);
        }
    
        function setAnimations(enabled) {
            if (enabled)
                chartView.animationOptions = ChartView.SeriesAnimations;
            else
                chartView.animationOptions = ChartView.NoAnimation;
        }
    
        function changeRefreshRate(rate) {
            refreshTimer.interval = 1 / Number(rate) * 1000;
        }
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      MikhailG
      wrote on 26 Dec 2016, 07:36 last edited by MikhailG
      #2

      Somehow I managed to solve it. Just had to check official examples one more time.
      To remove labels and a grid (scale).

      ValueAxis {
            labelsVisible: false
            gridVisible:false
      }
      
      1 Reply Last reply
      1

      1/2

      26 Dec 2016, 07:22

      • Login

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