B4J Question Passing data from .csv to Scatter Chart of jChart

Discussion in 'B4J Questions' started by Cal4th, Jan 3, 2018.

  1. Cal4th

    Cal4th Member

    I am trying to pass x and y points from .csv files to plot them in the scatter chart of jChart library.
    Xc = File.ReadList(File.DirApp, "naca0015x.csv")
        Yc = 
    File.ReadList(File.DirApp, "naca0015y.csv")
    Dim Series As XYSeries
    "Original Profile")
    For i = 0 To Xc.Size - 1 ' Xc and Yc are the same size
            Dim x As Double = Xc.Get(i) '(error  occurs in this line)
            Dim y As Double = Yc.Get(i)
            Series.Add(x, y)
    The error that appears in the log is the following:

    Error occurred on line: (Line indicated in the code comments) (Main)
    java.lang.NumberFormatException: For input string: "1"
  2. Erel

    Erel Administrator Staff Member Licensed User

    Your file includes the UTF8 BOM.
    It is an extra character at the beginning of the text.

    You can either remove it yourself with Notepad++ or skip it:
    Xc = File.ReadList(File.DirApp, "naca0015x.csv")
     Yc = 
    File.ReadList(File.DirApp, "naca0015y.csv")
    Dim s As String = Xc.Get(0)
    0, s.Substring(1))
    s = Yc.Get(
    0, s.SubString(1))
  3. Cal4th

    Cal4th Member


    I change the File fromat from UTF8 BOM to a UTF8 and it worked with Notepad++.

    Thankyou a lot again.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice