diff --git a/Documentation~/en/api.md b/Documentation~/en/api.md
index 89e77704..cb306f17 100644
--- a/Documentation~/en/api.md
+++ b/Documentation~/en/api.md
@@ -421,8 +421,10 @@ Inherits or Implemented: [BaseChart](#basechart)
|GetFullName()||public static string GetFullName(Transform transform)|
|GetHighlightColor()||public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)|
|GetLastValue()||public static Vector3 GetLastValue(List<Vector3> list)|
+|GetMaxCeilRate()||public static double GetMaxCeilRate(double value, double ceilRate)|
|GetMaxDivisibleValue()||public static double GetMaxDivisibleValue(double max, double ceilRate)|
|GetMaxLogValue()||public static double GetMaxLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)|
+|GetMinCeilRate()||public static double GetMinCeilRate(double value, double ceilRate)|
|GetMinDivisibleValue()||public static double GetMinDivisibleValue(double min, double ceilRate)|
|GetMinLogValue()||public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)|
|GetOrAddComponent<T>()||public static T GetOrAddComponent<T>(GameObject gameObject) where T : Component|
@@ -1171,6 +1173,7 @@ Inherits or Implemented: [MaskableGraphic](#maskablegraphic)
|GetBezier2()||public static Vector3 GetBezier2(float t, Vector3 sp, Vector3 p1, Vector3 p2, Vector3 ep)|
|GetBezierList()||public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)|
|GetDire()||public static Vector3 GetDire(float angle, bool isDegree = false)|
+|GetIntersection()||public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref List<Vector3> intersection)
获得两直线的交点 |
|GetIntersection()||public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref Vector3 intersection)
获得两直线的交点 |
|GetPos()||public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)|
|GetVertialDire()||public static Vector3 GetVertialDire(Vector3 dire)|
diff --git a/Documentation~/en/configuration.md b/Documentation~/en/configuration.md
index 450da862..13605c83 100644
--- a/Documentation~/en/configuration.md
+++ b/Documentation~/en/configuration.md
@@ -252,7 +252,7 @@ The axis in rectangular coordinate.
|--|--|--|--|
|show|true||Whether to show axis.
|type|||the type of axis.
`Axis.AxisType`:
- `Value`: Numerical axis, suitable for continuous data.
- `Category`: Category axis, suitable for discrete category data. Data should only be set via data for this type.
- `Log`: Log axis, suitable for log data.
- `Time`: Time axis, suitable for continuous time series data.
|
-|minMaxType|||the type of axis minmax.
`Axis.AxisMinMaxType`:
- `Default`: 0 - maximum.
- `MinMax`: minimum - maximum.
- `Custom`: Customize the minimum and maximum.
|
+|minMaxType|||the type of axis minmax.
`Axis.AxisMinMaxType`:
- `Default`: 0 - maximum.
- `MinMax`: minimum - maximum.
- `Custom`: Customize the minimum and maximum.
- `MinMaxAuto`: [since("v3.7.0")]minimum - maximum, automatically calculate the appropriate values.
|
|gridIndex|||The index of the grid on which the axis are located, by default, is in the first grid.
|polarIndex|||The index of the polar on which the axis are located, by default, is in the first polar.
|parallelIndex|||The index of the parallel on which the axis are located, by default, is in the first parallel.
@@ -567,7 +567,7 @@ DataZoom component is used for zooming a specific area, which enables user to in
|rangeMode|||Use absolute value or percent value in DataZoom.start and DataZoom.end.
`DataZoom.RangeMode`:
- `//Value`: The value type of start and end.取值类型
- `Percent`: percent value.
|
|start|||The start percentage of the window out of the data extent, in the range of 0 ~ 100.
|end|||The end percentage of the window out of the data extent, in the range of 0 ~ 100.
-|minShowNum|1||Minimum number of display data. Minimum number of data displayed when DataZoom is enlarged to maximum.
+|minShowNum|2||Minimum number of display data. Minimum number of data displayed when DataZoom is enlarged to maximum.
|scrollSensitivity|1.1f||The sensitivity of dataZoom scroll. The larger the number, the more sensitive it is.
|orient|||Specify whether the layout of dataZoom component is horizontal or vertical. What's more, it indicates whether the horizontal axis or vertical axis is controlled by default in catesian coordinate system.
`Orient`:
- `Horizonal`: 水平
- `Vertical`: 垂直
|
|labelStyle|||label style. [LabelStyle](#labelstyle)|
diff --git a/Documentation~/zh/api.md b/Documentation~/zh/api.md
index 0efaac1a..5bdde57f 100644
--- a/Documentation~/zh/api.md
+++ b/Documentation~/zh/api.md
@@ -421,8 +421,10 @@ Inherits or Implemented: [BaseChart](#basechart)
|GetFullName()||public static string GetFullName(Transform transform)|
|GetHighlightColor()||public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)|
|GetLastValue()||public static Vector3 GetLastValue(List<Vector3> list)|
+|GetMaxCeilRate()||public static double GetMaxCeilRate(double value, double ceilRate)|
|GetMaxDivisibleValue()||public static double GetMaxDivisibleValue(double max, double ceilRate)|
|GetMaxLogValue()||public static double GetMaxLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)|
+|GetMinCeilRate()||public static double GetMinCeilRate(double value, double ceilRate)|
|GetMinDivisibleValue()||public static double GetMinDivisibleValue(double min, double ceilRate)|
|GetMinLogValue()||public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)|
|GetOrAddComponent<T>()||public static T GetOrAddComponent<T>(GameObject gameObject) where T : Component|
@@ -1171,6 +1173,7 @@ Inherits or Implemented: [MaskableGraphic](#maskablegraphic)
|GetBezier2()||public static Vector3 GetBezier2(float t, Vector3 sp, Vector3 p1, Vector3 p2, Vector3 ep)|
|GetBezierList()||public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)|
|GetDire()||public static Vector3 GetDire(float angle, bool isDegree = false)|
+|GetIntersection()||public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref List<Vector3> intersection)
获得两直线的交点 |
|GetIntersection()||public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref Vector3 intersection)
获得两直线的交点 |
|GetPos()||public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)|
|GetVertialDire()||public static Vector3 GetVertialDire(Vector3 dire)|
diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md
index a9a857dc..dc058115 100644
--- a/Documentation~/zh/changelog.md
+++ b/Documentation~/zh/changelog.md
@@ -66,6 +66,8 @@ slug: /changelog
## master
+* (2023.05.10) 增加`Axis`的`MinMaxAuto`范围类型
+* (2023.05.10) 增加`Line`对`Clip`的支持
* (2023.05.04) 优化`Axis`在-1到1范围时设置`CeilRate`不生效的问题
* (2023.05.04) 优化`Axis`的`MinMax`类型范围计算
* (2023.05.04) 修复`AxisLabel`在数据都是小于1的浮点数时显示`Label`格式不对的问题
diff --git a/Documentation~/zh/configuration.md b/Documentation~/zh/configuration.md
index 959eb8ad..32aabb41 100644
--- a/Documentation~/zh/configuration.md
+++ b/Documentation~/zh/configuration.md
@@ -252,7 +252,7 @@ Inherits or Implemented: [MainComponent](#maincomponent)
|--|--|--|--|
|show|true||是否显示坐标轴。
|type|||坐标轴类型。
`Axis.AxisType`:
- `Value`: 数值轴。适用于连续数据。
- `Category`: 类目轴。适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。serie的数据第0维数据对应坐标轴data的index。
- `Log`: 对数轴。适用于对数数据。
- `Time`: 时间轴。适用于连续的时序数据。
|
-|minMaxType|||坐标轴刻度最大最小值显示类型。
`Axis.AxisMinMaxType`:
- `Default`: 0-最大值。
- `MinMax`: 最小值-最大值。
- `Custom`: 自定义最小值最大值。
|
+|minMaxType|||坐标轴刻度最大最小值显示类型。
`Axis.AxisMinMaxType`:
- `Default`: 0-最大值。
- `MinMax`: 最小值-最大值。
- `Custom`: 自定义最小值最大值。
- `MinMaxAuto`: [since("v3.7.0")]最小值-最大值。自动计算合适的值。
|
|gridIndex|||坐标轴所在的 grid 的索引,默认位于第一个 grid。
|polarIndex|||坐标轴所在的 ploar 的索引,默认位于第一个 polar。
|parallelIndex|||坐标轴所在的 parallel 的索引,默认位于第一个 parallel。
@@ -567,7 +567,7 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息
|rangeMode|||取绝对值还是百分比。
`DataZoom.RangeMode`:
- `//Value`: The value type of start and end.取值类型
- `Percent`: 百分比。
|
|start|||数据窗口范围的起始百分比。范围是:0 ~ 100。
|end|||数据窗口范围的结束百分比。范围是:0 ~ 100。
-|minShowNum|1||最小显示数据个数。当DataZoom放大到最大时,最小显示的数据个数。
+|minShowNum|2||最小显示数据个数。当DataZoom放大到最大时,最小显示的数据个数。
|scrollSensitivity|1.1f||缩放区域组件的敏感度。值越高每次缩放所代表的数据越多。
|orient|||布局方式是横还是竖。不仅是布局方式,对于直角坐标系而言,也决定了,缺省情况控制横向数轴还是纵向数轴。
`Orient`:
- `Horizonal`: 水平
- `Vertical`: 垂直
|
|labelStyle|||文本标签格式。 [LabelStyle](#labelstyle)|
diff --git a/Runtime/Component/Axis/Axis.cs b/Runtime/Component/Axis/Axis.cs
index 2c4ca54d..710e50b2 100644
--- a/Runtime/Component/Axis/Axis.cs
+++ b/Runtime/Component/Axis/Axis.cs
@@ -59,7 +59,12 @@ namespace XCharts.Runtime
/// Customize the minimum and maximum.
/// |自定义最小值最大值。
///
- Custom
+ Custom,
+ ///
+ /// [since("v3.7.0")]minimum - maximum, automatically calculate the appropriate values.
+ /// |[since("v3.7.0")]最小值-最大值。自动计算合适的值。
+ ///
+ MinMaxAuto,
}
///
/// the position of axis in grid.
diff --git a/Runtime/Component/Axis/AxisHelper.cs b/Runtime/Component/Axis/AxisHelper.cs
index 0b598b3f..7d750607 100644
--- a/Runtime/Component/Axis/AxisHelper.cs
+++ b/Runtime/Component/Axis/AxisHelper.cs
@@ -393,7 +393,14 @@ namespace XCharts.Runtime
break;
case Axis.AxisMinMaxType.MinMax:
+ if (ceilRate != 0)
+ {
+ minValue = ChartHelper.GetMinCeilRate(minValue, ceilRate);
+ maxValue = ChartHelper.GetMaxCeilRate(maxValue, ceilRate);
+ }
+ break;
+ case Axis.AxisMinMaxType.MinMaxAuto:
minValue = needFormat ? ChartHelper.GetMinDivisibleValue(minValue, ceilRate) : minValue;
maxValue = needFormat ? ChartHelper.GetMaxDivisibleValue(maxValue, ceilRate) : maxValue;
break;
diff --git a/Runtime/Internal/Utilities/ChartHelper.cs b/Runtime/Internal/Utilities/ChartHelper.cs
index 94f14e6b..da84ae41 100644
--- a/Runtime/Internal/Utilities/ChartHelper.cs
+++ b/Runtime/Internal/Utilities/ChartHelper.cs
@@ -692,8 +692,8 @@ namespace XCharts.Runtime
intvalue = (int)(max * Mathf.Pow(10, count));
}
var pow = Mathf.Pow(10, count);
- var value = (max > 0) ? (int)((max * pow + 1)) / pow :
- (int)((max * pow - 1)) / pow;
+ var value = max > 0 ? (int)((max * (pow + 1))) / pow :
+ (int)((max * (pow - 1))) / pow;
return GetMaxCeilRate(value, ceilRate);
}
if (ceilRate == 0)
@@ -757,8 +757,8 @@ namespace XCharts.Runtime
intvalue = (int)(min * Mathf.Pow(10, count));
}
var pow = Mathf.Pow(10, count);
- var value = (min > 0) ? (int)((min * pow + 1)) / pow :
- (int)((min * pow - 1)) / pow;
+ var value = min > 0 ? ((int)(min * (pow - 1))) / pow :
+ ((int)(min * (pow + 1))) / pow;
return GetMinCeilRate(value, ceilRate);
}
if (ceilRate == 0)