修复TooltiptitleFormatter设置为{b}后显示不准确的问题

This commit is contained in:
monitor1394
2023-12-01 08:39:27 +08:00
parent 735e36d6e5
commit bece2eb564
10 changed files with 33 additions and 41 deletions

View File

@@ -47,7 +47,7 @@ namespace XCharts.Runtime
if (item.content.IndexOf("{") >= 0)
{
var content = item.content;
FormatterHelper.ReplaceContent(ref content, 0, item.labelStyle.numericFormatter, null, chart);
FormatterHelper.ReplaceContent(ref content, -1, item.labelStyle.numericFormatter, null, chart);
return content;
}
else

View File

@@ -62,7 +62,7 @@ namespace XCharts.Runtime
if (FormatterHelper.NeedFormat(title.text))
{
var content = title.text;
FormatterHelper.ReplaceContent(ref content, 0, title.labelStyle.numericFormatter, null, chart);
FormatterHelper.ReplaceContent(ref content, -1, title.labelStyle.numericFormatter, null, chart);
return content;
}
else
@@ -76,7 +76,7 @@ namespace XCharts.Runtime
if (FormatterHelper.NeedFormat(title.subText))
{
var content = title.subText;
FormatterHelper.ReplaceContent(ref content, 0, title.subLabelStyle.numericFormatter, null, chart);
FormatterHelper.ReplaceContent(ref content, -1, title.subLabelStyle.numericFormatter, null, chart);
return content;
}
else

View File

@@ -306,8 +306,10 @@ namespace XCharts.Runtime
{
if (isTriggerAxis)
{
var index = serie.context.dataZoomStartIndex + (int)yAxis.context.pointerValue;
serie.context.pointerEnter = true;
serie.context.pointerAxisDataIndexs.Add((int)yAxis.context.pointerValue);
serie.context.pointerAxisDataIndexs.Add(index);
serie.context.pointerItemDataIndex = index;
yAxis.context.axisTooltipValue = yAxis.context.pointerValue;
}
}

View File

@@ -16,7 +16,7 @@ namespace XCharts.Runtime
else
{
tooltip.context.data.title = tooltip.titleFormatter;
FormatterHelper.ReplaceContent(ref tooltip.context.data.title, 0,
FormatterHelper.ReplaceContent(ref tooltip.context.data.title, -1,
tooltip.numericFormatter, null, chart);
}
}