B4J Question Use of a list in scatter chart of library jChat

Cal4th

Member
I am trying to csv files to plot a series in a scatter chart but it is not letting me, could someone help me solve the problem

Iam using the below for loop for it:

B4X:
  Xc = File.ReadList(File.DirApp, "naca0015x.csv")
  Yc = File.ReadList(File.DirApp, "naca0015y.csv")
 Dim Series1 As XYSeries
    Series1.Initialize("Original Profile")
    For i = 0 To Xc.Size - 1 'Xc adn Yc are the same size
        Series1.Add(Xc.Get(i),Yc.Get(i))
    Next
    ScatterChart.AddSeries(Series1)

the error that appears in the log file is "java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number"
 

Cal4th

Member
Thank you Erel, i tried it but know another error appears,and i dont understand what it means.
if you can help me i will appreciate it double.

Error:
java.lang.NumberFormatException: For input string: "1"

Code changed:
B4X:
    Dim Series As XYSeries
    Series.Initialize("Original Profile")
    For i = 0 To Xc.Size - 1
        Dim x As Double = Xc.Get(i)
        Dim y As Double = Yc.Get(i)
        Series.Add(x, y)
    Next
 
Upvote 0
Top