mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
[feature][axis] add showStartLine and showEndLine for AxisSplitLine
This commit is contained in:
@@ -58,6 +58,7 @@
|
||||
|
||||
## master
|
||||
|
||||
* (2022.09.06) 增加`AxisSplitLine`的`showStartLine`和`showEndLine`参数
|
||||
* (2022.09.06) 增加`Heatmap`通过`symbol`设置不同的图案的支持
|
||||
* (2022.09.05) 增加`Heatmap`的`heatmapType`支持设置`Data`和`Count`两种不同映射方式的热力图
|
||||
* (2022.09.05) 优化`Tooltip`在热力图为数值轴时的指示
|
||||
|
||||
@@ -357,6 +357,8 @@ Split line of axis in grid area.
|
||||
|`interval`|||Interval of Axis splitLine.
|
||||
|`distance`|||The distance between the split line and axis line.
|
||||
|`autoColor`|||auto color.
|
||||
|`showStartLine`|true|v3.3.0|Whether to show the first split line.
|
||||
|`showEndLine`|true|v3.3.0|Whether to show the last split line.
|
||||
|
||||
## `AxisTheme`
|
||||
|
||||
|
||||
@@ -357,6 +357,8 @@ Inherits or Implemented: [BaseLine](#BaseLine)
|
||||
|`interval`|||坐标轴分隔线的显示间隔。
|
||||
|`distance`|||刻度线与轴线的距离。
|
||||
|`autoColor`|||自动设置颜色。
|
||||
|`showStartLine`|true|v3.3.0|是否显示第一条分割线。
|
||||
|`showEndLine`|true|v3.3.0|是否显示最后一条分割线。
|
||||
|
||||
## `AxisTheme`
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ namespace XCharts.Editor
|
||||
PropertyField(prop, "m_Interval");
|
||||
PropertyField(prop, "m_Distance");
|
||||
PropertyField(prop, "m_AutoColor");
|
||||
PropertyField(prop, "m_ShowStartLine");
|
||||
PropertyField(prop, "m_ShowEndLine");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -817,11 +817,11 @@ namespace XCharts
|
||||
}
|
||||
if (axis.splitLine.show)
|
||||
{
|
||||
if (axis.splitLine.NeedShow(i))
|
||||
if (axis.splitLine.NeedShow(i, size))
|
||||
{
|
||||
if (orient == Orient.Horizonal)
|
||||
{
|
||||
if (relativedAxis == null || !MathUtil.Approximately(current, relativedAxis.context.x))
|
||||
if (relativedAxis == null || !relativedAxis.axisLine.show || !MathUtil.Approximately(current, relativedAxis.context.x))
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
lineType,
|
||||
@@ -885,7 +885,7 @@ namespace XCharts
|
||||
}
|
||||
else
|
||||
{
|
||||
if (relativedAxis == null || !MathUtil.Approximately(current, relativedAxis.context.y))
|
||||
if (relativedAxis == null || !relativedAxis.axisLine.show || !MathUtil.Approximately(current, relativedAxis.context.y))
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh,
|
||||
lineType,
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace XCharts.Runtime
|
||||
[SerializeField] private int m_Interval;
|
||||
[SerializeField] private float m_Distance;
|
||||
[SerializeField] private bool m_AutoColor;
|
||||
[SerializeField][Since("v3.3.0")] private bool m_ShowStartLine = true;
|
||||
[SerializeField][Since("v3.3.0")] private bool m_ShowEndLine = true;
|
||||
|
||||
/// <summary>
|
||||
/// The distance between the split line and axis line.
|
||||
@@ -33,6 +35,24 @@ namespace XCharts.Runtime
|
||||
get { return m_Interval; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_Interval, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the first split line.
|
||||
/// |是否显示第一条分割线。
|
||||
/// </summary>
|
||||
public bool showStartLine
|
||||
{
|
||||
get { return m_ShowStartLine; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ShowStartLine, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether to show the last split line.
|
||||
/// |是否显示最后一条分割线。
|
||||
/// </summary>
|
||||
public bool showEndLine
|
||||
{
|
||||
get { return m_ShowEndLine; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_ShowEndLine, value)) SetVerticesDirty(); }
|
||||
}
|
||||
|
||||
public override bool vertsDirty { get { return m_VertsDirty || m_LineStyle.anyDirty; } }
|
||||
public override void ClearVerticesDirty()
|
||||
@@ -56,6 +76,8 @@ namespace XCharts.Runtime
|
||||
var axisSplitLine = new AxisSplitLine();
|
||||
axisSplitLine.show = show;
|
||||
axisSplitLine.interval = interval;
|
||||
axisSplitLine.showStartLine = showStartLine;
|
||||
axisSplitLine.showEndLine = showEndLine;
|
||||
axisSplitLine.lineStyle = lineStyle.Clone();
|
||||
return axisSplitLine;
|
||||
}
|
||||
@@ -64,11 +86,17 @@ namespace XCharts.Runtime
|
||||
{
|
||||
base.Copy(splitLine);
|
||||
interval = splitLine.interval;
|
||||
showStartLine = splitLine.showStartLine;
|
||||
showEndLine = splitLine.showEndLine;
|
||||
}
|
||||
|
||||
internal bool NeedShow(int index)
|
||||
internal bool NeedShow(int index, int total)
|
||||
{
|
||||
return show && (interval == 0 || index % (interval + 1) == 0);
|
||||
if (!show) return false;
|
||||
if (interval != 0 && index % (interval + 1) != 0) return false;
|
||||
if (!showStartLine && index == 0) return false;
|
||||
if (!showEndLine && index == total - 1) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,7 +147,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, color);
|
||||
}
|
||||
if (radar.splitLine.NeedShow(i))
|
||||
if (radar.splitLine.NeedShow(i, radar.splitNumber))
|
||||
{
|
||||
ChartDrawer.DrawLineStyle(vh, splitLineType, splitLineWidth, p2, p3, splitLineColor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user