mirror of
https://github.com/mappu/miqt.git
synced 2025-04-04 12:40:23 +00:00
41 lines
719 B
Go
41 lines
719 B
Go
package main
|
|
|
|
import (
|
|
"math"
|
|
"os"
|
|
|
|
qt "github.com/mappu/miqt/qt6"
|
|
charts "github.com/mappu/miqt/qt-restricted-extras/charts6"
|
|
)
|
|
|
|
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()
|
|
}
|