Web Components for Insights Hub and Industrial IoT - Aggregate Chart - Developer Documentation
Skip to content

Web Components for Insights Hub and Industrial IoT
Aggregate Chart

Warning

Switch to the TimeSeries-Chart which contains same and more functionality.

This component is only available with Version 1.0 - 1.18 and will be removed in later versions.

The Aggregate Chart displays a line graph of the aggregated time series data for the variables of a selected aspect during a specific date/time range. Based on the component's configuration (e.g. zoomDisabled, wheelZoom) the user can change the selected range interactively by dragging or zooming in and out.
For each aggregate the chart displays the first value, last value, minimum, and maximum sorted by timestamp and connects them by one line per variable.

The Aggregate Chart supports:

  • Datatypes long, double, int
  • Simultaneous display of variables from different assets and different aspects

Example

Aggregate Chart

Interface

Models

TimeZoneDateRange
interface TimeZoneDateRange {
    from: Date;
    to: Date;
    isAllDay: boolean;
    timeZone: TimeZone;
}
IDataModel
interface IDataModel {
  // forces reload of data, e.g. re-loading the chart
  refresh(): void;
}
IViewModel
interface IViewModel {
  refresh(): void;
}
TimeZone
enum TimeZone {
    Local = 'Local',
    UTC = 'UTC',
}

Remarks

  • For performance reasons it is recommended to limit the number of variables displayed in the Aggregate Chart to 10.

Roles

  • mdsp:core:iot.tsaUser (IoT Aggregates API is used)

Snippets

Display all Variables of an Aspect

You can either pass an object to specify the aspect or provide the full path.

aggregateChart.variablePaths = [
   // Show all variables of a given aspect
   {
      assetId: '89bba0c1e19c4884bce75d8bcc3773e5',
      aspectName: 'AspectNameX'
   }
];
aggregateChart.variablePaths = [
   // Convenient Syntax: write the path to the assetId/aspect
   '89bba0c1e19c4884bce75d8bcc3773e5/AspectNameX'
];

Display Specific Variables

You can either pass an object to specify the variables to be displayed or provide the full path.

aggregateChart.variablePaths = [
   // Show specific variables of an aspect
   {
      assetId: 'f9f1ff3ccaa1401a98cf37d0c9144c7e',
      aspectName: 'AspectNameX',
      variables: ['VariableName1', ...,'VariableNameN']
   }
];
aggregateChart.variablePaths = [
   // Convenient Syntax: write the path to the assetId/aspect/variableName1&variableName2.. etc.
   'f9f1ff3ccaa1401a98cf37d0c9144c7e/AspectNameX/VariableName1&...&VariableNameN'
];

Update the Variables using an Aspect Variable Selector

Use the event triggered by an Aspect Variable Selector to update the variables to be displayed in the Aggregate Chart. A more detailed code sample is given here.

aspectVariableSelectorComp.addEventListener('selectedAspectsAndVariablesChanged', function (eventParams) {
            timeseriesAggregateComp.variablePaths = eventParams.detail;
        });

Change the Timestamp Format in the Overlay

const chartComp = document.querySelector('mdsp-aggregate-chart');
const localeSettings = chartComp.localeManager.getLocaleSettings();
localeSettings.tooltipTimestampFormat = "DD MM YY HH:mm:ss.SSS";
chartComp.localeManager.addLocale("en-custom", localeSettings);
chartComp.locale = "en-custom";

Custom overlay

Change the variable name in the chart using an alias for a variable

const chartComp = document.querySelector('mdsp-aggregate-chart');
chartComp.variablePaths = [{
   assetId: '730540babbb44fe58f24cc71c04fd1fc',
   aspectName: 'aspect_pump',
   variables: [{
      name: 'MotorCurrent',
      alias: 'Motor current which needs a very special alias name'
   }]
}]

Setting an alias name

Change the drag mode of the aggregate chart

<mdsp-aggregates-chart drag-mode="Select"></mdsp-aggregates-chart>


Drag mode Select allows the user to drag and select an area in order to zoom into the chart. Drag mode Move will move the chart while dragging.

Drag mode Select in the chart


Except where otherwise noted, content on this site is licensed under the Development License Agreement.


Last update: April 13, 2023