DataPoint pBPM = dBPM.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pBPM = pBPM.setFloatValues(bpm); dBPM.add(pBPM);
DataPoint pActivitySegment = dActivitySegmentDataSet.createDataPoint().setTimeInterval(infoFrom, infoTo, TimeUnit.MILLISECONDS); pActivitySegment.getValue(Field.FIELD_ACTIVITY).setActivity(sleepAct); dActivitySegmentDataSet.add(pActivitySegment);
DataPoint pSteps = dSteps.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pSteps.getValue(Field.FIELD_STEPS).setInt(steps); dSteps.add(pSteps); DataPoint pDistance = dDistance.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pDistance.getValue(Field.FIELD_DISTANCE).setFloat(dist); dDistance.add(pDistance); DataPoint pCalories = dCalories.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pCalories.getValue(Field.FIELD_CALORIES).setFloat(cals); dCalories.add(pCalories); DataPoint pActivitySegment = dActivitySegmentDataSet.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pActivitySegment.getValue(Field.FIELD_ACTIVITY).setActivity(FitnessActivities.WALKING); dActivitySegmentDataSet.add(pActivitySegment);
DataPoint pHeight = dHeight.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pHeight = pHeight.setFloatValues(profileData.getHeight() / 100); dHeight.add(pHeight); DataPoint pWeight = dWeight.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pWeight = pWeight.setFloatValues(profileData.getWeight()); dWeight.add(pWeight);
DataPoint pCalories = dCalories.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pCalories.getValue(Field.FIELD_CALORIES).setFloat(calories); dCalories.add(pCalories); DataPoint pDistance = dDistance.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pDistance.getValue(Field.FIELD_DISTANCE).setFloat(distance); dDistance.add(pDistance); DataPoint pHeartRateAVG = dHeartRateAVG.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pHeartRateAVG.getValue(Field.FIELD_BPM).setFloat((float) avgHeartrate); dHeartRateAVG.add(pHeartRateAVG); DataPoint pSteps = dSteps.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pSteps.getValue(Field.FIELD_STEPS).setInt((int)steps); dSteps.add(pSteps); DataPoint pActivitySegment = dActivitySegmentDataSet.createDataPoint().setTimeInterval(startDate.getTime(), endDate.getTime(), TimeUnit.MILLISECONDS); pActivitySegment.getValue(Field.FIELD_ACTIVITY).setActivity(act); dActivitySegmentDataSet.add(pActivitySegment); DataPoint pLocation = dLocation.createDataPoint().setTimestamp(gpsData.get(k).getTimeStamp(), TimeUnit.MILLISECONDS); pLocation.getValue(Field.FIELD_LONGITUDE).setFloat(gpsData.get(k).getLon()); pLocation.getValue(Field.FIELD_LATITUDE).setFloat(gpsData.get(k).getLat()); pLocation.getValue(Field.FIELD_ALTITUDE).setFloat(gpsData.get(k).getAltitude()); dLocation.add(pLocation); DataPoint pSpeedAVG = dSpeedAVG.createDataPoint().setTimestamp(gpsData.get(k).getTimeStamp(), TimeUnit.MILLISECONDS); pSpeedAVG.getValue(Field.FIELD_SPEED).setFloat(gpsData.get(k).getSpeed()); dSpeedAVG.add(pSpeedAVG);
private DataSet weightData(LinkedList<Measurement> measurements) { DataSource dataSource = new DataSource.Builder() .setAppPackageName(getContext()) .setDataType(DataType.TYPE_WEIGHT) .setType(DataSource.TYPE_RAW) .build(); DataSet dataSet = DataSet.create(dataSource); DataPoint dataPoint; for (Measurement measurement : measurements) { dataPoint = dataSet.createDataPoint().setTimestamp(measurement.getRecordedAt().getTimeInMillis(), TimeUnit.MILLISECONDS); dataPoint.getValue(Field.FIELD_WEIGHT).setFloat(measurement.getWeight()); dataSet.add(dataPoint); } return dataSet; }
private DataSet bodyFatData(LinkedList<Measurement> measurements) { DataSource dataSource = new DataSource.Builder() .setAppPackageName(getContext()) .setDataType(DataType.TYPE_BODY_FAT_PERCENTAGE) .setType(DataSource.TYPE_RAW) .build(); DataSet dataSet = DataSet.create(dataSource); DataPoint dataPoint; for (Measurement measurement : measurements) { if (measurement.getBodyFat() != null) { dataPoint = dataSet.createDataPoint().setTimestamp(measurement.getRecordedAt().getTimeInMillis(), TimeUnit.MILLISECONDS); dataPoint.getValue(Field.FIELD_PERCENTAGE).setFloat(measurement.getBodyFat()); dataSet.add(dataPoint); } } return dataSet; }
private DataSet basalMetabolicRate(LinkedList<Measurement> measurements) { DataSource dataSource = new DataSource.Builder() .setAppPackageName(getContext()) .setDataType(DataType.TYPE_BASAL_METABOLIC_RATE) .setType(DataSource.TYPE_RAW) .build(); DataSet dataSet = DataSet.create(dataSource); DataPoint dataPoint; for (Measurement measurement : measurements) { if (measurement.getDailyCalorieIntake() != null) { dataPoint = dataSet.createDataPoint().setTimestamp(measurement.getRecordedAt().getTimeInMillis(), TimeUnit.MILLISECONDS); dataPoint.getValue(Field.FIELD_CALORIES).setFloat(measurement.getDailyCalorieIntake().floatValue()); dataSet.add(dataPoint); } } return dataSet; }