Skip to main content
All docs
V24.1

DashboardFlatDataSource.GetDisplayTextColumn(String) Method

Gets the display text column corresponding to the data item.

Namespace: DevExpress.DashboardCommon

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

NuGet Package: DevExpress.Dashboard.Core

Declaration

public DashboardFlatDataColumn GetDisplayTextColumn(
    string dataItemId
)

Parameters

Name Type Description
dataItemId String

A data item’s unique id.

Returns

Type Description
DashboardFlatDataColumn

A data column that contains formatted string values.

Remarks

The DashboardFlatDataSource object contains data columns with unformatted measure and dimension values. You can use display text columns to visualize formatted values in the resulting custom item’s view. These columns contain formatted string values for each data column in DashboardFlatDataSource. To visualize formatted values in a custom item, follow the steps below:

  1. Set the AddDisplayTextColumns property to true and pass the DashboardFlatDataSourceOptions object to the CustomItemData.GetFlatData(DashboardFlatDataSourceOptions) method to include display text columns in DashboardFlatDataSource.

  2. Call the GetDisplayTextColumn method to get a display text column for a data item and bind column values to a custom control. The formatted values for the data item will be visualized in the custom item.

The following code snippet gets 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;
        }
    }  
  }
}
See Also