[fix] fix divide by zero exception

This commit is contained in:
monitor1394
2022-09-30 16:35:53 +08:00
parent 75bf6e0e6c
commit 99769da035
2 changed files with 3 additions and 1 deletions

View File

@@ -59,6 +59,8 @@
## master
* (2022.09.30) 修复`Chart`在很小尺寸时出现`DivideByZeroException`异常
## v3.3.0
### 版本要点

View File

@@ -261,7 +261,7 @@ namespace XCharts.Runtime
else
{
var data = axis.GetDataList(dataZoom);
if (axis.IsCategory() && data.Count > 0)
if (axis.IsCategory() && data.Count > 0 && splitNum > 0)
{
var count = axis.boundaryGap ? data.Count : data.Count - 1;
int tick = count / splitNum;