It has a problem with GTR3 as well. I think it's FW issue because I tried it. official watch face Also had the same problem with the watch face I created (I use the same commands as the official watch face). I tried troubleshooting for a few days and couldn't fix it. The symptom on the GTR3 is that when used for a few days, the Graph will stop working, need to select another watch face Then came back to select the same watch face, the Graph will be work again, So I didn't continue it.
As for GTR4, I'm not sure what the problem is.
This is the code used to display the graph.
Code: Select all
let heart_num = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
x: 198,
y: 410,
type: hmUI.data_type.HEART,
font_array:["Act_font_0.png","Act_font_1.png","Act_font_2.png","Act_font_3.png","Act_font_4.png","Act_font_5.png","Act_font_6.png","Act_font_7.png","Act_font_8.png","Act_font_9.png"],
h_space: 2,
align_h: hmUI.align.CENTER_H,
padding: false,
isCharacter: true,
invalid_image: "Act_font_0.png",
isCharacter: true,
unit_sc:"bpm.png",
unit_tc: "bpm.png",
unit_en: "bpm.png",
});
/////////////////////// show value max , min /////////////////////////
let heartArr = hmSensor.createSensor(hmSensor.id.HEART).today;
let min_heart = Math.min(...heartArr)
let max_heart = Math.max(...heartArr)
let maxText = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
x: 300,
y: 100,
text: max_heart,
type: hmUI.data_type.HEART,
font_array:["Act_font_0.png","Act_font_1.png","Act_font_2.png","Act_font_3.png","Act_font_4.png","Act_font_5.png","Act_font_6.png","Act_font_7.png","Act_font_8.png","Act_font_9.png"],
h_space: 2,
align_h: hmUI.align.RIGHT,
padding: false,
isCharacter: true,
});
let minText = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
x: 300,
y: 170,
text: min_heart,
type: hmUI.data_type.HEART,
font_array:["Act_font_0.png","Act_font_1.png","Act_font_2.png","Act_font_3.png","Act_font_4.png","Act_font_5.png","Act_font_6.png","Act_font_7.png","Act_font_8.png","Act_font_9.png"],
h_space: 2,
align_h: hmUI.align.RIGHT,
padding: false,
isCharacter: true,
});
//////////////////// Update min max /////////////////////////
let intervalId;
function updateDataHeart() {
let heart = hmSensor.createSensor(hmSensor.id.HEART);
let heartArr = heart.today
let min_heart = Math.min(...heartArr)
let max_heart = Math.max(...heartArr)
normal_heart_rate_text_text_max_img.setProperty(hmUI.prop.MORE, {
x: 330,
y: 100,
text: max_heart,
type: hmUI.data_type.HEART,
font_array: ["Act_font_0.png", "Act_font_1.png", "Act_font_2.png", "Act_font_3.png", "Act_font_4.png", "Act_font_5.png", "Act_font_6.png", "Act_font_7.png", "Act_font_8.png", "Act_font_9.png"],
h_space: 2,
align_h: hmUI.align.RIGHT,
padding: false,
isCharacter: true,
show_level: hmUI.show_level.ONLY_NORMAL,
});
normal_heart_rate_text_text_min_img.setProperty(hmUI.prop.MORE, {
x: 330,
y: 170,
text: min_heart,
type: hmUI.data_type.HEART,
font_array: ["Act_font_0.png", "Act_font_1.png", "Act_font_2.png", "Act_font_3.png", "Act_font_4.png", "Act_font_5.png", "Act_font_6.png", "Act_font_7.png", "Act_font_8.png", "Act_font_9.png"],
h_space: 2,
align_h: hmUI.align.RIGHT,
padding: false,
isCharacter: true,
show_level: hmUI.show_level.ONLY_NORMAL,
});
}
intervalId = setInterval(updateDataHeart, 1000);
//dynamic modify end
Anyone interested can test it.