优化Serie的数据全为0时Y轴不显示的问题

This commit is contained in:
monitor1394
2021-08-03 08:23:02 +08:00
parent a4963435d7
commit b5098d5682
3 changed files with 4 additions and 2 deletions

View File

@@ -39,6 +39,7 @@
## master
* (2021.08.03) Fixed y axis not displaying when all data is 0
* (2021.07.29) Fixed ignored data will also participate in calculations when `ignore` is enabled (#161)
* (2021.07.29) Improved `BarChart`'s `Zebra` gradient support
* (2021.07.26) Fixed issue where `XCharts` path could not be found when `TextMeshPro Enable` (#160)

View File

@@ -39,6 +39,7 @@
## master
* (2021.08.03) 优化`Serie`的数据全为0时Y轴不显示的问题
* (2021.07.29) 修复`Serie`开启`ignore`时被忽略的数据还会参与计算的问题 (#161)
* (2021.07.29) 完善`BarChart``Zebra`斑马柱图渐变支持
* (2021.07.26) 修复`TextMeshPro Enable`时找不到`XCharts`路径的问题 (#160)

View File

@@ -118,7 +118,8 @@ namespace XCharts
int split = GetSplitNumber(axis, coordinateWidth, dataZoom);
if (axis.type == Axis.AxisType.Value)
{
if (minValue == 0 && maxValue == 0) return string.Empty;
if (minValue == 0 && maxValue == 0)
maxValue = axis.max != 0 ? axis.max : 1;
double value = 0;
if (forcePercent) maxValue = 100;
if (axis.interval > 0)
@@ -396,7 +397,6 @@ namespace XCharts
{
if (!axis.show) return false;
if (axis.IsCategory() && axis.GetDataList().Count <= 0) return false;
else if (axis.IsValue() && axis.runtimeMinValue == 0 && axis.runtimeMaxValue == 0) return false;
else return true;
}