mirror of https://github.com/qt/qtgraphs.git
Add spline tests to qmlbenchmark2d
Change-Id: Ib5d5e30517c5f40fe6337ba9c248ae95b895c942
Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io>
Reviewed-by: Owais Akhtar <owais.akhtar@qt.io>
(cherry picked from commit 02adf613b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b18abf9733
commit
02e4088876
|
|
@ -5,6 +5,8 @@ cmake_minimum_required(VERSION 3.16)
|
|||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# To see both QtCharts and QtGraphs benchmarks in one graph, first build and run this with
|
||||
# set(USE_CHARTS true) and the again with set(USE_CHARTS false)
|
||||
set(USE_CHARTS false)
|
||||
|
||||
if (USE_CHARTS)
|
||||
|
|
@ -61,9 +63,11 @@ set(qmlbenchmark2d_resource_files
|
|||
"ChartsAreaTest.qml"
|
||||
"ChartsBarTest.qml"
|
||||
"ChartsOpenGLLineTest.qml"
|
||||
"ChartsSplineTest.qml"
|
||||
"GraphsLineTest.qml"
|
||||
"GraphsAreaTest.qml"
|
||||
"GraphsBarTest.qml"
|
||||
"GraphsSplineTest.qml"
|
||||
)
|
||||
|
||||
qt_internal_add_resource(tst_qmlbenchmark2d "qmlbenchmark2d"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright (C) 2025 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
import QtQuick
|
||||
import QtCharts
|
||||
|
||||
Rectangle {
|
||||
signal measure(int count)
|
||||
width: 800
|
||||
height: 600
|
||||
color: "#404040"
|
||||
|
||||
ChartView {
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
|
||||
Component.onCompleted: {
|
||||
chartsDataSource.reset(1000);
|
||||
}
|
||||
|
||||
SplineSeries {
|
||||
id: series
|
||||
|
||||
axisX: ValueAxis {
|
||||
id: xAxis
|
||||
min: 0
|
||||
max: series.count
|
||||
}
|
||||
|
||||
axisY: ValueAxis {
|
||||
min: 0
|
||||
max: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FrameAnimation {
|
||||
running: true
|
||||
onTriggered: {
|
||||
if (xAxis.max !== series.count)
|
||||
xAxis.max = series.count
|
||||
chartsDataSource.update(series);
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 400; running: true; repeat: true
|
||||
onTriggered: {
|
||||
parent.measure(series.count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
// Copyright (C) 2025 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
import QtQuick
|
||||
import QtGraphs
|
||||
|
||||
Rectangle {
|
||||
signal measure(int count)
|
||||
width: 800
|
||||
height: 600
|
||||
color: "#404040"
|
||||
|
||||
GraphsView {
|
||||
id: graph
|
||||
anchors.fill: parent
|
||||
antialiasing: true
|
||||
|
||||
Component.onCompleted: {
|
||||
dataSource.reset(1000);
|
||||
}
|
||||
|
||||
axisX: ValueAxis {
|
||||
min: 0
|
||||
max: {
|
||||
if (series.count > 0)
|
||||
return series.count
|
||||
else
|
||||
return 1000
|
||||
}
|
||||
}
|
||||
|
||||
axisY: ValueAxis {
|
||||
min: 0
|
||||
max: 10
|
||||
}
|
||||
|
||||
SplineSeries {
|
||||
id: series
|
||||
}
|
||||
}
|
||||
|
||||
FrameAnimation {
|
||||
running: true
|
||||
onTriggered: {
|
||||
dataSource.update(series);
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 400; running: true; repeat: true
|
||||
onTriggered: {
|
||||
parent.measure(series.count)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,8 +8,8 @@ Item {
|
|||
id: base
|
||||
width: 800
|
||||
height: 600
|
||||
property list<string> graphsTests: ["GraphsLineTest.qml", "GraphsAreaTest.qml", "GraphsBarTest.qml"]
|
||||
property list<string> chartsTests: ["ChartsLineTest.qml", "ChartsAreaTest.qml", "ChartsBarTest.qml", "ChartsOpenGLLineTest.qml"]
|
||||
property list<string> graphsTests: ["GraphsLineTest.qml", "GraphsAreaTest.qml", "GraphsBarTest.qml", "GraphsSplineTest.qml"]
|
||||
property list<string> chartsTests: ["ChartsLineTest.qml", "ChartsAreaTest.qml", "ChartsBarTest.qml", "ChartsOpenGLLineTest.qml", "ChartsSplineTest.qml"]
|
||||
property list<string> tests: []
|
||||
property int testIndex: 0
|
||||
property int fps: 0
|
||||
|
|
@ -71,6 +71,14 @@ Item {
|
|||
loader.source = "Results.qml"
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Show Spline Results"
|
||||
onClicked: {
|
||||
base.resultType = "Spline"
|
||||
loader.source = "Results.qml"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ Rectangle {
|
|||
theme: GraphsTheme {
|
||||
id: myTheme
|
||||
colorScheme: GraphsTheme.ColorScheme.Dark
|
||||
seriesColors: ["#ffaaaa", "#aaffaa", "#aaaaff", "#ff0000", "#ffffaa", "#aaffff", "#ffaaff"]
|
||||
// seriesColors: ["#ffaaaa", "#aaffaa", "#aaaaff", "#ff0000", "#ffffaa", "#aaffff", "#ffaaff"]
|
||||
seriesColors: ["#ff0000", "#00ff00", "#0000ff", "#ffffff", "#550000", "#ffff00", "#00ffff", "#ff00ff", "#555500"]
|
||||
}
|
||||
|
||||
axisX: BarCategoryAxis {
|
||||
|
|
|
|||
Loading…
Reference in New Issue