Back to Devexpress

Dashboard Class

dashboard-devexpress-dot-dashboardcommon.md

latest9.2 KB
Original Source

Dashboard Class

Contains the full description of a dashboard used to visualize data.

Namespace : DevExpress.DashboardCommon

Assembly : DevExpress.Dashboard.v25.2.Core.dll

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
[InitAssemblyResolver]
public class Dashboard :
    Component,
    IDashboard,
    ISupportInitialize,
    IServiceProvider,
    IColorSchemeContext,
    IChangeService,
    IActualParametersProvider,
    IDataSourceInfoProvider,
    IDashboardItemsProvider,
    ICustomPropertyProvider
vb
<InitAssemblyResolver>
Public Class Dashboard
    Inherits Component
    Implements IDashboard,
               ISupportInitialize,
               IServiceProvider,
               IColorSchemeContext,
               IChangeService,
               IActualParametersProvider,
               IDataSourceInfoProvider,
               IDashboardItemsProvider,
               ICustomPropertyProvider

The following members return Dashboard objects:

Show 16 links

Remarks

The Dashboard class contains the full description of a dashboard, including the collection of dashboard items and groups, data binding information, layout and appearance settings, etc.

To create a new dashboard in code, do the following.

If necessary, you can add dashboard parameters (Dashboard.Parameters), change dashboard title settings (Dashboard.Title), customize a global color scheme (Dashboard.ColorScheme), etc. If you change multiple dashboard settings, wrap the code in the Dashboard.BeginUpdate and Dashboard.EndUpdate method calls.

The table below lists properties that accept the Dashboard object:

ControlAPI
DashboardDesignerDashboardDesigner.Dashboard
DashboardViewerDashboardViewer.Dashboard
DashboardControl.DashboardDashboardControl.Dashboard

Example

The example below shows how to create a dashboard in code. In this example, the Dashboard object contains the full dashboard description:

The resulting dashboard should look in as follows in the WinForms Viewer (if you assign the dashboard to the DashboardViewer.Dashboard property):

csharp
Dashboard dashboard = new Dashboard();

DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("Data Source 1", "nwindConnection");
SelectQuery selectQuery = SelectQueryFluentBuilder
    .AddTable("SalesPerson")
    .SelectAllColumns()
    .Build("Query 1");
sqlDataSource.Queries.Add(selectQuery);
sqlDataSource.Fill();
dashboard.DataSources.Add(sqlDataSource);

GaugeDashboardItem gauges = new GaugeDashboardItem();
gauges.SeriesDimensions.Add(new Dimension("Country"));
gauges.Gauges.Add(new Gauge(new Measure("Extended Price")));

CardDashboardItem cards = new CardDashboardItem();
cards.SeriesDimensions.Add(new Dimension("Sales Person"));
cards.Cards.Add(new Card() {
    ActualValue = new Measure("Extended Price"),
    LayoutTemplate = new CardStretchedLayoutTemplate() }
);

ChartDashboardItem chart = new ChartDashboardItem();
chart.Arguments.Add(new Dimension("CategoryName"));
chart.SeriesDimensions.Add(new Dimension("OrderDate"));
chart.Panes.Add(new ChartPane());
SimpleSeries salesAmountSeries = new SimpleSeries(SimpleSeriesType.Bar);
salesAmountSeries.Value = new Measure("Extended Price");
chart.Panes[0].Series.Add(salesAmountSeries);

dashboard.Items.AddRange(gauges, chart, cards);
foreach(DataDashboardItem item in dashboard.Items) {
    item.DataSource = sqlDataSource;
    item.DataMember = "Query 1";
}
vb
Dim dashboard As New Dashboard()

Dim sqlDataSource As New DashboardSqlDataSource("Data Source 1", "nwindConnection")
Dim selectQuery As SelectQuery = SelectQueryFluentBuilder.AddTable("SalesPerson").SelectAllColumns().Build("Query 1")
sqlDataSource.Queries.Add(selectQuery)
sqlDataSource.Fill()
dashboard.DataSources.Add(sqlDataSource)

Dim gauges As New GaugeDashboardItem()
gauges.SeriesDimensions.Add(New Dimension("Country"))
gauges.Gauges.Add(New Gauge(New Measure("Extended Price")))

Dim cards As New CardDashboardItem()
cards.SeriesDimensions.Add(New Dimension("Sales Person"))
cards.Cards.Add(New Card() With {
    .ActualValue = New Measure("Extended Price"),
    .LayoutTemplate = New CardStretchedLayoutTemplate()
})

Dim chart As New ChartDashboardItem()
chart.Arguments.Add(New Dimension("CategoryName"))
chart.SeriesDimensions.Add(New Dimension("OrderDate"))
chart.Panes.Add(New ChartPane())
Dim salesAmountSeries As New SimpleSeries(SimpleSeriesType.Bar)
salesAmountSeries.Value = New Measure("Extended Price")
chart.Panes(0).Series.Add(salesAmountSeries)

dashboard.Items.AddRange(gauges, chart, cards)
For Each item As DataDashboardItem In dashboard.Items
    item.DataSource = sqlDataSource
    item.DataMember = "Query 1"
Next item

Implements

ICustomPropertyProvider

Inheritance

Object MarshalByRefObject Component Dashboard

See Also

Dashboard Members

DevExpress.DashboardCommon Namespace