Irene Serrano
06/17/2021, 10:16 PMlateinit property series has not been initialized
error. I don't really know what a good work around would be, any advice would be helpful? Thanks
To give background, I am trying to create a line graph using GraphView library
// create a new data series
lateinit var series: LineGraphSeries<DataPoint>
// link activity to layout view
val graph: GraphView = findViewById(R.id.line_chart)
// try to read and save data into series
val minput = InputStreamReader(assets.open("tester_data_CSV.csv"))
val reader = BufferedReader(minput)
var line: String
var x: Double
var y: Double
while (reader.readLine().also { line = it } != null) {
val row: List<String> = line.split(",")
x = row[0].toDouble()
y = row[1].toDouble()
// add data to series, unsure what the last element is for
series.appendData(DataPoint(x,y),true, 100)
}
// add series to graph
graph.addSeries(series)
Francesc
06/17/2021, 10:27 PMIrene Serrano
06/17/2021, 10:30 PMkevindmoore
06/17/2021, 11:06 PM