Good evening members iam trying to display this information on a bar and curve chart please help me out thanks in advance
Find attached my small attachment for the project and the excel graph that i want to display
below is my other code
Find attached my small attachment for the project and the excel graph that i want to display
below is my other code
B4X:
#Region Project Attributes
#ApplicationLabel: BarChart
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
End Sub
Sub Globals
Private xui As XUI
Private BarChart, LineChart As xChart
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
FillCharts
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub FillCharts
'Private Name As String
Private lstTotal, lstSubject,lstName As List
Private ResultSet1 As ResultSet
Private Query As String
lstTotal.Initialize
lstSubject.Initialize
lstName.Initialize
'Name = "MAKUMBI TARIQ AZIZI"
'Query = "SELECT Names, Total, Subject FROM Academics WHERE Names = ?"
Query = "SELECT Names, Eng,Science,Sst,Maths,Years from students"
'ResultSet1 = Starter.SQL1.ExecQuery2(Query, Array As String(Name))
ResultSet1 = Starter.SQL1.ExecQuery(Query)
Do While ResultSet1.NextRow
lstSubject.Add(ResultSet1.GetString("Names"))
lstSubject.Add(ResultSet1.GetString("Years"))
lstTotal.Add(ResultSet1.GetString("Eng"))
lstTotal.Add(ResultSet1.GetString("Science"))
lstTotal.Add(ResultSet1.GetString("Sst"))
lstTotal.Add(ResultSet1.GetString("Maths"))
Loop
'Bar chart
BarChart.ClearData
BarChart.AddBar("marks", xui.Color_RGB(139, 132, 255))
For i = 0 To lstSubject.Size - 1
BarChart.AddBarPointData(lstSubject.Get(i), lstTotal.Get(i))
' Total = Total + Value(i)
Next
BarChart.YAxisName = "marks"
' BarChart.XAxisName = "total marks = " & Total
BarChart.DrawChart
'Line chart
LineChart.ClearData
LineChart.AddLine("marks", xui.Color_Blue)
' LineChart.AddLine2("marks", xui.Color_Blue, 2dip, "SQUARE", False, xui.Color_Blue)
For i = 0 To lstSubject.Size - 1
LineChart.AddLinePointData(lstSubject.Get(i), lstTotal.Get(i), True)
Next
LineChart.YAxisName = "marks"
LineChart.DrawChart
End Sub
B4X:
Query = "CREATE TABLE Students (Names Text, Eng text,Science Text ,Sst Text,Maths Text,Years Text ,ID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE)"
SQL1.ExecNonQuery(Query)
Query = "INSERT INTO Students VALUES ('Sulaiman', '50','60','80','90','2019','1')"
SQL1.ExecNonQuery(Query)
Query = "INSERT INTO Students VALUES ('Sulaiman', '40','88','90','67','2019','2')"
SQL1.ExecNonQuery(Query)
Query = "INSERT INTO Students VALUES ('Sulaiman', '90','87','44','70','2020','3')"
Attachments
Last edited: