using qchartview in application

23 views
Skip to first unread message

Al As

unread,
Jul 18, 2022, 2:22:40 PM7/18/22
to The Ring Programming Language
hi all ,

how could we use charts in ringqt

not the qml one but the qchartview

please help

thnaks

Mahmoud Fayed

unread,
Jul 18, 2022, 3:44:16 PM7/18/22
to The Ring Programming Language
Hello Alaa

RingQt support QChart & QChartView classes
We could add examples about using them in the future
But I don't have the time to do this in the next future


Greetings,
Mahmoud

Al As

unread,
Jul 19, 2022, 2:25:34 PM7/19/22
to The Ring Programming Language
hi Mahmoud ,
i have searched about qtcharts and found your sample about qml , i think qchart is much practical solution , anyway i tried to develop one sample based on your qml samples but i faced error ,if anyone can help to figure it out

thanks

load "guilib.ring"


new qApp {

   w = new qWidget() {

       setWindowTitle("Using QML - Display Chart") resize(650,650) move(100,100)

       

// oQuick.addseries("Magnitude (Column 1)", [0, 1])

set0= QBarSet ("X0")

       set1 = QBarSet ("X1")

       set2 = QBarSet ("X2")

       set3 = QBarSet ("X3")

       set4 = QBarSet ("X4")

set0.append([1, 2, 3, 4, 5, 6])

       set1.append([5, 0, 0, 4, 0, 7])

       set2.append([3, 5, 8, 13, 8, 5])

       set3.append([5, 6, 7, 3, 4, 5])

       set4.append([9, 7, 5, 3, 1, 2])

series = QHorizontalBarSeries()

       series.append(set0)

       series.append(set1)

       series.append(set2)

       series.append(set3)

       series.append(set4)


oQuick = QChart()

       oQuick.addSeries(series)

       oQuick.setTitle('Horizontal Bar Chart Demo')

months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June']

axisY = QBarCategoryAxis()

axisY.append(months)

       chart.addAxis(axisY, Qt.AlignLeft)

       series.attachAxis(axisY)

axisX = QValueAxis()

       oQuick.addAxis(axisX, Qt.AlignBottom)

       series.attachAxis(axisX)

chartView = QChartView(oQuick)

       chartView.setRenderHint(QPainter.Antialiasing)

       w.setCentralWidget(chartView)

w.chartView=new Qchartview(oQuick)


}

       //oLayout = new qVBoxlayout() {

       //    AddWidget(oQuick)

       //}

       //setlayout(oLayout)

       show()

   

   exec()

}

Reply all
Reply to author
Forward
0 new messages