From: Caisking Date: Thu, 19 Jun 2025 02:52:02 +0000 (+0800) Subject: 血压测量界面增加模拟数据 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=f1e5805b8d2e3678d195ceccd3787f6813c6a7f3;p=mirrors%2FFD230.git 血压测量界面增加模拟数据 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/detection/BPDetectFirstView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/detection/BPDetectFirstView.h index a6ca25723..ad445171a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/detection/BPDetectFirstView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/detection/BPDetectFirstView.h @@ -9,6 +9,7 @@ #include "components/ui_label_ext.h" #include "components/ui_scroll_view.h" #include "components/ui_view_group.h" +#include "components/ui_chart.h" namespace OHOS { class BPDetectFirstView { @@ -18,6 +19,7 @@ public: static BPDetectFirstView *GetInstance(); UIViewGroup *BPDetectFirstInit(); void UpdateText(); //更新文本数据 + void InitChartView(); private: UILabelExt *DBPTitleLabel{nullptr}; @@ -32,6 +34,14 @@ private: UILabelButtonExt *CheckButton{nullptr}; + Point dbpData[24]; + Point sbpData[24]; + + UIChartDataSerial *dbpSerial{nullptr}; + UIChartDataSerial *sbpSerial{nullptr}; + + UIChartPolyline *bpchart = nullptr; + UIViewGroup *group{nullptr}; uint16_t m_dbp_{0}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectEndView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectEndView.cpp index 6374ef23e..83b612276 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectEndView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectEndView.cpp @@ -142,9 +142,9 @@ namespace OHOS InitLabel(HighText, 133, 295, 200, 60, "calibration", "偏高", DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabel(AlertText, 266, 295, 200, 60, "calibration", "预警", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitUILabel(DBPText, 20, 120, 200, 60, "calibration", "---", DEFAULT_VECTOR_FONT_FILENAME, 50); - InitUILabel(SBPText, 240, 120, 200, 60, "calibration", "---", DEFAULT_VECTOR_FONT_FILENAME, 50); - InitUILabel(timeLabel, 133, 115, 200, 60, "calibration", "----/--/-- \n --:--", DEFAULT_VECTOR_FONT_FILENAME, 20); + InitUILabel(DBPText, 20, 120, 200, 60, "calibration", "110", DEFAULT_VECTOR_FONT_FILENAME, 50); + InitUILabel(SBPText, 240, 120, 200, 60, "calibration", "68", DEFAULT_VECTOR_FONT_FILENAME, 50); + InitUILabel(timeLabel, 133, 115, 200, 60, "calibration", "2025/06/18 \n 15:00", DEFAULT_VECTOR_FONT_FILENAME, 20); InitImageView(BPImageView, 208, 10, 100, 100, "image_bp", image_bp); InitImageView(BgWImageView, 0, -75, 100, 100, "image_bg_w", image_bg_w); diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectFirstView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectFirstView.cpp index 615c1a20d..5b2d1aee9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectFirstView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/detection/BPDetectFirstView.cpp @@ -75,6 +75,23 @@ namespace OHOS delete CheckButton; CheckButton = nullptr; } + if(dbpSerial) + { + bpchart->ClearDataSerial(); + delete dbpSerial; + dbpSerial = nullptr; + } + if(sbpSerial == nullptr) + { + bpchart->ClearDataSerial(); + delete sbpSerial; + sbpSerial = nullptr; + } + if(bpchart) + { + delete bpchart; + bpchart = nullptr; + } } delete group; group = nullptr; @@ -99,6 +116,58 @@ namespace OHOS //获取上一次检测数据 ? 待定 } + + void BPDetectFirstView::InitChartView() + { + /* + 测试数据 + */ + Point testdbpData[24] = { {0,110},{1,108},{2,105},{3,102},{4,100},{5,105},{6,110},{7,115},{8,120},{9,125}, + {10,130},{11,132},{12,128},{13,125},{14,122},{15,120},{16,122},{17,125},{18,120},{19,118}, + {20,115},{21,112},{22,108},{23,105} }; + + Point testsbpData[24] = { {0,70},{1,68},{2,65},{3,62},{4,60},{5,62},{6,65},{7,68},{8,70},{9,72}, + {10,75},{11,78},{12,76},{13,74},{14,72},{15,70},{16,72},{17,75},{18,73},{19,70}, + {20,68},{21,65},{22,62},{23,63} }; + + //初始化图表控件 + if (bpchart == nullptr) { + bpchart = new UIChartPolyline(); + } + bpchart->SetPosition(59, 203); + bpchart->Resize(315, 150); + bpchart->SetViewId("uiChart"); + bpchart->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + + //设置坐标轴为透明 + UIXAxis& uiChartXAxis = bpchart->GetXAxis(); + UIYAxis& uiChartYAxis = bpchart->GetYAxis(); + uiChartXAxis.SetMarkNum(24); + uiChartXAxis.SetDataRange(0, 24); + uiChartXAxis.SetLineColor(Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0x00)); + uiChartYAxis.SetMarkNum(5); + uiChartYAxis.SetDataRange(60, 210); + uiChartYAxis.SetLineColor(Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0x00)); + + //设置dbp 和 sbp 数据曲线 + dbpSerial = new UIChartDataSerial(); + dbpSerial->SetMaxDataCount(24); + dbpSerial->AddPoints(testdbpData, 24); + dbpSerial->SetFillColor(Color::GetColorFromRGBA(0x0b, 0xe4, 0x43, 0xff)); + dbpSerial->SetLineColor(Color::GetColorFromRGBA(0x4d, 0xf1, 0x0a, 0xff)); + dbpSerial->EnableGradient(false); + bpchart->AddDataSerial(dbpSerial); + + sbpSerial = new UIChartDataSerial(); + sbpSerial->SetMaxDataCount(24); + sbpSerial->AddPoints(testsbpData, 24); + sbpSerial->SetFillColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); + sbpSerial->SetLineColor(Color::GetColorFromRGBA(0x07, 0x88, 0xe8, 0xff)); + sbpSerial->EnableGradient(false); + bpchart->AddDataSerial(sbpSerial); + bpchart->SetGradientOpacity(0, 0); + // bpchart->SetGradientType(UIChart::GRADIENT_TYPE_HOR); + } /*** * @description: @@ -114,9 +183,9 @@ namespace OHOS /*初始化label*/ InitLabel(DBPTitleLabel, 20, 66, 200, 60, "calibration", "收缩压", DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabel(SBPTitleText, 240, 66, 200, 60, "calibration", "舒张压", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitUILabel(DBPText, 20, 120, 200, 60, "calibration", "---", DEFAULT_VECTOR_FONT_FILENAME, 50); - InitUILabel(SBPText, 240, 120, 200, 60, "calibration", "---", DEFAULT_VECTOR_FONT_FILENAME, 50); - InitUILabel(timeLabel, 133, 115, 200, 60, "calibration", "----/--/-- \n --:--", DEFAULT_VECTOR_FONT_FILENAME, 20); + InitUILabel(DBPText, 20, 120, 200, 60, "calibration", "108", DEFAULT_VECTOR_FONT_FILENAME, 50); + InitUILabel(SBPText, 240, 120, 200, 60, "calibration", "68", DEFAULT_VECTOR_FONT_FILENAME, 50); + InitUILabel(timeLabel, 133, 115, 200, 60, "calibration", "2025/06/18 \n 15:00", DEFAULT_VECTOR_FONT_FILENAME, 20); InitImageView(BPImageView, 208, 10, 100, 100, "image_bp", image_bp); InitImageView(BgWImageView, 0, -75, 100, 100, "image_bg_w", image_bg_w); @@ -130,6 +199,8 @@ namespace OHOS DBPText->SetTextColor(Color::GetColorFromRGBA(0xFF, 0x35, 0x00, 0xFF)); SBPText->SetTextColor(Color::GetColorFromRGBA(0xFF, 0x35, 0x00, 0xFF)); + InitChartView(); + group->Add(DBPTitleLabel); group->Add(SBPTitleText); group->Add(DBPText); @@ -139,6 +210,7 @@ namespace OHOS group->Add(BgWImageView); group->Add(BgQImageView); group->Add(CheckButton); + group->Add(bpchart); UpdateText();