mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-30 05:08:48 +00:00
代码优化
This commit is contained in:
@@ -110,6 +110,7 @@ namespace XCharts.Runtime
|
|||||||
if (!(serie is INeedSerieContainer))
|
if (!(serie is INeedSerieContainer))
|
||||||
{
|
{
|
||||||
showTooltip = true;
|
showTooltip = true;
|
||||||
|
containerSeries = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,6 +127,7 @@ namespace XCharts.Runtime
|
|||||||
private void UpdateTooltip(Tooltip tooltip)
|
private void UpdateTooltip(Tooltip tooltip)
|
||||||
{
|
{
|
||||||
if (!showTooltip) return;
|
if (!showTooltip) return;
|
||||||
|
var anyTrigger = false;
|
||||||
for (int i = chart.series.Count - 1; i >= 0; i--)
|
for (int i = chart.series.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var serie = chart.series[i];
|
var serie = chart.series[i];
|
||||||
@@ -133,20 +135,21 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
if (SetSerieTooltip(tooltip, serie))
|
if (SetSerieTooltip(tooltip, serie))
|
||||||
{
|
{
|
||||||
|
anyTrigger = true;
|
||||||
chart.RefreshTopPainter();
|
chart.RefreshTopPainter();
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (containerSeries != null)
|
if (containerSeries != null)
|
||||||
{
|
{
|
||||||
if (!SetSerieTooltip(tooltip, containerSeries))
|
if (!SetSerieTooltip(tooltip, containerSeries))
|
||||||
{
|
|
||||||
showTooltip = false;
|
showTooltip = false;
|
||||||
}
|
else
|
||||||
|
anyTrigger = true;
|
||||||
ListPool<Serie>.Release(containerSeries);
|
ListPool<Serie>.Release(containerSeries);
|
||||||
}
|
}
|
||||||
if (!showTooltip)
|
if (!showTooltip || !anyTrigger)
|
||||||
{
|
{
|
||||||
if (tooltip.context.type == Tooltip.Type.Corss && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
|
if (tooltip.context.type == Tooltip.Type.Corss && m_PointerContainer != null && m_PointerContainer.IsPointerEnter())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ namespace XCharts.Runtime
|
|||||||
innerFill = stateStyle.areaStyle.innerFill;
|
innerFill = stateStyle.areaStyle.innerFill;
|
||||||
toTop = stateStyle.areaStyle.toTop;
|
toTop = stateStyle.areaStyle.toTop;
|
||||||
GetColor(ref color, stateStyle.areaStyle.color, stateStyle.itemStyle.color, stateStyle.areaStyle.opacity, theme, index);
|
GetColor(ref color, stateStyle.areaStyle.color, stateStyle.itemStyle.color, stateStyle.areaStyle.opacity, theme, index);
|
||||||
GetColor(ref color, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index);
|
GetColor(ref toColor, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -645,7 +645,7 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GetColor(ref Color32 color, Color32 checkColor, Color32 itemColor,
|
public static void GetColor(ref Color32 color, Color32 checkColor, Color32 itemColor,
|
||||||
float opacity, ThemeStyle theme, int colorIndex, bool setOpacity = true)
|
float opacity, ThemeStyle theme, int colorIndex, bool setOpacity = true)
|
||||||
{
|
{
|
||||||
if (!ChartHelper.IsClearColor(checkColor)) color = checkColor;
|
if (!ChartHelper.IsClearColor(checkColor)) color = checkColor;
|
||||||
|
|||||||
Reference in New Issue
Block a user