ho visto la libreria e ho creato un panel e messo una custom view.
ho caricato tramite tool--->configure path --> la libreria del grafico (che infatti mi appare su libraries)
poi ho messo questo :
Sub caricagrafico
panel4.Visible=False
Panel3.Visible= False
Panel2.Visible= False
Panel1.Visible= False
panel5.Visible= False
panel6.Visible= True
mbc1.LegendShapeSize = 7.0 'this line of code needs to be before mbc1.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE")
mbc1.setTheLegendPositionAndForm("BELOW_CHART_CENTER", "CIRCLE") 'pass strings from the above comments
mbc1.TheLegendColor = Colors.yellow
mbc1.TheLegendTextSize = 20.0
mbc1.LegendTitle = ""
mbc1.ChartDescription = "TITLE : Some Arbitrary Data"
mbc1.ChartDescriptionColor = Colors.Blue
mbc1.ChartDescriptionTextSize = 17
mbc1.setDescriptionPosition(mbc1.left + 14%x ,mbc1.top + 1%y)
mbc1.ValueTextColor = Colors.Black
mbc1.ValueTextSize = 10.0
mbc1.BarColors = Array As Int(Colors.Blue, Colors.Yellow, Colors.Green, Colors.Red, Colors.Magenta, Colors.Cyan, Colors.Blue, Colors.Yellow, Colors.Green, Colors.Red, Colors.Magenta, Colors.Cyan)
mbc1.LegendText = Array As String("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
mbc1.ChartData = Array As Float(52.3, -16.7, 46.0, -40.5, 101.6, 40.9, 15.7, 25.9, 35.6, -25.3, 67.5, 75.2) 'values - it will be converted to %
mbc1.DoubleTapToZoomEnabled = True
mbc1.DrawBarShadow = False
mbc1.GridBackgroundColor = Colors.white
mbc1.ValueTextColor = 0XFFFFA500
mbc1.DrawBorders = True
mbc1.DrawGridBackground = True
mbc1.DrawHighlightArrow = True
mbc1.DrawValueAboveBar = True
mbc1.PinchZoom = True
mbc1.ScaleEnabled = True
mbc1.BorderColor = Colors.Yellow
mbc1.BorderWidth = 3.0
' TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE
mbc1.XaxisLabelPosition = "BOTTOM"
mbc1.XaxisTextSize = 15.0
mbc1.XaxisTextColor = Colors.Magenta
mbc1.DrawYaxisGridLines = True
mbc1.YaxisTextColor = Colors.Green
mbc1.YaxisTextSize = 15.0
mbc1.BarData = 12 'this number must be the same as the number of elements in the above arrays
End Sub
e nel sub global ho aggiunto :
Sub Globals
Private mbc1 As BarChart
End Sub
ma mi da errore :
** Activity (main) Create, isFirst = true **
Error occurred on line: 53 (Main)
java.lang.RuntimeException: java.lang.RuntimeException: Field mbc1 was declared with the wrong type.
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.samples.mysql.main.afterFirstLayout(main.java:102)
at anywheresoftware.b4a.samples.mysql.main.access$000(main.java:17)
at anywheresoftware.b4a.samples.mysql.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:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.RuntimeException: Field mbc1 was declared with the wrong type.
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:399)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:425)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:144)
... 17 more
** Activity (main) Resume **
come mai?