function onDataReceived(data) {
  Log.Info('Data received!')
  console.log('data received!')

  const extractKey = (key, dflt = 0) => (obj) => (obj[key] ?? dflt);
  extractKey.rnd = (key, dec = 0) => (obj) => round(extractKey(key)(obj), dec)

  state.raw.push(...data);
  state.times.push(...data.map(extractKey('time')));
  state.altitudes.push(...data.map(extractKey.rnd('altitude', 2)));
  state.pressures.push(...data.map(extractKey.rnd('pressure', 2)));
  state.internalTemps.push(...data.map(extractKey.rnd('internalTemp', 1)));
  state.externalTemps.push(...data.map(extractKey.rnd('externalTemp', 1)));
  
  state.speeds.push(...data.map(extractKey('speeds')));
  state.payloads.push(...data.map(extractKey('payloads')));
}
/**
 * Transforms data received from Go (backend) into chart data
 * and add it to the current data.
 *
 * @param {Array<TransformedData>} data
 */
Transforms data received from Go (backend) into chart data
and add it to the current data.

@param {Array} data
Transforms data received from Go ( backend ) into chart data and add it to the current data . @param { Array } data
function onDataReceived(data) {
  Log.Info('Data received!')
  console.log('data received!')
  const extractKey = (key, dflt = 0) => (obj) => (obj[key] ?? dflt);
  extractKey.rnd = (key, dec = 0) => (obj) => round(extractKey(key)(obj), dec)
  state.raw.push(...data);
  state.times.push(...data.map(extractKey('time')));
  state.altitudes.push(...data.map(extractKey.rnd('altitude', 2)));
  state.pressures.push(...data.map(extractKey.rnd('pressure', 2)));
  state.internalTemps.push(...data.map(extractKey.rnd('internalTemp', 1)));
  state.externalTemps.push(...data.map(extractKey.rnd('externalTemp', 1)));
  state.speeds.push(...data.map(extractKey('speeds')));
  state.payloads.push(...data.map(extractKey('payloads')));
}
function onDataReceived ( data ) { Log . Info ( 'Data received!' ) console . log ( 'data received!' ) const extractKey = ( key , dflt = 0 ) => ( obj ) => ( obj [ key ] ?? dflt ) ; extractKey . rnd = ( key , dec = 0 ) => ( obj ) => round ( extractKey ( key ) ( obj ) , dec ) state . raw . push ( ... data ) ; state . times . push ( ... data . map ( extractKey ( 'time' ) ) ) ; state . altitudes . push ( ... data . map ( extractKey . rnd ( 'altitude' , 2 ) ) ) ; state . pressures . push ( ... data . map ( extractKey . rnd ( 'pressure' , 2 ) ) ) ; state . internalTemps . push ( ... data . map ( extractKey . rnd ( 'internalTemp' , 1 ) ) ) ; state . externalTemps . push ( ... data . map ( extractKey . rnd ( 'externalTemp' , 1 ) ) ) ; state . speeds . push ( ... data . map ( extractKey ( 'speeds' ) ) ) ; state . payloads . push ( ... data . map ( extractKey ( 'payloads' ) ) ) ; }
Transforms data received from Go (backend) into chart data
 and add it to the current data.
Transforms data received from Go ( backend ) into chart data and add it to the current data .