Skip to main content
All docs
V24.1

CustomItemData.GetFlatData(DashboardFlatDataSourceOptions) Method

Returns custom item data in a tabular format.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v24.1.Core.dll

NuGet Package: DevExpress.Dashboard.Core

Declaration

public DashboardFlatDataSource GetFlatData(
    DashboardFlatDataSourceOptions options = null
)

Optional Parameters

Name Type Default Description
options DashboardFlatDataSourceOptions null

A DashboardFlatDataSourceOptions object that contains DashboardFlatDataSource settings.

Returns

Type Description
DashboardFlatDataSource

Custom item data in a tabular format.

Remarks

The following code snippet binds data to the custom Funnel chart’s series:

using System.Windows.Forms;
using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using DevExpress.XtraCharts;

public class CustomFunnelControlProvider : CustomControlProviderBase {
  CustomDashboardItem<CustomFunnelMetadata> dashboardItem;
  //...
  protected override void UpdateControl(CustomItemData customItemData){
      chart.Series.Clear();
      if(dashboardItem.Metadata.Value != null && dashboardItem.Metadata.Arguments.Count > 0) {
          Series series = new Series("A Funnel Series", ViewType.Funnel);
          flatData = customItemData.GetFlatData(new DashboardFlatDataSourceOptions() { AddColoringColumns = true });
          series.DataSource = flatData;
          series.ValueDataMembers.AddRange(dashboardItem.Metadata.Value.UniqueId);
          series.ArgumentDataMember = dashboardItem.Metadata.Arguments.Last().UniqueId;
          series.ColorDataMember = flatData.GetColoringColumn(dashboardItem.Metadata.Value.UniqueId).Name;
          chart.Series.Add(series);
      }
  }
}

The GetFlatData method returns the DashboardFlatDataSource object that contains unformatted measure and dimension values. To apply formatting defined for these measures and dimensions, you can replace values with their display text and visualize it in a custom item.

Use the following methods to get display text for custom item data:

  • The GetDisplayText method gets display text for a particular measure or dimension by the row’s index:

    The following code snippet formats display text for the custom Grid’s cells:

    custom grid with formatted values

    using DevExpress.DashboardWin;
    using DevExpress.XtraGrid;
    using DevExpress.DashboardCommon;
    
    namespace CustomItemsSample {
      public class CustomGridProvider : CustomControlProviderBase {
        GridView view;
        // ...
        public CustomGridProvider() {
          view = new GridView();
          grid.MainView = view;
          view.CustomColumnDisplayText += View_CustomColumnDisplayText;
        }
        void View_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) {
          DashboardFlatDataSource data = (DashboardFlatDataSource)grid.DataSource;
          e.DisplayText = data.GetDisplayText(e.Column.FieldName, e.ListSourceRowIndex);
        }
      }
    }
    
  • The GetDisplayTextColumn method returns a display text column from the data item’s unique Id.

    The following code snippet returns display text columns for the custom Sankey item:

    using DevExpress.DashboardCommon;
    using DevExpress.DashboardWin;
    
    namespace CustomItemsSample {
      public class SankeyItemControlProvider : CustomControlProviderBase {
        DashboardFlatDataSource flatData;
        CustomDashboardItem<SankeyItemMetadata> dashboardItem;
    
        protected override void UpdateControl(CustomItemData customItemData) {
            flatData = customItemData.GetFlatData(new DashboardFlatDataSourceOptions() { AddColoringColumns = true, AddDisplayTextColumns = true });
            SetDataBindings(flatData);
        }
    
        void SetDataBindings(DashboardFlatDataSource flatData) {
            sankey.Colorizer = new SankeyItemColorizer(flatData);
            sankey.SourceDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Source.UniqueId).Name;
            sankey.TargetDataMember = flatData.GetDisplayTextColumn(dashboardItem.Metadata.Target.UniqueId).Name;
            if(dashboardItem.Metadata.Weight != null)
                sankey.WeightDataMember = dashboardItem.Metadata.Weight.UniqueId;
            try {
                sankey.DataSource = flatData;
            } catch {
                sankey.DataSource = null;
            }
        }  
      }
    }
    

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetFlatData(DashboardFlatDataSourceOptions) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also