翻譯|行業資訊|編輯:龔雪|2023-07-31 11:16:15.243|閱讀 142 次
概述:在DevExpress BI Dashboard v23.1中支持Dashboard圖表項中使用趨勢指標,歡迎下載最新版組件體驗~
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
DevExpress BI Dashboard v23.1支持在Dashboard圖表項中使用趨勢指標,趨勢指標有助于傳達一段時間內的數據趨勢——允許用戶發現模式并更有效地分析復雜的數據集。
使用DevExpress Analytics Dashboard,再選擇合適的UI元素(圖表、數據透視表、數據卡、計量器、地圖和網格),刪除相應參數、值和序列的數據字段,就可以輕松地為執行主管和商業用戶創建有洞察力、信息豐富的、跨平臺和設備的決策支持系統。
DevExpress Dashboard v23.1正式版下載
DevExpress技術交流群8:523159565 歡迎一起進群討論
DevExpress BI Dashboard支持以下趨勢指標(跨所有支持的平臺):
您可以通過Dashboard的UI和代碼創建、編輯和刪除這些指示器。
最終用戶可以通過Dashboard的UI管理趨勢指標集合。
 
 
 
 
使用默認設置生成一個新的指標,用戶可以更改指標類型、外觀設置或特定于圖表系列類型的設置(例如,用戶可以選擇計算財務系列指標的值:開盤價、高點、低點或收盤價)。
 
 
在運行時,您需要創建一個或對象,并將其添加到中。完成后,使用下面列出的API來指定指標設置。
此屬性是必需的,并在啟動應用程序時在圖表儀表板項中顯示指示器:
如果不指定以下屬性,則使用默認值:
下面的代碼片段一個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);
}
}
您可以創建自己的自定義指標類型來滿足特定的業務需求:
如果使用Web Dashboard,請在呈現控件之前注冊(以便將自定義指示器類型添加到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 Dictionary<AxisPoint, object> Calculate(Dictionary<AxisPoint, decimal?> values) {
var items = new Dictionary<AxisPoint, object>(values.Count);
var sum = decimal.Zero;
var count = 0;
foreach(KeyValuePair<AxisPoint, 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.Register<MovingIndicator>("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中可用:
 
 
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉載自:慧都網