mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 09:50:15 +00:00
增加AxisLabel的onZero参数可将Label显示在0刻度上
This commit is contained in:
@@ -29,6 +29,7 @@ namespace XCharts
|
||||
[SerializeField] private FontStyle m_FontStyle;
|
||||
[SerializeField] private bool m_ForceENotation = false;
|
||||
[SerializeField] private bool m_ShowAsPositiveNumber = false;
|
||||
[SerializeField] private bool m_OnZero = false;
|
||||
[SerializeField] private TextLimit m_TextLimit = new TextLimit();
|
||||
|
||||
/// <summary>
|
||||
@@ -131,6 +132,15 @@ namespace XCharts
|
||||
set { if (PropertyUtility.SetStruct(ref m_ShowAsPositiveNumber, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刻度标签显示在0刻度上。
|
||||
/// </summary>
|
||||
public bool onZero
|
||||
{
|
||||
get { return m_OnZero; }
|
||||
set { if (PropertyUtility.SetStruct(ref m_OnZero, value)) SetComponentDirty(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文本限制。
|
||||
/// </summary>
|
||||
|
||||
@@ -757,7 +757,8 @@ namespace XCharts
|
||||
|
||||
private Vector3 GetLabelXPosition(float scaleWid, int i, int xAxisIndex, XAxis xAxis)
|
||||
{
|
||||
var startY = xAxisIndex == 0 ? coordinateY : coordinateY + coordinateHeight;
|
||||
var startY = coordinateY + (xAxis.axisLabel.onZero ? m_YAxises[xAxisIndex].runtimeZeroYOffset : 0);
|
||||
if (xAxisIndex > 0) startY += coordinateHeight;
|
||||
var posY = 0f;
|
||||
var inside = xAxis.axisLabel.inside;
|
||||
if ((inside && xAxisIndex == 0) || (!inside && xAxisIndex == 1))
|
||||
|
||||
Reference in New Issue
Block a user