Skip to main content
All docs
V24.1

HeatmapControl.SelectedItems Property

Gets or sets heatmap cells or source objects that are used to create the selected cells.

Namespace: DevExpress.XtraCharts.Heatmap

Assembly: DevExpress.XtraCharts.v24.1.UI.dll

NuGet Package: DevExpress.Win.Charts

Declaration

[Browsable(false)]
public IList SelectedItems { get; }

Property Value

Type Description
IList

A list of objects that store cell data.

Remarks

If the heatmap is bound to a data source, the SelectedItems property returns the data objects assigned to the selected cells. Otherwise, the selected cell objects are returned.

The following example shows how to use heatmap selected cell data as a source for another chart:

Selection demo

Run Demo: Selection

public HeatmapSelection() {
    InitializeComponent();
    List<ProductSale> data = LoadData();
    HeatmapDataAdapter.DataSource = data;
    HeatmapDataAdapter.XArgumentComparer = new OriginalOrderComparer();
    heatmapControl1.SelectedItems.Add(data[0]);
}
List<ProductSale> LoadData() {
    List<ProductSale> data = new List<ProductSale>();
    try {
        XDocument sales_xml = XDocument.Load(Utils.GetRelativePath("ProductSales.xml"));
        foreach (XElement monthSale in sales_xml.Root.Elements()) {
            string product = monthSale.Element("Product").Value;
            string month = monthSale.Element("Month").Value;
            List<DailySale> dailySales = new List<DailySale>();
            foreach (XElement daySale in monthSale.Elements("SalesByDay").Elements("DailySale")) {
                dailySales.Add(new DailySale() {
                    Product = product,
                    Date = Convert.ToDateTime(daySale.Element("Date").Value),
                    Revenue = Convert.ToDouble(daySale.Element("Revenue").Value)
                });
            }
            data.Add(new ProductSale() { SalesByDay = dailySales });
        }
    }
    catch {
    }
    return data;
}
void heatmapControl1_SelectedItemsChanged(object sender, XtraCharts.SelectedItemsChangedEventArgs e) {
    List<DailySale> list = new List<DailySale>();
    foreach (ProductSale item in heatmapControl1.SelectedItems)
        list.AddRange(item.SalesByDay);
    chartControl1.DataSource = list;
}
See Also