mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-25 18:30:14 +00:00
修复Tooltip的Cross在开启DataZoom时指示位置不准确的问题
This commit is contained in:
@@ -935,5 +935,43 @@ namespace XCharts.Runtime
|
||||
(float)(Math.Abs(context.minValue) * (axisLength / (Math.Abs(context.minValue) + Math.Abs(context.maxValue))))
|
||||
);
|
||||
}
|
||||
|
||||
public Vector3 GetCategoryPosition(int categoryIndex, int dataCount = 0)
|
||||
{
|
||||
if (dataCount <= 0)
|
||||
{
|
||||
dataCount = data.Count;
|
||||
}
|
||||
if (IsCategory() && dataCount > 0)
|
||||
{
|
||||
Vector3 pos;
|
||||
if (boundaryGap)
|
||||
{
|
||||
var each = context.length / dataCount;
|
||||
pos = context.start + context.dire * (each * (categoryIndex + 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
var each = context.length / (dataCount - 1);
|
||||
pos = context.start + context.dire * (each * categoryIndex);
|
||||
}
|
||||
if (axisLabel.distance != 0)
|
||||
{
|
||||
if (this is YAxis)
|
||||
{
|
||||
pos.x = GetLabelObjectPosition(0).x;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.y = GetLabelObjectPosition(0).y;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user