mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 08:50:10 +00:00
[optimize] optimize interact and performance
This commit is contained in:
@@ -7,43 +7,43 @@ namespace XCharts.Runtime
|
||||
{
|
||||
public class AxisContext : MainComponentContext
|
||||
{
|
||||
internal Orient orient { get; set; }
|
||||
public float x { get; internal set; }
|
||||
public float y { get; internal set; }
|
||||
public float width { get; internal set; }
|
||||
public float height { get; internal set; }
|
||||
public Vector3 position { get; internal set; }
|
||||
public float left { get; internal set; }
|
||||
public float right { get; internal set; }
|
||||
public float bottom { get; internal set; }
|
||||
public float top { get; internal set; }
|
||||
public Orient orient;
|
||||
public float x;
|
||||
public float y;
|
||||
public float width;
|
||||
public float height;
|
||||
public Vector3 position;
|
||||
public float left;
|
||||
public float right;
|
||||
public float bottom;
|
||||
public float top;
|
||||
/// <summary>
|
||||
/// the current minimun value.
|
||||
/// |当前最小值。
|
||||
/// </summary>
|
||||
public double minValue { get; internal set; }
|
||||
public double minValue;
|
||||
/// <summary>
|
||||
/// the current maximum value.
|
||||
/// |当前最大值。
|
||||
/// </summary>
|
||||
public double maxValue { get; internal set; }
|
||||
public double maxValue;
|
||||
/// <summary>
|
||||
/// the offset of zero position.
|
||||
/// |坐标轴原点在坐标轴的偏移。
|
||||
/// </summary>
|
||||
public float offset { get; internal set; }
|
||||
public double minMaxRange { get; internal set; }
|
||||
public float scaleWidth { get; internal set; }
|
||||
public float startAngle { get; set; }
|
||||
public double pointerValue { get; internal set; }
|
||||
public Vector3 pointerLabelPosition { get; internal set; }
|
||||
public double axisTooltipValue { get; internal set; }
|
||||
public float offset;
|
||||
public double minMaxRange;
|
||||
public float scaleWidth;
|
||||
public float startAngle;
|
||||
public double pointerValue;
|
||||
public Vector3 pointerLabelPosition;
|
||||
public double axisTooltipValue;
|
||||
public List<string> runtimeData { get { return m_RuntimeData; } }
|
||||
public List<double> labelValueList { get { return m_LabelValueList; } }
|
||||
public List<ChartLabel> labelObjectList { get { return m_AxisLabelList; } }
|
||||
|
||||
internal List<string> filterData;
|
||||
internal bool lastCheckInverse { get; set; }
|
||||
internal bool lastCheckInverse;
|
||||
internal bool isNeedUpdateFilterData;
|
||||
|
||||
private int filterStart;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace XCharts
|
||||
return;
|
||||
if (!grid.context.isPointerEnter)
|
||||
{
|
||||
axis.context.pointerValue = 0;
|
||||
axis.context.pointerValue = double.PositiveInfinity;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -36,12 +36,11 @@ namespace XCharts.Runtime
|
||||
axis.context.pointerValue = double.PositiveInfinity;
|
||||
return;
|
||||
}
|
||||
|
||||
var angleAxis = ComponentHelper.GetAngleAxis(chart.components, polar.index);
|
||||
if (angleAxis == null)
|
||||
return;
|
||||
|
||||
var startAngle = angleAxis.context.startAngle;
|
||||
|
||||
var dist = Vector3.Distance(chart.pointerPos, polar.context.center);
|
||||
axis.context.pointerValue = axis.context.minValue + (dist / polar.context.radius) * axis.context.minMaxRange;
|
||||
axis.context.pointerLabelPosition = GetLabelPosition(polar, axis, angleAxis.context.startAngle, dist);
|
||||
|
||||
@@ -231,6 +231,16 @@ namespace XCharts.Runtime
|
||||
return color;
|
||||
}
|
||||
|
||||
public Color32 GetToColor()
|
||||
{
|
||||
if (m_Opacity == 1 || m_ToColor.a == 0)
|
||||
return m_ToColor;
|
||||
|
||||
var color = m_ToColor;
|
||||
color.a = (byte)(color.a * m_Opacity);
|
||||
return color;
|
||||
}
|
||||
|
||||
public Color32 GetColor0()
|
||||
{
|
||||
if (m_Opacity == 1 || m_Color0.a == 0)
|
||||
|
||||
@@ -179,6 +179,7 @@ namespace XCharts.Runtime
|
||||
private void SetTooltipIndicatorLabel(Axis axis, ChartLabel label)
|
||||
{
|
||||
if (label == null) return;
|
||||
if (double.IsPositiveInfinity(axis.context.pointerValue)) return;
|
||||
label.SetActive(true);
|
||||
label.SetLabelActive(true);
|
||||
label.SetPosition(axis.context.pointerLabelPosition);
|
||||
@@ -234,7 +235,6 @@ namespace XCharts.Runtime
|
||||
|
||||
private void UpdateAxisPointerDataIndex(Serie serie, XAxis xAxis, YAxis yAxis, GridCoord grid, bool isTriggerAxis)
|
||||
{
|
||||
|
||||
serie.context.pointerAxisDataIndexs.Clear();
|
||||
if (yAxis.IsCategory())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user