Using the latest B4A and xChart:
https://www.b4x.com/android/forum/threads/b4x-xui-xchart-class.91830/
and come across a few problems.
This is my code:
1. xChart1.YScaleMinValue = 0 This doesn't seem to work, so I can't show the 0 on Y scale
2. xChart1.ChartType = "LINE" This didn't work, still made a Bar chart, but I think I have fixed this:
3. When doing a long click in the chart the popup rectangle holding the points data is not wide enough, sothe longer text (in my case the x-axis text values) are cut short.
4. Not figured out yet how to make the x-axis points proportional to the size of the intervals.
Is this possible?
Otherwise it is very nice!
RBS
https://www.b4x.com/android/forum/threads/b4x-xui-xchart-class.91830/
and come across a few problems.
This is my code:
B4X:
Sub MakeBPChart
Dim i As Int
xChart1.ClearData
xChart1.AddLine2("Systolic", xui.Color_Red, 2dip, "NONE", False, xui.Color_Red)
xChart1.AddLine2("Diastolic", xui.Color_Blue, 2dip, "NONE", False, xui.Color_Blue)
For i = CursorBP.RowCount - 1 To 0 Step - 1
CursorBP.Position = i
General.RunLog("MakeBPChart, CursorBP.GetInt2(0): " & CursorBP.GetInt2(0))
General.RunLog("MakeBPChart, CursorBP.GetDouble2(1): " & CursorBP.GetDouble2(1))
xChart1.AddLineMultiplePoints(General.ExcelDate2String(CursorBP.GetInt2(0), ""), _
Array As Double(CursorBP.GetDouble2(1), CursorBP.GetDouble2(2)), _
True)
Next
xChart1.ChartType = "LINE" 'still makes a bar chart!
xChart1.AutomaticScale = True
xChart1.XScaleTextOrientation = "VERTICAL"
xChart1.YScaleMinValue = 0
xChart1.Title = ""
xChart1.XAxisName = ""
xChart1.YAxisName = ""
xChart1.DrawChart
GotoPanel(ePanelType.Chart, False)
End Sub
1. xChart1.YScaleMinValue = 0 This doesn't seem to work, so I can't show the 0 on Y scale
2. xChart1.ChartType = "LINE" This didn't work, still made a Bar chart, but I think I have fixed this:
B4X:
Public Sub setChartType(ChartType As String)
'>>>> Altered <<<<
'If ChartType = "BAR" Or ChartType = "STACKED_BAR" Then
Graph.ChartType = ChartType
'End If
End Sub
3. When doing a long click in the chart the popup rectangle holding the points data is not wide enough, sothe longer text (in my case the x-axis text values) are cut short.
4. Not figured out yet how to make the x-axis points proportional to the size of the intervals.
Is this possible?
Otherwise it is very nice!
RBS