Italian generare grafici spline

Angelo Messina

Active Member
Licensed User
Longtime User
Salve desideravo qualche indicazione per generare dei grafici Spline come l'esempio :

upload_2017-4-10_10-22-37.png

due serie di valori da cinque medie.
 

Angelo Messina

Active Member
Licensed User
Longtime User
Buona sera, ho seguito il tuo consiglio per usare la libreria by @Johan Schoeman, se eseguo la demo annessa tutto a posto ma nella mia app
genera un errore
esattamente nelle linea che contiene mlc1.setLineData(2,5)
ho seguito le indicazioni della Demo
ma nulla da fare
ho preso la mia sub e lo inserita nelle demo è funziona

mlc1.Chart_1_Data = Array As Float( 1.8178350925445557 , 0.893185019493103 , 0.8867849707603455 , 0.8851850032806396 , 1.7836799621582031)
mlc1.Chart_2_Data = Array As Float( 1.6577963829040527 , 1.6619549989700317 , 1.677471399307251 , 1.6787924766540527 , 1.6442874670028687)
mlc1.XaxisLables = Array As String("5 Sec.", "7 Sec.", "10 Sec.", "12 Sec.", "15 Sec.")
mlc1.XaxisLabelPosition = "BOTTOM"

sai consigliarmi qualcosa

ecco il log

94 mlc1.setLineData(2,5)

Error occurred on line: 94 (Grafico)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1429)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2858)
at android.content.res.Resources.getLayout(Resources.java:1209)
at android.view.LayoutInflater.inflate(LayoutInflater.java:412)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
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:24)
at mpandroidchartwrapper.multiLineChartWrapper.setLineData(multiLineChartWrapper.java:462)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
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.grafico.afterFirstLayout(grafico.java:102)
at b4a.example.grafico.access$000(grafico.java:17)
at b4a.example.grafico$WaitForLayout.run(grafico.java:80)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5534)
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:955)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
 

MarcoRome

Expert
Licensed User
Longtime User
Buona sera, ho seguito il tuo consiglio per usare la libreria by @Johan Schoeman, se eseguo la demo annessa tutto a posto ma nella mia app
genera un errore
esattamente nelle linea che contiene mlc1.setLineData(2,5)
ho seguito le indicazioni della Demo
ma nulla da fare
ho preso la mia sub e lo inserita nelle demo è funziona

mlc1.Chart_1_Data = Array As Float( 1.8178350925445557 , 0.893185019493103 , 0.8867849707603455 , 0.8851850032806396 , 1.7836799621582031)
mlc1.Chart_2_Data = Array As Float( 1.6577963829040527 , 1.6619549989700317 , 1.677471399307251 , 1.6787924766540527 , 1.6442874670028687)
mlc1.XaxisLables = Array As String("5 Sec.", "7 Sec.", "10 Sec.", "12 Sec.", "15 Sec.")
mlc1.XaxisLabelPosition = "BOTTOM"

sai consigliarmi qualcosa

ecco il log

94 mlc1.setLineData(2,5)

Error occurred on line: 94 (Grafico)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1429)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2858)
at android.content.res.Resources.getLayout(Resources.java:1209)
at android.view.LayoutInflater.inflate(LayoutInflater.java:412)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
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:24)
at mpandroidchartwrapper.multiLineChartWrapper.setLineData(multiLineChartWrapper.java:462)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
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.grafico.afterFirstLayout(grafico.java:102)
at b4a.example.grafico.access$000(grafico.java:17)
at b4a.example.grafico$WaitForLayout.run(grafico.java:80)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5534)
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:955)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)

L'errore lo vedi qui, non hai copiato la cartella/files delle risorse
Resource ID #0x0

Nelle note di @Johan Schoeman trovi:
...
1. You can choose any of 4 different pop-up icons in the code by passing the appropriate value (see for eg the code mlc2.MarkerToUse = 2 for the line chart)
2. There are 4 files in the /Objects/res/layout folder of the attached B4A project named custom_marker_view_1, custom_marker_view_2, custom_marker_view_3, and custom_marker_view_4. They need to be included in any project that you develop. Don't change them. They are all set to read only
3. Other than the icon.png file in the /Objects/res/drawable folder of the attached B4A project there are another 4 png images called marker1.png, marker2.png, marker3.png, and marker4.png. These are the markers that are used as pop-ups when you touch a bar / data point. These files are all set to read only. You can add your own marker image as long as what you name/replace your png file marker1.png, marker2.png, marker3.png, or marker4.png and then pass the appropriate value from the B4A project to the library.
...
Dipende da quale libreria hai utilizzato.
Altra cosa non meno importante. Se utilizzi le stesse effettua una DONAZIONE a @Johan Schoeman , creare wrapper porta via un mucchio di tempo, quindi ritengo giusto e opportuno che nel caso vengano utilizzate si effettui una piccola donazione ( 5-10$ ). La stessa la puoi effettuare cliccando in basso ( lo vedi su ogni post di @Johan Schoeman )

upload_2017-4-11_19-52-54.png
 

Angelo Messina

Active Member
Licensed User
Longtime User
funziona ! grazie

ho deciso di non usarle perché appesantisce l'app che è già grossa.
non farò grafici ..
Grazie comunque !

E' mio stile riconoscere i meriti.

Ciao
 

Star-Dust

Expert
Licensed User
Longtime User
Top