B4A Library MPAndroidCharts - Various type of graphs / charts (Latest library V1.22 in post #1)

Edit 6 Sep 2015: Post #3 adds Single Vertical Bar Charts and update for Pie Charts
Edit 8 Sep 2015 Post #6 update for Single Vertical Bar Charts
Edit 11 Sep 2015 Post #7 adds Single Line Charts
Edit 12 Sep 2015 Post #8 update for Single Line Charts
Edit 12 Sep 2015 Post #9 adds Single Horizontal Bar Charts
Edit 12 Sep 2015 Post #11 adds Radar Charts
Edit 13 Sep 2015 Post #12 update for Single Line and Single Bar Charts
Edit 14 Sep 2015 Post #16 update for Radar Charts
Edit 16 Sep 2015 Post #19 adds Multiple Line Charts
Edit 17 Sep2016 Post #21 adds Multi Vertical Bar Charts
Edit 19 Sep 2015 Post #23 adds Multi Bubble Charts
Edit 19 Sep 2015 Post #24 adds Multi Horizontal Bar Charts
Edit 19 Sep 2015 Post #25 adds Multi Scatter Charts
Edit 19 Sep 2015 Post #26 adds Stacked Bar Charts
Edit 20 Sep 2015 Post #27 adds Candlestick Charts
Edit 20 Sep 2015 Post #28 adds Combined Line & Bar Charts
Edit 23 Sep 2015 Post #31 fixed no-show of Chart Title for Combined Charts and added ability to rotate X-axis labels between -30 and + 30 degrees

I am busy wrapping this Github project. Attached is the Pie Chart functionality of the project/library. Posting the B4A project and Library files. Copy the library files to your additional library folder.

Some remarks about the Pie Chart:
1. It will display the values passed as a percentage of the total of the values that you pass
2. There are 3 x arrays that are passed to the library. Ensure that you pass the same number of elements in each of the arrays.
3. When you click on a pie slice the slice will increase in radial size (see pics below)
4. If you click on the radial increased slice it will return to normal size.
5. You can spin the pie chart around its centre point (CW and ACW) with your finger.

Untouched ...

Pie.gif


1.png


Green slice touched ...

2.png


Pie Chart rotated with finger...

3.png



Some sample code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: MPChart
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private mpc1 As PieChart
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")

mpc1.DrawHoleEnabled = True
mpc1.HoleColorTransparent = True

mpc1.TransparentCircleColor = Colors.White
mpc1.TransparentCircleAlpha = 110

mpc1.HoleRadius = 58.0
mpc1.TransparentCircleRadius = 61.0

mpc1.DrawCenterText = True

mpc1.CenterText = "Wrapped by Johan"
mpc1.CenterTextColor = Colors.White
mpc1.CenterTextRadiusPercent = 100.0
mpc1.CenterTextSize = 15.0

mpc1.DrawSliceText = True
mpc1.HoleColor = Colors.Black
mpc1.TransparentCircleColor = Colors.Transparent

mpc1.setTheLegendPosition
mpc1.TheLegendColor = Colors.yellow
mpc1.TheLegendTextSize = 12.0
mpc1.LegendTitle = "MONTHS"

mpc1.ChartDescription = "TITLE : Some Arbitrary Data"
mpc1.ChartDescriptionColor = Colors.ARGB(200,0,255,255)
mpc1.ChartDescriptionTextSize = 17

mpc1.ValueTextColor = Colors.Black
mpc1.ValueTextSize = 15.0

mpc1.PieColors = Array As Int(Colors.Blue, Colors.Yellow, Colors.Green, Colors.Red, Colors.Magenta, Colors.Cyan)
mpc1.LegendText = Array As String("Jan", "Feb", "Mar", "Apr", "May", "Jun")
mpc1.ChartData = Array As Float(128.0, 16.0, 46.0, 40.0, 30.0, 40.0)    'values - it will be converted to %

mpc1.PieData = 6

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

Attachments

  • b4aMPChart.zip
    7.9 KB · Views: 1,415
  • mpChartLibraryFiles.zip
    221.5 KB · Views: 1,503
  • mpChartLibV1.15.zip
    355.2 KB · Views: 618
  • mpChartLibV1.16.zip
    355.7 KB · Views: 617
  • mpChartLibV1.17.zip
    355.8 KB · Views: 784
  • mpChartLibV1.18.zip
    356.4 KB · Views: 697
  • mpChartLibV1.20.zip
    358.1 KB · Views: 480
  • mpChartLibV1.21.zip
    358 KB · Views: 51
  • mpChartLibV1.22.zip
    359.2 KB · Views: 79
Last edited:

JonRubin

Member
Licensed User
Longtime User
Hi Johan.... I was actually trying this out as I saw your response.... I'll let you how how it works out... Thanks... Jon
 

AmoUser

New Member
Licensed User
It seems that everytime I try to do something with this lib I get error message:

android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:2485)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:4217)
at android.content.res.Resources.getLayout(Resources.java:2301)
at android.view.LayoutInflater.inflate(LayoutInflater.java:413)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.github.mikephil.charting.components.MarkerView.setupLayoutResource(MarkerView.java:39)
at com.github.mikephil.charting.components.MarkerView.<init>(MarkerView.java:29)
at com.github.mikephil.charting.components.MyMarkerView.<init>(MyMarkerView.java:27)
at mpandroidchartwrapper.barChartWrapper.setBarData(barChartWrapper.java:250)
at b4a.example.main._activity_create(main.java:580)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at b4a.example.main.afterFirstLayout(main.java:102)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

I get this message even with examples. Only working example is in post 93.
 

Johan Schoeman

Expert
Licensed User
Longtime User
It seems that everytime I try to do something with this lib I get error message:

android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:2485)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:4217)
at android.content.res.Resources.getLayout(Resources.java:2301)
at android.view.LayoutInflater.inflate(LayoutInflater.java:413)
at android.view.LayoutInflater.inflate(LayoutInflater.java:366)
at com.github.mikephil.charting.components.MarkerView.setupLayoutResource(MarkerView.java:39)
at com.github.mikephil.charting.components.MarkerView.<init>(MarkerView.java:29)
at com.github.mikephil.charting.components.MyMarkerView.<init>(MyMarkerView.java:27)
at mpandroidchartwrapper.barChartWrapper.setBarData(barChartWrapper.java:250)
at b4a.example.main._activity_create(main.java:580)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:703)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at b4a.example.main.afterFirstLayout(main.java:102)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6914)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

I get this message even with examples. Only working example is in post 93.


See my answer here - I think you have the same problem. You are missing files in your project

https://www.b4x.com/android/forum/t...y-files-in-post-188.58017/page-10#post-446408
 

AmoUser

New Member
Licensed User
It seems that these missing files from layout and drawable folders caused the problems.

Is there anyway to set BarChart bar width and spacing between bars?
 
Last edited:

Cenny

Active Member
Licensed User
Longtime User
Have added Single Line Charts to the library. New library files are attached (mpChartLibraryFiles.zip) as well as the B4A project demonstrating the Line Charts. This is an extension of the libs posted before i.e all previous functionality for Pie Chats and Bar Charts are maintained while Single Line Charts have been added (working at present on multi line charts and combo line/bar charts).

You can pinch zoom (in and out) each of the graphs individually or double tap on a graph to zoom in.

View attachment 37353


Some sample code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: MPLineChart
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private mlc1, mlc2, mlc3, mlc4 As LineChart
 
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
 
'    RIGHT_OF_CHART, RIGHT_OF_CHART_CENTER, RIGHT_OF_CHART_INSIDE,
'    LEFT_OF_CHART, LEFT_OF_CHART_CENTER, LEFT_OF_CHART_INSIDE,
'    BELOW_CHART_LEFT, BELOW_CHART_RIGHT, BELOW_CHART_CENTER,

'   LINE, CIRCLE, SQUARE
    mlc1.LegendShapeSize = 7.0        'this line of code needs to be before mlc1.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")
    mlc1.setTheLegendPositionAndForm("BELOW_CHART_LEFT", "CIRCLE")    'pass strings from the above comments
 
    mlc1.TheLegendColor = Colors.White
    mlc1.TheLegendTextSize = 15.0
    mlc1.LegendTitle = "Sine of x (x in degrees)"
 
    mlc1.ChartDescription = "TITLE : A Sine Curve"
    mlc1.ChartDescriptionColor = 0XFFFFA500                 'ORANGE
    mlc1.ChartDescriptionTextSize = 15

    mlc1.ValueTextColor = Colors.Black
    mlc1.ValueTextSize = 7.0
 
    Dim myfloat(73) As Float
    Dim myxvals(73) As String
    Dim j As Int  = 0
    For i = 0 To 360 Step 5
      myfloat(j) = SinD(i)
      myxvals(j) = i
      j = j + 1
    Next

    mlc1.LegendText = myxvals
    mlc1.ChartData = myfloat

    mlc1.DoubleTapToZoomEnabled = True
    mlc1.GridBackgroundColor = Colors.white
    mlc1.DrawBorders = True
    mlc1.DrawGridBackground = True
    mlc1.PinchZoom = True
    mlc1.ScaleEnabled = True
    mlc1.BorderColor = Colors.Red
    mlc1.BorderWidth = 7.0
    mlc1.DrawDashedLine = False
    mlc1.DrawGraphHollowCircles = True

    mlc1.DrawGraphValues = False
    mlc1.GraphCircleSize = 3.0
    mlc1.DrawAxisLine = True
    mlc1.DrawXaxisGridLines = True
    mlc1.DrawYaxisGridLines = True
    mlc1.GraphLineColor = Colors.Yellow
    mlc1.GraphLineWidth = 4.0
 
    'TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
    mlc1.XaxisLabelPosition = "BOTTOM"
    mlc1.XaxisTextColor = Colors.Magenta
    mlc1.XaxisTextSize = 15.0
 
    mlc1.YaxisTextColor = Colors.Green
    mlc1.YaxisTextSize = 15.0
    mlc1.LineData = 73   'this number must be the same as the number of elements in the above arrays
 


'    RIGHT_OF_CHART, RIGHT_OF_CHART_CENTER, RIGHT_OF_CHART_INSIDE,
'    LEFT_OF_CHART, LEFT_OF_CHART_CENTER, LEFT_OF_CHART_INSIDE,
'    BELOW_CHART_LEFT, BELOW_CHART_RIGHT, BELOW_CHART_CENTER,

'   LINE, CIRCLE, SQUARE
    mlc2.LegendShapeSize = 7.0        'this line of code needs to be before mlc2.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")
    mlc2.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "SQUARE")    'pass strings from the above comments
 
    mlc2.TheLegendColor = Colors.Magenta
    mlc2.TheLegendTextSize = 15.0
    mlc2.LegendTitle = "Cosine of x (x in degrees)"
 
    mlc2.ChartDescription = "TITLE : A Cosine Curve"
    mlc2.ChartDescriptionColor = Colors.Black
    mlc2.ChartDescriptionTextSize = 15

    mlc2.ValueTextColor = Colors.Black
    mlc2.ValueTextSize = 7.0
 
    Dim myfloat(73) As Float
    Dim myxvals(73) As String
    Dim j As Int  = 0
    For i = 0 To 360 Step 5
      myfloat(j) = CosD(i)
      myxvals(j) = i
      j = j + 1
    Next

    mlc2.LegendText = myxvals
    mlc2.ChartData = myfloat

    mlc2.DoubleTapToZoomEnabled = True
    mlc2.GridBackgroundColor = Colors.white
    mlc2.DrawBorders = True
    mlc2.DrawGridBackground = True
    mlc2.PinchZoom = True
    mlc2.ScaleEnabled = True
    mlc2.BorderColor = Colors.Green
    mlc2.BorderWidth = 5.0
    mlc2.DrawDashedLine = False
    mlc2.DrawGraphHollowCircles = False

    mlc2.DrawGraphValues = False
    mlc2.GraphCircleSize = 0.0
    mlc2.DrawAxisLine = True
    mlc2.DrawXaxisGridLines = True
    mlc2.DrawYaxisGridLines = True
    mlc2.GraphLineColor = Colors.Cyan
    mlc2.GraphLineWidth = 2.0
 
    'TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
    mlc2.XaxisLabelPosition = "TOP"
    mlc2.XaxisTextColor = Colors.Red
    mlc2.XaxisTextSize = 15.0
 
    mlc2.YaxisTextColor = Colors.Yellow
    mlc2.YaxisTextSize = 15.0
    mlc2.LineData = 73   'this number must be the same as the number of elements in the above arrays  
 



'    RIGHT_OF_CHART, RIGHT_OF_CHART_CENTER, RIGHT_OF_CHART_INSIDE,
'    LEFT_OF_CHART, LEFT_OF_CHART_CENTER, LEFT_OF_CHART_INSIDE,
'    BELOW_CHART_LEFT, BELOW_CHART_RIGHT, BELOW_CHART_CENTER,

'   LINE, CIRCLE, SQUARE
    mlc3.LegendShapeSize = 7.0        'this line of code needs to be before mlc3.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")
    mlc3.setTheLegendPositionAndForm("BELOW_CHART_RIGHT", "LINE")    'pass strings from the above comments
 
    mlc3.TheLegendColor = Colors.Green
    mlc3.TheLegendTextSize = 15.0
    mlc3.LegendTitle = "Day of Week"
 
    mlc3.ChartDescription = "TITLE : Arbitrary Data"
    mlc3.ChartDescriptionColor = Colors.Yellow
    mlc3.ChartDescriptionTextSize = 17

    mlc3.ValueTextColor = Colors.Black
    mlc3.ValueTextSize = 10.0
 
    Dim myfloat() As Float = Array As Float(15.5, 59.2, -16.8, -36.3, 47.8, 5.7, 54.9)
    Dim myxvals() As String = Array As String("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")

    mlc3.LegendText = myxvals
    mlc3.ChartData = myfloat

    mlc3.DoubleTapToZoomEnabled = True
    mlc3.GridBackgroundColor = Colors.White
    mlc3.DrawBorders = True
    mlc3.DrawGridBackground = True
    mlc3.PinchZoom = True
    mlc3.ScaleEnabled = True
    mlc3.BorderColor = Colors.LightGray
    mlc3.BorderWidth = 7.0
    mlc3.DrawDashedLine = True
    mlc3.DrawGraphHollowCircles = True

    mlc3.DrawGraphValues = True
    mlc3.GraphCircleSize = 9.0
    mlc3.GraphCircleColor = Colors.Cyan
    mlc3.DrawAxisLine = True
    mlc3.DrawXaxisGridLines = True
    mlc3.DrawYaxisGridLines = True
    mlc3.GraphLineColor = Colors.Red
    mlc3.GraphLineWidth = 7.0
 
    'TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
    mlc3.XaxisLabelPosition = "TOP"
    mlc3.XaxisTextColor = Colors.Blue
    mlc3.XaxisTextSize = 14.0
 
    mlc3.YaxisTextColor = Colors.White
    mlc3.YaxisTextSize = 13.0
    mlc3.LineData = 7   'this number must be the same as the number of elements in the above arrays      
 
 


'    RIGHT_OF_CHART, RIGHT_OF_CHART_CENTER, RIGHT_OF_CHART_INSIDE,
'    LEFT_OF_CHART, LEFT_OF_CHART_CENTER, LEFT_OF_CHART_INSIDE,
'    BELOW_CHART_LEFT, BELOW_CHART_RIGHT, BELOW_CHART_CENTER,

'   LINE, CIRCLE, SQUARE
    mlc4.LegendShapeSize = 7.0        'this line of code needs to be before mlc4.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")
    mlc4.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")    'pass strings from the above comments
 
    mlc4.TheLegendColor = Colors.Yellow
    mlc4.TheLegendTextSize = 17.0
    mlc4.LegendTitle = "Some Data"
 
    mlc4.ChartDescription = "TITLE : Arbitrary Data"
    mlc4.ChartDescriptionColor = Colors.DarkGray
    mlc4.ChartDescriptionTextSize = 17

    mlc4.ValueTextColor = Colors.Blue
    mlc4.ValueTextSize = 15.0
 
    Dim myfloat() As Float = Array As Float(31.0, -29.0, 67.0, -48.0, 83.0, -54.0, 60.0, -15.0, 37.0, -45.0, 68.0, -5.0)
    Dim myxvals() As String = Array As String("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")

    mlc4.LegendText = myxvals
    mlc4.ChartData = myfloat

    mlc4.DoubleTapToZoomEnabled = True
    mlc4.GridBackgroundColor = Colors.LightGray
    mlc4.DrawBorders = True
    mlc4.DrawGridBackground = True
    mlc4.PinchZoom = True
    mlc4.ScaleEnabled = True
    mlc4.BorderColor = Colors.Green
    mlc4.BorderWidth = 2.0
    mlc4.DrawDashedLine = False
    mlc4.DrawGraphHollowCircles = True

    mlc4.DrawGraphValues = False
    mlc4.GraphCircleSize = 4.0
    mlc4.GraphCircleColor = Colors.Red
    mlc4.DrawAxisLine = True
    mlc4.DrawXaxisGridLines = True
    mlc4.DrawYaxisGridLines = True
    mlc4.GraphLineColor = Colors.DarkGray
    mlc4.GraphLineWidth = 3.0
 
    'TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
    mlc4.XaxisLabelPosition = "BOTH_SIDED"
    mlc4.XaxisTextColor = Colors.White
    mlc4.XaxisTextSize = 14.0
 
    mlc4.YaxisTextColor = Colors.Blue
    mlc4.YaxisTextSize = 13.0
    mlc4.LineData = 12   'this number must be the same as the number of elements in the above arrays      
 
 
 
 

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

Cenny

Active Member
Licensed User
Longtime User
Hi,
I downloaded the the example files to have a look, but the program crashed on line 91.
' mlc1.LineData = 73 'this number must be the same as the number of elements in the above arrays '
android.content.res.Resources$NotFoundException: Resource ID #0x0

Cenny
 

Johan Schoeman

Expert
Licensed User
Longtime User

Cenny

Active Member
Licensed User
Longtime User
I have looked at it but cannot figure out what files would be missing...
I simply downloaded the project.
 

Johan Schoeman

Expert
Licensed User
Longtime User
I have looked at it but cannot figure out what files would be missing...
I simply downloaded the project.

Extract the attached zip folder and then copy it to the B4A project's /Objects folder. In your B4A project folder structure you should have

Objects
res
drawable
icon.png
marker1.png
marker2.png
marker3.png
marker4.png
layout
custom_marker_view_1.xml
custom_marker_view_2.xml
custom_marker_view_3.xml
custom_marker_view_4.xml
Files

Make sure that the property of all the files highlighted in RED above are set to READ ONLY
 

Attachments

  • res.zip
    24.3 KB · Views: 312

Cenny

Active Member
Licensed User
Longtime User
Is there a way I can extract info out of the crosshairs position?
 

Johan Schoeman

Expert
Licensed User
Longtime User
linechart
Attached new library files (V1.02). It will raise an event in the B4A project when a point on the graph is touched (index of the x-axis and value of the y-axis). Use it as follows:

B4X:
Sub mlc1_value_selected(index As Int, value As Float)
   
    Log("index = " & index)
    Log("value = " & value)
   
End Sub

Have added the event to Linechart and MultiLineChart
 

Attachments

  • mpChartLib_V1_02.zip
    355 KB · Views: 241

Cenny

Active Member
Licensed User
Longtime User
Thanks very much Johan.
This is exactly what I was looking for.
 

Cenny

Active Member
Licensed User
Longtime User
Attached new library files (V1.02). It will raise an event in the B4A project when a point on the graph is touched (index of the x-axis and value of the y-axis). Use it as follows:

B4X:
Sub mlc1_value_selected(index As Int, value As Float)
  
    Log("index = " & index)
    Log("value = " & value)
  
End Sub

Have added the event to Linechart and MultiLineChart
Thanks very much Johan.
This is exactly what I was looking for.

Hi Johan,
I have noticed that when the linegraph is zoomed, it is not possible to move the crosshair anymore, because then the graph is moving.
Is there aworkaround for this ?
 

Alex_Puz

Member
Licensed User
Longtime User
Hi, It seems to me Chart "Pi" always fail after it was published at the library in post #12, also can you add touch events at Radar and Pi, thank you so much.
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Hi, It seems to me Chart "Pi" always fail after it was published at the library in post #12, also can you add touch events at Radar and Pi, thank you so much.
See post #209. It should solve your problem.
 
Top