Solved QML ChartView how to remove axis and scale?
-
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.!
imageI 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; }
-
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 }