AddChart添加图表时,如果没有设置Y轴,则自动增加一个

This commit is contained in:
智能大石头 2025-07-25 14:36:10 +08:00
parent d1c9e5aaae
commit b487cd580d
2 changed files with 4 additions and 2 deletions

View File

@ -969,6 +969,10 @@ public partial class ReadOnlyEntityController<TEntity> : ControllerBaseX where T
}
chart.Add(data, yFields, seriesType);
// 如果没有Y轴自动补上
if (yFields.Length > 0 && (chart.YAxis == null || chart.YAxis.Count == 0))
chart.SetY(yFields[0].Name, "value");
}
if (seriesType == SeriesTypes.Pie)

View File

@ -2,14 +2,12 @@
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Web;
using System.Xml.Linq;
using System.Xml.Serialization;
using NewLife.Collections;
using NewLife.Data;
using NewLife.Reflection;
using NewLife.Web;
using XCode.Configuration;
using static System.Net.Mime.MediaTypeNames;
namespace NewLife.Cube.ViewModels;