Skip to main content
Version: v3+

SPORT_DATA

Start from API_LEVEL 3.6 . Please refer to API_LEVEL.

Displaying workout data in the workout extension can display a rich variety of workouts data types.

Create UI widget​

import { createWidget, widget } from '@zos/ui'

const sportData = createWidget(widget.SPORT_DATA, Param)

Param: object​

PropertiesDescriptionRequiredType
xWidget x coordinateYESnumber
yWidget y coordinateYESnumber
wWidget display widthYESnumber
hWidget display heightYESnumber
edit_idWidget ID, ensuring uniqueness of each instanceYESnumber
categoryData type, currently only supports edit_widget_group_type.SPORTSYESnumber
default_typeDisplayed data items, see supported data items belowYESnumber
text_sizeText font size, default 36 pxNOnumber
text_colorText color, default 0x0000FFNOnumber
sub_text_visibleWhether to display subtext, default is falseNOboolean
sub_text_sizeSubtext font size, default 36 pxNOnumber
sub_text_colorSubtext color, default 0x0000FFNOnumber
rect_visibleWhether to display the text box, default is falseNOboolean
line_colorText box color, default 0x0000FFNOnumber
text_xRelative coordinates.Text box displays location x coordinatesNOnumber
text_yRelative coordinates.Text box displays position y coordinatesNOnumber
text_wText box widthNOnumber
text_hText box heightNOnumber
sub_text_xRelative coordinates.Subtext box displays position x coordinatesNOnumber
sub_text_yRelative coordinates.Subtext box displays position y coordinatesNOnumber
sub_text_wSecondary text box widthNOnumber
sub_text_hSecondary text box heightNOnumber
mock_dataThe simulated data only takes effect in the emulator, and the data items of the widget will display the incoming stringNOstring

Data item type​

Data item types are accessed through the sport_data object of the @zos/ui module

Data item KeyDescription
DURATION_NETExercise time
DURATION_CUR_SECTIONThis segment time
DURATION_PREV_SECTIONPrevious segment time
DURATION_AVG_SECTIONAverage segment time
DURATION_CUR_GROUPThis set time
DISTANCE_TOTALDistance
DISTANCE_CUR_SECTIONThis segment distance
DISTANCE_PREV_SECTIONPrevious segment distance
COUNT_TOTALTotal count
COUNT_CUR_ROPEThis set count
COUNT_BROKEN_ROPENumber of broken ropes
COUNT_TOTAL_BOATTotal strokes
COUNT_CUR_BOATThis set strokes
COUNT_CUR_FITNESSThis set count
GLIDE_COUNTNumber of descents
GLIDE_TOTAL_DISTANCECumulative descent distance
GLIDE_CUR_DISTANCEThis descent distance
GLIDE_TOTAL_ALTITUDECumulative descent drop
GLIDE_CUR_ALTITUDEThis descent drop
CLIMB_UP_FLOORSFloors ascended
CLIMB_UP_CUR_FLOORSThis segment floors ascended
CLIMB_UP_PREV_FLOORSPrevious segment floors ascended
CLIMB_DOWN_FLOORSFloors descended
CLIMB_DOWN_CUR_FLOORSThis segment floors descended
CLIMB_DOWN_PREV_FLOORSPrevious segment floors descended
CLIMB_UP_FLOORS_IN_MINFloors ascended per minute
CLIMB_UP_TOTAL_ALTITUDEAscent height
CLIMB_UP_CUR_ALTITUDEThis segment ascent height
CLIMB_UP_PREV_ALTITUDEPrevious segment ascent height
CLIMB_DOWN_ALTITUDE_TOTALDescent height
CLIMB_DOWN_CUR_ALTITUDEThis segment descent height
CLIMB_DOWN_PREV_ALTITUDEPrevious segment descent height
SWIM_TOTAL_LAPSNumber of trips
SWIM_CUR_LAPSThis segment trips
SWIM_PREV_LAPSPrevious segment trips
SWIM_TOTAL_STROKE_countTotal paddle strokes
SWIM_CUR_STROKE_countThis segment paddle strokes
SWIM_PREV_STROKE_countPrevious segment paddle strokes
SWIM_AVG_STROKE_DISTANCEAverage paddle distance
SWIM_AVG_SECTION_STROKE_countAverage paddle strokes per segment
SWIM_STROKE_SPEEDPaddle stroke rate
SWIM_CUR_STROKE_SPEEDThis segment paddle stroke rate
SWIM_PREV_STROKE_SPEEDPrevious segment paddle stroke rate
SWIM_AVG_STROKE_SPEEDAverage paddle stroke rate
SWIM_AVG_SWOLFAverage Swolf
SWIM_CUR_SWOLFThis segment Swolf
SWIM_PREV_SWOLFPrevious segment Swolf
PACEPace
PACE_AVGAverage pace
PACE_CUR_AVGThis segment pace
PACE_PREV_AVGPrevious segment pace
STRIDE_FREQCadence
STRIDE_AVG_FREQAverage cadence
STRIDE_CUR_FREQThis segment cadence
STRIDE_PREV_FREQPrevious segment cadence
STRIDEStride length
STRIDE_AVGAverage stride length
STRIDE_CURThis segment stride length
STRIDE_PREVPrevious segment stride length
STRIDE_COUNTSteps
SPEEDSpeed
SPEED_AVGAverage speed
SPEED_AVG_GLIDEAverage descent speed
SPEED_PREV_GLIDEPrevious descent speed
SPEED_CUR_SECTIONThis segment speed
SPEED_PREV_SECTIONPrevious segment speed
SPEED_MAXMaximum speed
SPEED_VERTICALVertical speed
ALTITUDEAltitude
ALTITUDE_MAXMaximum altitude
ALTITUDE_MINMinimum altitude
ALTITUDE_AVGAverage altitude
SLOPE_TOTAL_RISING_DISTANCECumulative ascent
SLOPE_CUR_RISING_DISTANCEThis segment ascent
SLOPE_PREV_RISING_DISTANCEPrevious segment ascent
ALTITUDE_TOTAL_UPCumulative ascent
ALTITUDE_CUR_UPThis segment ascent
ALTITUDE_PREV_UPPrevious segment ascent
ALTITUDE_TOTAL_DOWNCumulative descent
ALTITUDE_CUR_DOWNThis segment descent
ALTITUDE_PREV_DOWNPrevious segment descent
SLOPEGradient
SLOPE_AVGAverage gradient
SLOPE_CURThis segment gradient
SLOPE_PREVPrevious segment gradient
SLOPE_GLIDEGlide ratio
SLOPE_AVG_GLIDEAverage glide ratio
SLOPE_CUR_GLIDEThis segment glide ratio
SLOPE_PREV_GLIDEPrevious segment glide ratio
BRANDISH_TOTAL_countTotal shots
BRANDISH_POSITIVE_countForehand shots
BRANDISH_NEGATIVE_countBackhand shots
BRANDISH_SERVE_countServes
CONSUMEConsumption
CONSUME_CURThis set consumption
BOATING_FREQStroke rate
BOATING_AVG_FREQAverage stroke rate
BOATING_CUR_FREQThis set average stroke rate
BOATING_PULLPull time
BOATING_PUSHRecovery time
FREQFrequency
FREQ_AVGAverage frequency
FREQ_CURThis set average frequency
GOLF_SPEEDHand speed
GOLF_ANGLEPlane
GOLF_UP_TIMEUpstroke time
GOLF_DOWN_TIMEDownstroke time
GOLF_BEATRhythm
GOLF_SWING_COUNTER_GROUPThis set strokes
GOLF_SWING_COUNTERTotal strokes
GOLF_AVG_SCOREAverage score
GOLF_SCOREScore
HRHeart rate
HR_AVGAverage heart rate
HR_CUR_AVGThis set average heart rate
HR_INTERVALHeart rate zone
HR_MAX_PERCENTMaximum heart rate percentage
HR_RESERVED_PERCENTReserve heart rate percentage
HR_AVG_MAX_PERCENTAverage maximum heart rate percentage
HR_AVG_RESERVED_PERCENTAverage reserve heart rate percentage
HR_CUR_SECTIONThis segment heart rate
HR_CUR_MAX_PERCENTThis segment maximum heart rate percentage
HR_CUR_RESERVED_PERCENTThis segment reserve heart rate percentage
HR_PREV_SECTIONPrevious segment heart rate
HR_PREV_MAX_PERCENTPrevious segment maximum heart rate percentage
HR_PREV_RESERED_PERCENTPrevious segment reserve heart rate percentage
PRESSUREPressure
PRESSURE_AVGAverage pressure
PRESSURE_CURThis segment pressure
PRESSURE_PREVPrevious segment pressure
TEMPTemperature
TEMP_MAXMaximum temperature
TEMP_MINMinimum temperature
OTHER_SECTION_ORDERCurrent set
OTHER_AEROBIC_TEAerobic TE
OTHER_ANAEROBIC_TEAnaerobic TE
OTHER_TRAIN_LOADTraining load
OTHER_CUR_TIMECurrent time
OTHER_SUNRISE_TIMESunrise time
OTHER_SUNSET_TIMESunset time
OTHER_BORAMETERBarometric pressure
OTHER_ACTIONNAMEMovement name
CHART_HRHeart rate graph
CHART_SPEEDSpeed graph
CHART_STROKE_FREPStroke rate graph
CHART_TETraining effect graph
CHART_STROKE_SPEEDPaddle stroke rate graph
CHART_PACEPace graph
CHART_ALTITUDEAltitude graph
CHART_FREQFrequency graph
DEVICE_POWERPower
DEVICE_POWER_WEIGHTPower-to-weight ratio
DEVICE_WORKWork
DEVICE_AVG_POWERAverage power
DEVICE_MAX_POWERMaximum power
DEVICE_3S_AVG_POWER3s average power
DEVICE_10S_AVG_POWER10s average power
DEVICE_30S_AVG_POWER30s average power
DEVICE_LAP_AVG_POWERThis segment power
DEVICE_PREV_AVG_POWERPrevious segment power
DEVICE_CADENCECadence
DEVICE_FAST_CADENCEMaximum cadence
DEVICE_AVG_CADENCEAverage cadence
DEVICE_LAP_AVG_CADENCEThis segment cadence
DEVICE_PREV_AVG_CADENCEPrevious segment cadence
DURATION_GLIDEDescent time
DURATION_TOTAL_CLIMBAscent time
GLIDE_PREV_DISTANCEPrevious descent distance
GLIDE_PREV_ALTITUDEPrevious descent drop
SPEED_MAX_GLIDEMaximum descent speed
SLOPE_GLIDE_MAXMaximum descent gradient
SLOPE_GLIDE_AVGAverage descent gradient
GLIDE_ANGLE_MAXMaximum descent angle
GLIDE_ANGLE_AVGAverage descent angle
DURATION_SURFACETime on water
DURATION_CUR_DIVINGThis dive time
DURATION_PREV_DIVINGPrevious dive time
COUNT_DIVINGNumber of dives
COUNT_CAUGHTCatch count
SPEED_DIVINGDive speed
DEPTHDepth
DEPTH_AVGAverage depth
DEPTH_MAXMaximum depth
DEPTH_MAX_PREVPrevious dive depth
HEIGHTElevation
DESENT_SPEEDDescent rate
DESENT_SPEED_MAXMaximum descent rate
DESENT_SPEED_AVGAverage descent rate
SKYDIVING_HEIGHTParachute jump height
COUNT_CONTINUOUS_ROPEMaximum consecutive jumps

Code example​

import { createWidget, widget } from '@zos/ui'

createWidget(widget.SPORT_DATA, {
edit_id: 1,
category: edit_widget_group_type.SPORTS,
default_type: sport_data.CONSUME,
x: 50,
y: 200,
w: 380,
h: 80
})

Additional Examples​

Example 1​

import { createWidget, edit_widget_group_type, sport_data, widget } from '@zos/ui'

createWidget(widget.SPORT_DATA, {
x: 60,
y: 120,
w: 360,
h: 120,
edit_id: 1,
category: edit_widget_group_type.SPORTS,
default_type: sport_data.DURATION_NET,
line_color: 0x0000ff,
text_size: 36,
text_color: 0xffffff,
text_x: 24,
text_y: 16,
text_w: 312,
text_h: 40,
})