Add Qt 6 Charts example

This commit is contained in:
Rick Calixte 2025-03-29 14:49:45 -04:00
parent 5946517cad
commit 43e98a6dd9
No known key found for this signature in database
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
package main
import (
"math"
"os"
qt "github.com/mappu/miqt/qt6"
"github.com/mappu/miqt/qt6/charts"
)
func main() {
qt.NewQApplication(os.Args)
series := charts.NewQLineSeries()
series.SetName("Sine Wave")
var x, y float64
for i := -500; i <= 500; i++ {
x = float64(i) / 10000
y = math.Sin(1/x) * x
if math.IsNaN(y) {
y = 0
}
series.Append(x, y)
}
chart := charts.NewQChart()
chart.AddSeries(series.QAbstractSeries)
chart.CreateDefaultAxes()
chartView := charts.NewQChartView3(chart)
chartView.SetWindowTitle("Qt 6 Charts Example")
chartView.Resize(650, 400)
chartView.SetRenderHint(qt.QPainter__Antialiasing)
chartView.Show()
qt.QApplication_Exec()
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB