界面控件DevExpress BI Dashboard v23.1——支持全新的图标趋势指标

📅 2026/8/8 17:44:02
界面控件DevExpress BI Dashboard v23.1——支持全新的图标趋势指标
DevExpress BI Dashboard v23.1支持在Dashboard图表项中使用趋势指标趋势指标有助于传达一段时间内的数据趋势——允许用户发现模式并更有效地分析复杂的数据集。使用DevExpress Analytics Dashboard再选择合适的UI元素图表、数据透视表、数据卡、计量器、地图和网格删除相应参数、值和序列的数据字段就可以轻松地为执行主管和商业用户创建有洞察力、信息丰富的、跨平台和设备的决策支持系统。DevExpress新旧版本帮助文档下载可进QQ qun获取169725316DevExpress BI Dashboard支持以下趋势指标(跨所有支持的平台)Trend line(ChartTrendLine)显示相关点的大致方向(通常用于识别现有数据趋势和预测未来趋势)。Regression line(ChartRegressionLine)使用数学公式将数据可视化该数学公式将线本身与相关数据点之间的距离最小化(通常用于对两个变量之间的关系进行建模并可用于根据另一个变量的值对一个变量进行预测)。Custom Indicator(ChartCustomIndicator)允许您添加自己的指标类型来可视化销售趋势和呈现财务模式。您可以通过Dashboard的UI和代码创建、编辑和删除这些指示器。终端用户体验最终用户可以通过Dashboard的UI管理趋势指标集合。在Web Dashboard设计器中单击Options对话框中的Trend Indicators打开Trend Indicators编辑器。在WinForms Dashboard设计器中单击Ribbons Analysis分组Data Ribbon页面中的Trend Indicators按钮。该命令调用Trend Indicators编辑器对话框编辑器允许用户创建/编辑/删除趋势指标。使用默认设置生成一个新的指标用户可以更改指标类型、外观设置或特定于图表系列类型的设置(例如用户可以选择计算财务系列指标的值开盘价、高点、低点或收盘价)。运行时在运行时您需要创建一个ChartTrendLine或ChartRegressionLine对象并将其添加到ChartDashboardItem.Indicators中。完成后使用下面列出的API来指定指标设置。此属性是必需的并在启动应用程序时在图表仪表板项中显示指示器Value如果不指定以下属性则使用默认值NameValueLevelShowInLegendLegendTextThicknessColorDashStyleVisible下面的代码片段一个ASP. NET Core Dashboard应用程序创建了一个“销售趋势”指示器。using DevExpress.DashboardCommon; using System.Drawing; // ... public partial class CustomIndicatorDashboard : DevExpress.DashboardCommon.Dashboard { public CustomIndicatorDashboard() { InitializeComponent(); ChartDashboardItem chartItem Items.First(x x.ComponentName chartDashboardItem1) as ChartDashboardItem; ChartTrendLine trendLine new ChartTrendLine(); SimpleSeries simpleSeries chartItem.Panes[0].Series[0] as SimpleSeries; if (simpleSeries ! null) { trendLine.Value simpleSeries.Value.UniqueId; } trendLine.Name SalesTrend; trendLine.ValueLevel DevExpress.XtraCharts.ValueLevel.Value; trendLine.Color Color.Orange; trendLine.LegendText Sales Trend; chartItem.Indicators.Add(trendLine); } }添加自定义指标类型您可以创建自己的自定义指标类型来满足特定的业务需求创建一个ChartCustomIndicator后代它接受数据点的集合、计算值并返回结果点这些点用于绘制指示器。在IndicatorFactory 中注册结果类型来使该类作为指示器类型可用。如果使用Web Dashboard请在呈现控件之前注册ChartIndicatorsExtension(以便将自定义指示器类型添加到Trend Indicators编辑器)。下面的代码片段在ASP. NET Core Dashboard中实现/注册一个“移动平均线”自定义指标类型。using DevExpress.DashboardCommon; using DevExpress.DashboardCommon.ViewerData; using System.Collections.Generic; namespace asp_net_core_dashboard_control_trendline_indicators.Data { public class MovingIndicator : ChartCustomIndicator { protected override DictionaryAxisPoint, object Calculate(DictionaryAxisPoint, decimal? values) { var items new DictionaryAxisPoint, object(values.Count); var sum decimal.Zero; var count 0; foreach(KeyValuePairAxisPoint, decimal? point in values) { if(count 0) { items.Add(point.Key, null); } else { items.Add(point.Key, sum / count); } sum point.Value ?? 0; count; } return items; } } }在保存和加载指示板之前在应用程序中调用Register方法(在指示板的XML中序列化和反序列化指示符)。using DevExpress.DashboardWeb; using TrendIndicators.Data; namespace TrendIndicators { public static class DashboardUtils { public static DashboardConfigurator CreateDashboardConfigurator(IConfiguration configuration, IFileProvider fileProvider) { DashboardConfigurator configurator new DashboardConfigurator(); // ... IndicatorFactory.RegisterMovingIndicator(Moving average); return configurator; } } } Register ChartIndicatorsExtension before the control is rendered to add MovingIndicator type to the Trend Indicators editor. function onBeforeRender(dashboardControl) { // ... dashboardControl.registerExtension(new DevExpress.Dashboard.Designer.ChartIndicatorsExtension(dashboardControl, { customIndicatorTypes: [ { type: MovingIndicator, displayName: Moving Average } ] })); }打开趋势指标编辑器并添加一个新的趋势指标。如果您遵循这个例子一个新的移动平均类型将在UI中可用