mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 14:00:12 +00:00
重构sampleDist
This commit is contained in:
@@ -30,7 +30,7 @@ namespace XCharts
|
||||
SerializedProperty m_LineStyle = prop.FindPropertyRelative("m_LineStyle");
|
||||
SerializedProperty m_LineArrow = prop.FindPropertyRelative("m_LineArrow");
|
||||
SerializedProperty m_LineType = prop.FindPropertyRelative("m_LineType");
|
||||
SerializedProperty m_LineSampleDist = prop.FindPropertyRelative("m_LineSampleDist");
|
||||
SerializedProperty m_SampleDist = prop.FindPropertyRelative("m_SampleDist");
|
||||
SerializedProperty m_BarWidth = prop.FindPropertyRelative("m_BarWidth");
|
||||
SerializedProperty m_BarGap = prop.FindPropertyRelative("m_BarGap");
|
||||
SerializedProperty m_BarCategoryGap = prop.FindPropertyRelative("m_BarCategoryGap");
|
||||
@@ -96,7 +96,7 @@ namespace XCharts
|
||||
{
|
||||
EditorGUI.PropertyField(drawRect, m_LineType);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_LineSampleDist);
|
||||
EditorGUI.PropertyField(drawRect, m_SampleDist);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
if (serieType == SerieType.Line
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace XCharts
|
||||
[SerializeField] private AreaStyle m_AreaStyle = AreaStyle.defaultAreaStyle;
|
||||
[SerializeField] private SerieSymbol m_Symbol = new SerieSymbol();
|
||||
[SerializeField] private LineType m_LineType = LineType.Normal;
|
||||
[SerializeField] private float m_LineSampleDist = 0;
|
||||
[SerializeField] private float m_SampleDist = 0;
|
||||
[SerializeField] private LineStyle m_LineStyle = new LineStyle();
|
||||
[SerializeField] private float m_BarWidth = 0.6f;
|
||||
[SerializeField] private float m_BarGap = 0.3f; // 30%
|
||||
@@ -237,10 +237,10 @@ namespace XCharts
|
||||
public LineType lineType { get { return m_LineType; } set { m_LineType = value; } }
|
||||
/// <summary>
|
||||
/// the min pixel dist of sample.
|
||||
/// 折线图采样的最小像素距离,默认为0时不采样。当两个数据点间的水平距离小于改值时,开启采样,保证两点间的水平距离不小于改值。
|
||||
/// 采样的最小像素距离,默认为0时不采样。当两个数据点间的水平距离小于改值时,开启采样,保证两点间的水平距离不小于改值。
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public float lineSampleDist { get { return m_LineSampleDist; } set { m_LineSampleDist = value < 0 ? 0 : value; } }
|
||||
public float sampleDist { get { return m_SampleDist; } set { m_SampleDist = value < 0 ? 0 : value; } }
|
||||
/// <summary>
|
||||
/// The style of line.
|
||||
/// 线条样式。
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
int rate = 1;
|
||||
var sampleDist = serie.lineSampleDist;
|
||||
var sampleDist = serie.sampleDist;
|
||||
if (sampleDist > 0) rate = (int)((maxCount - serie.minShow) / (coordinateWid / sampleDist));
|
||||
if (rate < 1) rate = 1;
|
||||
for (i = serie.minShow; i < maxCount; i += rate)
|
||||
@@ -283,7 +283,7 @@ namespace XCharts
|
||||
var fine = isStack && m_Series.IsAnyGradientSerie(serie.stack);
|
||||
|
||||
int rate = 1;
|
||||
var sampleDist = serie.lineSampleDist;
|
||||
var sampleDist = serie.sampleDist;
|
||||
if (sampleDist > 0) rate = (int)((maxCount - serie.minShow) / (coordinateWid / sampleDist));
|
||||
if (rate < 1) rate = 1;
|
||||
for (i = serie.minShow; i < maxCount; i += rate)
|
||||
|
||||
Reference in New Issue
Block a user