The requested page is not available for the requested platform. You are viewing the content for Default platform.

Providing Data

The Web Dashboard allows you to bind various dashboard items to data in a virtually uniform manner. To learn more, see the Binding Dashboard Items to Data in the Web Dashboard's UI topic.

The only difference is in the data sections that the required dashboard item has. This topic describes how to bind a Range Filter dashboard item to data.

Note

The Range Filter dashboard item cannot be bound to the OLAP data source.

Binding to Data in the Web Dashboard

The image below shows a sample Range Filter dashboard item that is bound to data.

wdd-range-filter-bindings

To bind the Range Filter dashboard item to data, click a placeholder contained in one of the available data sections and select the required data source field in the Binding section of the invoked data item menu.

The table below lists and describes the Range Filter's data sections.

Section

Processed as

Description

Values

Measure

Contains data items against which the Y-coordinates of data points are calculated.

Arguments

Dimension

Contains data items that provide values displayed along the horizontal axis of the Range Filter. Data filtering is performed based on these values.

Note

Note that the Custom Periods section in the Options menu allows you to create predefined ranges used to select the required date-time interval.

Series

Dimension

Contains data items whose values are used to create chart series.

Example

The following example shows how to create the Range Filter item, bind it to data and add to the existing dashboard.

Create data items (measures and dimensions) and use the DataItem.dataMember property to bind them to the existing data source's columns. Then use the created measures and dimensions in the dashboard item to bind it to data.

Create a DateTimePeriod instance and add it to the RangeFilterItem.dateTimePeriods collection to create predefined ranges.

After you add the created dashboard item to the Dashboard.items collection, call the Dashboard.rebuildLayout method to rebuild the dashboard layout and display changes.

// Use the line below for a modular approach:
// import * as Model from 'devexpress-dashboard/model'
// Use the line below for an approach with global namespaces:
// var Model = DevExpress.Dashboard.Model;

// ...
public createRangeFilter() { 
    // Create data items for the Range Filter.    
    var rangeFilterCountry = new Model.Dimension();
    rangeFilterCountry.dataMember("Country");
    var rangeFilterUnitPrice = new Model.Measure();
    rangeFilterUnitPrice.dataMember("UnitPrice");
    var rangeFilterExtendedPrice = new Model.Measure();
    rangeFilterExtendedPrice.dataMember("ExtendedPrice");
    var rangeFilterQuantity = new Model.Measure();
    rangeFilterQuantity.dataMember("Quantity");
    var rangeFilterOrderDate = new Model.Dimension();
    rangeFilterOrderDate.dataMember("OrderDate");
    rangeFilterOrderDate.dateTimeGroupInterval("Year");

    // Create the Range Filter and bind it to data.
    var rangeFilterItem = new Model.RangeFilterItem();
    rangeFilterItem.name('rangeFilter');
    rangeFilterItem.dataSource(sqlDataSource.componentName());
    rangeFilterItem.dataMember(sqlDataSource.queries()[0].name());

    var rangeSeries = new Model.SimpleSeries(rangeFilterItem);
    rangeSeries.seriesType("Line");
    rangeSeries.value(rangeFilterUnitPrice);
    rangeFilterItem.series.push(rangeSeries);
    rangeFilterItem.argument(rangeFilterOrderDate);
    rangeFilterItem.seriesDimensions.push(rangeFilterCountry);

    // Create a custom period for predefined ranges.
    var monthToDayPeriod = new Model.DateTimePeriod();
    monthToDayPeriod.name("Month to Date");
    monthToDayPeriod.start.flow.interval("Month").offset(0);
    monthToDayPeriod.start.mode("Flow");
    monthToDayPeriod.end.flow.interval("Day").offset(1);
    monthToDayPeriod.end.mode("Flow");

    rangeFilterItem.dateTimePeriods.push(monthToDayPeriod);

    control.dashboard().items.push(rangeFilterItem);
    // ...
    control.dashboard().rebuildLayout();
}