mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-28 20:28:46 +00:00
增加DataZoom的filterAxisRange设置坐标轴的范围计算是否受DataZoom的影响
This commit is contained in:
@@ -92,6 +92,7 @@ namespace XCharts.Runtime
|
||||
[SerializeField][Since("v3.5.0")] private MarqueeStyle m_MarqueeStyle = new MarqueeStyle();
|
||||
[SerializeField][Since("v3.6.0")] private bool m_StartLock;
|
||||
[SerializeField][Since("v3.6.0")] private bool m_EndLock;
|
||||
[SerializeField][Since("v3.12.0")] private bool m_FilterAxisRange = true;
|
||||
|
||||
public DataZoomContext context = new DataZoomContext();
|
||||
private CustomDataZoomStartEndFunction m_StartEndFunction;
|
||||
@@ -325,6 +326,16 @@ namespace XCharts.Runtime
|
||||
set { if (PropertyUtil.SetStruct(ref m_EndLock, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// Whether dataZoom filters the axis min/max range. When true, the axis scale adapts to the current zoom window.
|
||||
/// When false, the axis always shows the full data range regardless of the zoom position.
|
||||
/// ||是否根据DataZoom的缩放窗口过滤坐标轴的最大最小值范围。为true时坐标轴范围随缩放窗口变化;为false时坐标轴始终显示全部数据范围。
|
||||
/// </summary>
|
||||
public bool filterAxisRange
|
||||
{
|
||||
get { return m_FilterAxisRange; }
|
||||
set { if (PropertyUtil.SetStruct(ref m_FilterAxisRange, value)) SetVerticesDirty(); }
|
||||
}
|
||||
/// <summary>
|
||||
/// The end percentage of the window out of the data extent, in the range of 0 ~ 100.
|
||||
/// ||数据窗口范围的结束百分比。范围是:0 ~ 100。
|
||||
/// </summary>
|
||||
|
||||
@@ -591,9 +591,9 @@ namespace XCharts.Runtime
|
||||
float scaleWid = showData.Count > 1 ? dataZoom.context.width / (showData.Count - 1) : dataZoom.context.width;
|
||||
Vector3 lp = Vector3.zero;
|
||||
Vector3 np = Vector3.zero;
|
||||
double minValue;
|
||||
double maxValue;
|
||||
SeriesHelper.GetYMinMaxValue(chart, 0, axis.inverse, out minValue, out maxValue, false, false);
|
||||
// shadow always shows the full data range, independent of DataZoom window
|
||||
double minValue = SerieHelper.GetMinData(serie, 1, null, axis.inverse);
|
||||
double maxValue = SerieHelper.GetMaxData(serie, 1, null, axis.inverse);
|
||||
minValue = ChartHelper.GetMinDivisibleValue(minValue, 0);
|
||||
maxValue = ChartHelper.GetMaxDivisibleValue(maxValue, 0);
|
||||
double xMinValue = 0;
|
||||
@@ -603,7 +603,8 @@ namespace XCharts.Runtime
|
||||
var xAxis = chart.GetChartComponent<XAxis>(xAxisIndex);
|
||||
if (xAxis != null && (xAxis.IsValue() || xAxis.IsTime()))
|
||||
{
|
||||
SeriesHelper.GetXMinMaxValue(chart, xAxisIndex, xAxis.inverse, out xMinValue, out xMaxValue, false, false);
|
||||
xMinValue = SerieHelper.GetMinData(serie, 0, null, xAxis.inverse);
|
||||
xMaxValue = SerieHelper.GetMaxData(serie, 0, null, xAxis.inverse);
|
||||
AxisHelper.AdjustMinMaxValue(xAxis, ref xMinValue, ref xMaxValue, true);
|
||||
useXValueForShadow = (xMaxValue - xMinValue) > 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user