mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
修复MarkArea指定yValue或xValue时绘制区域不准确的问题
This commit is contained in:
@@ -80,6 +80,9 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
* (2025.04.25) 修复`MarkArea`指定`yValue`或`xValue`时绘制区域不准确的问题
|
||||
* (2025.04.17) 增加`UITable`的`Title`支持设置标题
|
||||
* (2025.04.17) 增加`UITable`的`Viewport`支持设置表格视口边距边框
|
||||
* (2025.04.15) 增加`Bar`支持通过`VisualMap`设置颜色
|
||||
* (2025.04.14) 增加`AxisLabel`的`showZeroLabel`设置是否显示0刻度
|
||||
* (2025.04.08) 增加`UIStatistic`的`desc`描述文本设置支持
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace XCharts.Runtime
|
||||
private void InitMarkArea(MarkArea markArea)
|
||||
{
|
||||
markArea.painter = chart.m_PainterUpper;
|
||||
markArea.refreshComponent = delegate()
|
||||
markArea.refreshComponent = delegate ()
|
||||
{
|
||||
var label = ChartHelper.AddChartLabel("label", m_MarkLineLabelRoot.transform, markArea.label, chart.theme.axis,
|
||||
component.text, Color.clear, TextAnchor.MiddleCenter);
|
||||
@@ -142,31 +142,12 @@ namespace XCharts.Runtime
|
||||
else if (data.yValue != 0)
|
||||
{
|
||||
data.runtimeValue = data.yValue;
|
||||
if (yAxis.IsCategory())
|
||||
{
|
||||
var pY = AxisHelper.GetAxisPosition(grid, yAxis, data.yValue, showData.Count, dataZoom);
|
||||
return start ?
|
||||
new Vector3(grid.context.x, pY) :
|
||||
new Vector3(grid.context.x + grid.context.width, pY);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetPosition(xAxis, yAxis, grid, data.runtimeValue, start);
|
||||
}
|
||||
return GetPosition(yAxis, grid, data.runtimeValue, start);
|
||||
}
|
||||
else
|
||||
{
|
||||
data.runtimeValue = data.xValue;
|
||||
if (xAxis.IsCategory())
|
||||
{
|
||||
var pX = AxisHelper.GetAxisPosition(grid, xAxis, data.xValue, showData.Count, dataZoom);
|
||||
return start ? new Vector3(pX, grid.context.y + grid.context.height) :
|
||||
new Vector3(pX, grid.context.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetPosition(xAxis, yAxis, grid, data.xValue, start);
|
||||
}
|
||||
return GetPosition(xAxis, grid, data.xValue, start);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
@@ -178,16 +159,28 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (yAxis.IsCategory())
|
||||
{
|
||||
var pX = AxisHelper.GetAxisPosition(grid, xAxis, value);
|
||||
return GetPosition(xAxis, grid, value, start);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetPosition(yAxis, grid, value, start);
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3 GetPosition(Axis axis, GridCoord grid, double value, bool start)
|
||||
{
|
||||
if (axis is XAxis)
|
||||
{
|
||||
var pX = AxisHelper.GetAxisPosition(grid, axis, value);
|
||||
return start ?
|
||||
new Vector3(pX, grid.context.y + grid.context.height) :
|
||||
new Vector3(pX, grid.context.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pY = AxisHelper.GetAxisPosition(grid, yAxis, value);
|
||||
var pY = AxisHelper.GetAxisPosition(grid, axis, value);
|
||||
return start ?
|
||||
new Vector3(grid.context.x, pY + grid.context.height) :
|
||||
new Vector3(grid.context.x, pY) :
|
||||
new Vector3(grid.context.x + grid.context.width, pY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user