mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 20:28:46 +00:00
[bug] fix multipe grid error (#210)
This commit is contained in:
@@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
## master
|
## master
|
||||||
|
|
||||||
|
* (2022.07.05) 修复`Chart`里有多个坐标系时绘制异常的问题 (#210)
|
||||||
* (2022.07.04) 增加`Settings`的`axisMaxSplitNumber`参数设置`Axis`的最大分隔段数
|
* (2022.07.04) 增加`Settings`的`axisMaxSplitNumber`参数设置`Axis`的最大分隔段数
|
||||||
* (2022.07.04) 修复`Axis`在设置`offset`后`Tick`绘制位置异常的问题 (#209)
|
* (2022.07.04) 修复`Axis`在设置`offset`后`Tick`绘制位置异常的问题 (#209)
|
||||||
* (2022.07.03) 优化`AxisLabel`的`formatterFunction`自定义委托
|
* (2022.07.03) 优化`AxisLabel`的`formatterFunction`自定义委托
|
||||||
|
|||||||
@@ -132,13 +132,6 @@ namespace XCharts.Runtime
|
|||||||
SetValueWithKInfo(s_Sb, "s-vert", vertCount);
|
SetValueWithKInfo(s_Sb, "s-vert", vertCount);
|
||||||
SetValueWithKInfo(s_Sb, "t-vert", m_Chart.m_TopPainterVertCount, false);
|
SetValueWithKInfo(s_Sb, "t-vert", m_Chart.m_TopPainterVertCount, false);
|
||||||
|
|
||||||
var serie0 = m_Chart.GetSerie(0);
|
|
||||||
for (int i = 0; i < serie0.dataCount; i++)
|
|
||||||
{
|
|
||||||
var serieData = serie0.data[i];
|
|
||||||
s_Sb.AppendFormat("{0}:{1}\n", i, serieData.interact.targetVaue);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Label.SetText(s_Sb.ToString());
|
m_Label.SetText(s_Sb.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace XCharts.Runtime
|
|||||||
[SerializeField][Range(1, 10)] protected float m_CicleSmoothness = 2f;
|
[SerializeField][Range(1, 10)] protected float m_CicleSmoothness = 2f;
|
||||||
[SerializeField] protected float m_LegendIconLineWidth = 2;
|
[SerializeField] protected float m_LegendIconLineWidth = 2;
|
||||||
[SerializeField] private float[] m_LegendIconCornerRadius = new float[] { 0.25f, 0.25f, 0.25f, 0.25f };
|
[SerializeField] private float[] m_LegendIconCornerRadius = new float[] { 0.25f, 0.25f, 0.25f, 0.25f };
|
||||||
[SerializeField][Since("v3.1.0")] protected float m_AxisMaxSplitNumber = 20;
|
[SerializeField][Since("v3.1.0")] protected float m_AxisMaxSplitNumber = 50;
|
||||||
|
|
||||||
public bool show { get { return m_Show; } }
|
public bool show { get { return m_Show; } }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ namespace XCharts.Runtime
|
|||||||
private ISerieContainer GetPointerContainerAndSeries(Tooltip tooltip, List<Serie> list)
|
private ISerieContainer GetPointerContainerAndSeries(Tooltip tooltip, List<Serie> list)
|
||||||
{
|
{
|
||||||
list.Clear();
|
list.Clear();
|
||||||
|
ISerieContainer target = null;
|
||||||
for (int i = chart.components.Count - 1; i >= 0; i--)
|
for (int i = chart.components.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var component = chart.components[i];
|
var component = chart.components[i];
|
||||||
@@ -230,11 +231,11 @@ namespace XCharts.Runtime
|
|||||||
chart.RefreshTopPainter();
|
chart.RefreshTopPainter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return container;
|
target = container;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
|
private void UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ namespace XCharts.Runtime
|
|||||||
{
|
{
|
||||||
m_Active = flag && tooltip.showContent;
|
m_Active = flag && tooltip.showContent;
|
||||||
ChartHelper.SetActive(gameObject, m_Active);
|
ChartHelper.SetActive(gameObject, m_Active);
|
||||||
|
if (!flag)
|
||||||
|
{
|
||||||
|
foreach (var item in m_Items)
|
||||||
|
item.gameObject.SetActive(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Refresh()
|
public void Refresh()
|
||||||
|
|||||||
@@ -423,5 +423,22 @@ namespace XCharts.Runtime
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal bool GetSerieGridCoordAxis(Serie serie, out Axis axis, out Axis relativedAxis)
|
||||||
|
{
|
||||||
|
var yAxis = GetChartComponent<YAxis>(serie.yAxisIndex);
|
||||||
|
var isY = yAxis.IsCategory();
|
||||||
|
if (isY)
|
||||||
|
{
|
||||||
|
axis = yAxis;
|
||||||
|
relativedAxis = GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
axis = GetChartComponent<XAxis>(serie.xAxisIndex);
|
||||||
|
relativedAxis = yAxis;
|
||||||
|
}
|
||||||
|
return isY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ namespace XCharts.Runtime
|
|||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class MainComponent : IComparable
|
public class MainComponent : IComparable
|
||||||
{
|
{
|
||||||
public int instanceId { get; internal set; }
|
public int instanceId { get { return index; } }
|
||||||
public int index { get; internal set; }
|
public int index { get; internal set; }
|
||||||
protected bool m_VertsDirty;
|
protected bool m_VertsDirty;
|
||||||
protected bool m_ComponentDirty;
|
protected bool m_ComponentDirty;
|
||||||
|
|||||||
@@ -128,21 +128,9 @@ namespace XCharts.Runtime
|
|||||||
if (!serie.show || serie.animation.HasFadeOut())
|
if (!serie.show || serie.animation.HasFadeOut())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
|
||||||
|
|
||||||
Axis axis;
|
Axis axis;
|
||||||
Axis relativedAxis;
|
Axis relativedAxis;
|
||||||
|
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||||
if (isY)
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
}
|
|
||||||
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||||
|
|
||||||
if (axis == null)
|
if (axis == null)
|
||||||
|
|||||||
@@ -104,21 +104,9 @@ namespace XCharts.Runtime
|
|||||||
if (!serie.show || serie.animation.HasFadeOut())
|
if (!serie.show || serie.animation.HasFadeOut())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
|
||||||
|
|
||||||
Axis axis;
|
Axis axis;
|
||||||
Axis relativedAxis;
|
Axis relativedAxis;
|
||||||
|
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||||
if (isY)
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
}
|
|
||||||
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||||
|
|
||||||
if (axis == null)
|
if (axis == null)
|
||||||
|
|||||||
@@ -145,21 +145,11 @@ namespace XCharts.Runtime
|
|||||||
var lineArrow = serie.lineArrow;
|
var lineArrow = serie.lineArrow;
|
||||||
var visualMap = chart.GetVisualMapOfSerie(serie);
|
var visualMap = chart.GetVisualMapOfSerie(serie);
|
||||||
var isVisualMapGradient = VisualMapHelper.IsNeedLineGradient(visualMap);
|
var isVisualMapGradient = VisualMapHelper.IsNeedLineGradient(visualMap);
|
||||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
|
||||||
|
|
||||||
Axis axis;
|
Axis axis;
|
||||||
Axis relativedAxis;
|
Axis relativedAxis;
|
||||||
|
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||||
|
|
||||||
if (isY)
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
var serieData = serie.GetSerieData(i);
|
var serieData = serie.GetSerieData(i);
|
||||||
@@ -270,21 +260,9 @@ namespace XCharts.Runtime
|
|||||||
if (serie.animation.HasFadeOut())
|
if (serie.animation.HasFadeOut())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
|
||||||
|
|
||||||
Axis axis;
|
Axis axis;
|
||||||
Axis relativedAxis;
|
Axis relativedAxis;
|
||||||
|
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||||
if (isY)
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axis == null)
|
if (axis == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -149,21 +149,10 @@ namespace XCharts.Runtime
|
|||||||
if (serie.animation.HasFadeOut())
|
if (serie.animation.HasFadeOut())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var isY = ComponentHelper.IsAnyCategoryOfYAxis(chart.components);
|
|
||||||
|
|
||||||
Axis axis;
|
Axis axis;
|
||||||
Axis relativedAxis;
|
Axis relativedAxis;
|
||||||
|
var isY = chart.GetSerieGridCoordAxis(serie, out axis, out relativedAxis);
|
||||||
|
|
||||||
if (isY)
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
axis = chart.GetChartComponent<XAxis>(serie.xAxisIndex);
|
|
||||||
relativedAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
|
|
||||||
}
|
|
||||||
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
m_SerieGrid = chart.GetChartComponent<GridCoord>(axis.gridIndex);
|
||||||
|
|
||||||
if (axis == null)
|
if (axis == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user