[code] refactor the code

This commit is contained in:
monitor1394
2022-07-03 21:09:49 +08:00
parent 33fd4aa9f3
commit 197402dcb7
12 changed files with 60 additions and 67 deletions

View File

@@ -8,18 +8,19 @@ namespace XCharts.Runtime
{
var serieLabel = data.label;
var numericFormatter = serieLabel.numericFormatter;
if (serieLabel.formatterFunction != null)
{
return serieLabel.formatterFunction(data.index, data.runtimeValue, null);
}
if (string.IsNullOrEmpty(serieLabel.formatter))
return ChartCached.NumberToStr(data.runtimeValue, numericFormatter);
{
var content = ChartCached.NumberToStr(data.runtimeValue, numericFormatter);
return serieLabel.formatterFunction == null? content:
serieLabel.formatterFunction(data.index, data.runtimeValue, null, content);
}
else
{
var content = serieLabel.formatter;
FormatterHelper.ReplaceSerieLabelContent(ref content, numericFormatter, serie.dataCount, data.runtimeValue,
0, serie.serieName, data.name, data.name, Color.clear, null);
return content;
return serieLabel.formatterFunction == null? content:
serieLabel.formatterFunction(data.index, data.runtimeValue, null, content);
}
}