Showing
1 changed file
with
20 additions
and
16 deletions
| @@ -533,10 +533,11 @@ class _HrvLineChartState extends State<_HrvLineChart> { | @@ -533,10 +533,11 @@ class _HrvLineChartState extends State<_HrvLineChart> { | ||
| 533 | Widget build(BuildContext context) { | 533 | Widget build(BuildContext context) { |
| 534 | return LineChart( | 534 | return LineChart( |
| 535 | LineChartData( | 535 | LineChartData( |
| 536 | + clipData: const FlClipData.none(), | ||
| 536 | minX: 0, | 537 | minX: 0, |
| 537 | maxX: widget.maxSeconds, | 538 | maxX: widget.maxSeconds, |
| 538 | minY: 0, | 539 | minY: 0, |
| 539 | - maxY: 80, | 540 | + maxY: 100, |
| 540 | gridData: FlGridData( | 541 | gridData: FlGridData( |
| 541 | show: true, | 542 | show: true, |
| 542 | drawVerticalLine: true, | 543 | drawVerticalLine: true, |
| @@ -624,7 +625,7 @@ class _HrvLineChartState extends State<_HrvLineChart> { | @@ -624,7 +625,7 @@ class _HrvLineChartState extends State<_HrvLineChart> { | ||
| 624 | ], | 625 | ], |
| 625 | lineTouchData: LineTouchData( | 626 | lineTouchData: LineTouchData( |
| 626 | getTouchLineStart: (barData, spotIndex) => 0, | 627 | getTouchLineStart: (barData, spotIndex) => 0, |
| 627 | - getTouchLineEnd: (barData, spotIndex) => 90, | 628 | + getTouchLineEnd: (barData, spotIndex) => 100, |
| 628 | handleBuiltInTouches: false, | 629 | handleBuiltInTouches: false, |
| 629 | touchSpotThreshold: 20.0, | 630 | touchSpotThreshold: 20.0, |
| 630 | touchCallback: | 631 | touchCallback: |
| @@ -685,7 +686,7 @@ class _HrvLineChartState extends State<_HrvLineChart> { | @@ -685,7 +686,7 @@ class _HrvLineChartState extends State<_HrvLineChart> { | ||
| 685 | touchTooltipData: LineTouchTooltipData( | 686 | touchTooltipData: LineTouchTooltipData( |
| 686 | tooltipRoundedRadius: 8, | 687 | tooltipRoundedRadius: 8, |
| 687 | showOnTopOfTheChartBoxArea: true, | 688 | showOnTopOfTheChartBoxArea: true, |
| 688 | - tooltipMargin: 6, | 689 | + tooltipMargin: 0, |
| 689 | tooltipBorder: BorderSide.none, | 690 | tooltipBorder: BorderSide.none, |
| 690 | maxContentWidth: 400, | 691 | maxContentWidth: 400, |
| 691 | fitInsideHorizontally: true, | 692 | fitInsideHorizontally: true, |
| @@ -903,20 +904,23 @@ class _StressBarChartState extends State<_StressBarChart> { | @@ -903,20 +904,23 @@ class _StressBarChartState extends State<_StressBarChart> { | ||
| 903 | // 自定义指示线 (只在 Stack 层手绘一条垂直灰色指示线,与柱子对齐,高度到达顶部以与 tooltip 连上) | 904 | // 自定义指示线 (只在 Stack 层手绘一条垂直灰色指示线,与柱子对齐,高度到达顶部以与 tooltip 连上) |
| 904 | Positioned? customIndicator; | 905 | Positioned? customIndicator; |
| 905 | if (_stressTouchedGroupIndex != null) { | 906 | if (_stressTouchedGroupIndex != null) { |
| 906 | - final stepWidth = barWidth + groupsSpace; | ||
| 907 | - final centerOfBar = | ||
| 908 | - _stressTouchedGroupIndex! * stepWidth + (barWidth / 2); | ||
| 909 | - customIndicator = Positioned( | ||
| 910 | - left: centerOfBar - 1.0, // 2px 宽度,居中 | ||
| 911 | - width: 2.0, | ||
| 912 | - top: 16.0, // 向上延展以连接 tooltip 底部 | ||
| 913 | - bottom: chartHeight - gridBottom, // 修正:bottom 指的是距离 Stack 底部的像素值 | ||
| 914 | - child: IgnorePointer( | ||
| 915 | - child: ColoredBox( | ||
| 916 | - color: context.colors.textTertiary.withAlpha(125), | 907 | + final touchedSec = _stressTouchedGroupIndex! * slotSec; |
| 908 | + if (slotStateMap.containsKey(touchedSec)) { | ||
| 909 | + final stepWidth = barWidth + groupsSpace; | ||
| 910 | + final centerOfBar = | ||
| 911 | + _stressTouchedGroupIndex! * stepWidth + (barWidth / 2); | ||
| 912 | + customIndicator = Positioned( | ||
| 913 | + left: centerOfBar - 1.0, // 2px 宽度,居中 | ||
| 914 | + width: 2.0, | ||
| 915 | + top: 12.0, // 向上延展以连接 tooltip 底部 | ||
| 916 | + bottom: chartHeight - gridBottom, // 修正:bottom 指的是距离 Stack 底部的像素值 | ||
| 917 | + child: IgnorePointer( | ||
| 918 | + child: ColoredBox( | ||
| 919 | + color: context.colors.textTertiary.withAlpha(125), | ||
| 920 | + ), | ||
| 917 | ), | 921 | ), |
| 918 | - ), | ||
| 919 | - ); | 922 | + ); |
| 923 | + } | ||
| 920 | } | 924 | } |
| 921 | 925 | ||
| 922 | return Stack( | 926 | return Stack( |
-
Please register or login to post a comment