修复AxisindicatorLabel无法隐藏的问题

This commit is contained in:
monitor1394
2025-11-05 22:49:23 +08:00
parent ac41dd1d07
commit fb841a3498
2 changed files with 7 additions and 0 deletions

View File

@@ -80,6 +80,7 @@ slug: /changelog
## master ## master
* (2025.11.05) 修复`Axis``indicatorLabel`无法隐藏的问题
* (2025.11.03) 增加`Tooltip``Title`可通过`TitleLabelStyle``numericFormatter`格式化时间显示 (#353) * (2025.11.03) 增加`Tooltip``Title`可通过`TitleLabelStyle``numericFormatter`格式化时间显示 (#353)
* (2025.10.30) 增加`Chart``useUtc`参数设置显示时间是否用UTC时间 * (2025.10.30) 增加`Chart``useUtc`参数设置显示时间是否用UTC时间
* (2025.10.30) 优化`Candlestick`对时间轴的支持 * (2025.10.30) 优化`Candlestick`对时间轴的支持

View File

@@ -255,6 +255,11 @@ namespace XCharts.Runtime
{ {
if (label == null) return; if (label == null) return;
if (double.IsNaN(axis.context.pointerValue)) return; if (double.IsNaN(axis.context.pointerValue)) return;
if (!axis.show || !axis.indicatorLabel.show)
{
label.SetActive(false, false);
return;
}
label.SetActive(true, true); label.SetActive(true, true);
label.SetTextActive(true); label.SetTextActive(true);
label.SetPosition(axis.context.pointerLabelPosition + axis.indicatorLabel.offset); label.SetPosition(axis.context.pointerLabelPosition + axis.indicatorLabel.offset);
@@ -732,6 +737,7 @@ namespace XCharts.Runtime
private void DrawXAxisIndicator(VertexHelper vh, Tooltip tooltip, GridCoord grid) private void DrawXAxisIndicator(VertexHelper vh, Tooltip tooltip, GridCoord grid)
{ {
if (!tooltip.lineStyle.show) return;
var xAxes = chart.GetChartComponents<XAxis>(); var xAxes = chart.GetChartComponents<XAxis>();
var lineType = tooltip.lineStyle.GetType(chart.theme.tooltip.lineType); var lineType = tooltip.lineStyle.GetType(chart.theme.tooltip.lineType);
var lineWidth = tooltip.lineStyle.GetWidth(chart.theme.tooltip.lineWidth); var lineWidth = tooltip.lineStyle.GetWidth(chart.theme.tooltip.lineWidth);