mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 08:50:10 +00:00
[enhancement][line] line support end label
This commit is contained in:
@@ -490,6 +490,22 @@ namespace XCharts.Runtime
|
||||
}
|
||||
}
|
||||
|
||||
public static double GetAxisPositionValue(GridCoord grid, Axis axis, Vector3 pos)
|
||||
{
|
||||
if (axis is YAxis)
|
||||
return GetAxisPositionValue(pos.y, grid.context.height, axis.context.minMaxRange, grid.context.y, axis.context.offset);
|
||||
else if (axis is XAxis)
|
||||
return GetAxisPositionValue(pos.x, grid.context.width, axis.context.minMaxRange, grid.context.x, axis.context.offset);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static double GetAxisPositionValue(float xy, float axisLength, double axisRange, float axisStart, float axisOffset)
|
||||
{
|
||||
var yRate = axisRange / axisLength;
|
||||
return yRate * (xy - axisStart - axisOffset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得数值value在坐标轴上的坐标位置
|
||||
/// </summary>
|
||||
|
||||
@@ -7,5 +7,12 @@ namespace XCharts.Runtime
|
||||
[System.Serializable]
|
||||
public class EndLabelStyle : LabelStyle
|
||||
{
|
||||
public EndLabelStyle()
|
||||
{
|
||||
m_Offset = new Vector3(5, 0, 0);
|
||||
m_TextStyle.alignment = TextAnchor.MiddleLeft;
|
||||
m_NumericFormatter = "f0";
|
||||
m_Formatter = "{a}:{c}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,20 +67,20 @@ namespace XCharts.Runtime
|
||||
End
|
||||
}
|
||||
|
||||
[SerializeField] private bool m_Show = true;
|
||||
[SerializeField] protected bool m_Show = true;
|
||||
[SerializeField] Position m_Position = Position.Outside;
|
||||
[SerializeField] private Vector3 m_Offset;
|
||||
[SerializeField] private float m_Distance;
|
||||
[SerializeField] private string m_Formatter;
|
||||
[SerializeField] private float m_PaddingLeftRight = 2f;
|
||||
[SerializeField] private float m_PaddingTopBottom = 2f;
|
||||
[SerializeField] private float m_BackgroundWidth = 0;
|
||||
[SerializeField] private float m_BackgroundHeight = 0;
|
||||
[SerializeField] private string m_NumericFormatter = "";
|
||||
[SerializeField] private bool m_AutoOffset = false;
|
||||
[SerializeField] protected Vector3 m_Offset;
|
||||
[SerializeField] protected float m_Distance;
|
||||
[SerializeField] protected string m_Formatter;
|
||||
[SerializeField] protected float m_PaddingLeftRight = 2f;
|
||||
[SerializeField] protected float m_PaddingTopBottom = 2f;
|
||||
[SerializeField] protected float m_BackgroundWidth = 0;
|
||||
[SerializeField] protected float m_BackgroundHeight = 0;
|
||||
[SerializeField] protected string m_NumericFormatter = "";
|
||||
[SerializeField] protected bool m_AutoOffset = false;
|
||||
|
||||
[SerializeField] private TextStyle m_TextStyle = new TextStyle();
|
||||
private SerieLabelFormatterFunction m_FormatterFunction;
|
||||
[SerializeField] protected TextStyle m_TextStyle = new TextStyle();
|
||||
protected SerieLabelFormatterFunction m_FormatterFunction;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user