Skip to content

Instantly share code, notes, and snippets.

@mikepyts
Created April 20, 2019 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikepyts/060866b47ec454c407fc046fbf4ff495 to your computer and use it in GitHub Desktop.
Save mikepyts/060866b47ec454c407fc046fbf4ff495 to your computer and use it in GitHub Desktop.
// Data holders
val temperatureData = mutableListOf<Float>()
val pressureData = mutableListOf<Float>()
val timeData = mutableListOf<Float>()
// Convert data from BigQuery JsonTable to data arrays
fun processData(tableData: JsonTable) {
tableData.rows.forEach {
it.f.forEachIndexed { index, element ->
when (index) {
0 -> temperatureData.add(element.v.toFloat())
1 -> pressureData.add(element.v.toFloat())
2 -> timeData.add(simpleDateFormat.parse(element.v).time.toFloat())
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment