This commit is contained in:
monitor1394
2022-03-18 08:23:17 +08:00
parent 407b3625d7
commit 4e24ba7922
16 changed files with 166 additions and 114 deletions

View File

@@ -553,8 +553,7 @@ namespace XCharts.Runtime
{
while (m_Data.Count >= maxCache)
{
context.isNeedUpdateFilterData = true;
m_Data.RemoveAt(m_InsertDataToHead ? m_Data.Count - 1 : 0);
RemoveData(m_InsertDataToHead ? m_Data.Count - 1 : 0);
}
}
@@ -566,6 +565,12 @@ namespace XCharts.Runtime
SetAllDirty();
}
public void RemoveData(int dataIndex)
{
context.isNeedUpdateFilterData = true;
m_Data.RemoveAt(dataIndex);
}
/// <summary>
/// 更新类目数据
/// </summary>

View File

@@ -34,7 +34,7 @@ namespace XCharts
return;
if (!grid.context.isPointerEnter)
{
axis.context.pointerValue = double.PositiveInfinity;
axis.context.pointerValue = 0;
}
else
{
@@ -44,11 +44,11 @@ namespace XCharts
var dataZoom = chart.GetDataZoomOfAxis(axis);
var dataCount = chart.series.Count > 0 ? chart.series[0].GetDataList(dataZoom).Count : 0;
var local = chart.pointerPos;
for (int j = 0; j < axis.GetDataCount(dataZoom); j++)
if (axis is YAxis)
{
if (axis is YAxis)
float splitWid = AxisHelper.GetDataWidth(axis, grid.context.height, dataCount, dataZoom);
for (int j = 0; j < axis.GetDataCount(dataZoom); j++)
{
float splitWid = AxisHelper.GetDataWidth(axis, grid.context.height, dataCount, dataZoom);
float pY = grid.context.y + j * splitWid;
if ((axis.boundaryGap && (local.y > pY && local.y <= pY + splitWid))
|| (!axis.boundaryGap && (local.y > pY - splitWid / 2 && local.y <= pY + splitWid / 2)))
@@ -63,9 +63,12 @@ namespace XCharts
break;
}
}
else
}
else
{
float splitWid = AxisHelper.GetDataWidth(axis, grid.context.width, dataCount, dataZoom);
for (int j = 0; j < axis.GetDataCount(dataZoom); j++)
{
float splitWid = AxisHelper.GetDataWidth(axis, grid.context.width, dataCount, dataZoom);
float pX = grid.context.x + j * splitWid;
if ((axis.boundaryGap && (local.x > pX && local.x <= pX + splitWid))
|| (!axis.boundaryGap && (local.x > pX - splitWid / 2 && local.x <= pX + splitWid / 2)))
@@ -87,7 +90,6 @@ namespace XCharts
if (axis is YAxis)
{
var yRate = axis.context.minMaxRange / grid.context.height;
var yValue = yRate * (chart.pointerPos.y - grid.context.y - axis.context.offset);
if (axis.context.minValue > 0)
yValue += axis.context.minValue;
@@ -104,7 +106,6 @@ namespace XCharts
else
{
var xRate = axis.context.minMaxRange / grid.context.width;
var xValue = xRate * (chart.pointerPos.x - grid.context.x - axis.context.offset);
if (axis.context.minValue > 0)
xValue += axis.context.minValue;

View File

@@ -74,7 +74,6 @@ namespace XCharts.Runtime
return Vector3.zero;
var yAxis = chart.GetChartComponent<YAxis>(component.index);
return GetLabelPosition(i, Orient.Horizonal, component, yAxis,
chart.theme.axis,
scaleWid,

View File

@@ -431,6 +431,7 @@ namespace XCharts.Runtime
if (m_PointerContainer is GridCoord)
{
var grid = m_PointerContainer as GridCoord;
if (!grid.context.isPointerEnter) return;
if (IsYCategoryOfGrid(grid.index))
DrawYAxisIndicator(vh, tooltip, grid);
else