Pie Chart

The Pie Chart block displays proportional data across one or more devices. In the example below, a device’s GPS data is being shown as a percentage of time it spends at certain locations.

Pie Chart

Configuration

Data Type

Data Type

The Pie Chart can display points as a live stream (re-rendering the chart every time a data point hits the platform) or as a historical chart. Each style has its own advantages:

  • Live stream charts provide feedback with more immediacy than historical charts, as they do not require a dashboard data refresh to populate with new data. If one of the block’s segments references multiple devices by ID or tag, the block will update anytime any of those devices reports state for the chosen attribute. For this reason we recommend one device per segment when building live stream blocks.
  • Historical charts allow for data to be aggregated according to a number of rules (based on time durations, mathematical functions and the combination of data from multiple sources), and they also allow for viewing past dashboard states.

Duration

To view the current state of your device(s), select “Last received data point”. To view an aggregation of your data over a given time period, choose any other value. This option is removed when “Live Stream” is selected for the block’s data type.

Gauge Duration

Block Data

The block data is an array of segments, and each segment represents a region on the pie chart. While it is possible to create a chart within only one segment, the visualization would be meaningless as the segment has nothing against which to compare itself.

Pie Block Data

Each segment takes the following parameters:

  • Label is the text displayed in the graph key for each segment. This can be any value, but you will want it to properly represent its segment.
  • Device IDS / Tags: A device query for choosing which devices are displayed within the segment.
  • Attribute: Device attribute whose value displays in the gauge. This attribute must be of the type Number. If data from more than one device is displayed, each of those devices must supply the same attribute name.
  • Aggregation Type: Only applies when Duration is set to anything other than “Last received data point,” or when a device tag is supplied in the device query, or if more than one device ID is supplied in the device query. This determines how all of the available data returned should be aggregated before displaying the value. For example, “Mean” averages all data points together before displaying within the gauge.

Data Transformation

You may apply an expression to data points in the segment. You have access to the following variables when evaluating the expression:

  • {{value}}: The raw value of the data point.
  • {{time}}: The time of the corresponding data point in milliseconds since Epoch.
  • {{ctx.VARIABLE_NAME}}: The value of a given context variable.

The performed transformation will not affect the raw data returned by your query, but will adjust the data before it is applied to the chart. If an invalid expression is provided, the data point reverts to its raw value.

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.