Creating meter charts
A meter chart displays data in data groups. Data groups can
be plotted in the form of meters to measure the rate of change of a quantity against pre-defined
targets.
About this task
- Card title
- A unique label or heading that is assigned to the card.
- Card tooltip
- A tooltip provides extra details about the data that is displayed on the card.
- Label
- A data qualifier label. For example, last 30 days
- Categories
- The data groups retrieved by a query.
- Footer link
- A clickable field or link with a label. For example,
View all
. - Legend
- The label of the data group.
Procedure
On the General tab, define the card:
On the Data tab, add data to the card:
On the Style tab, define the style of the card:
Example
For a meter chart, any attribute that
is returned by a query can be displayed. The query includes a tenantId
variable.
query supplyShipments($tenantId: String, $customerFilter: BooleanExp = {CONSTANT_VALUE: true}, $supplierFilter: BooleanExp = {CONSTANT_VALUE: true}, $carrierFilter: BooleanExp = {CONSTANT_VALUE: true}, $originFilter: BooleanExp = {CONSTANT_VALUE: true}, $destinationFilter: BooleanExp = {CONSTANT_VALUE: true}, $locationGroupsFilter: BooleanExp = {CONSTANT_VALUE: true}) {
totalShipmentMetrics: businessObjects(
simpleFilter: {tenantId: $tenantId, type: Shipment}
advancedFilter: {AND: [{EQUALS: [{SELECT: "shipmentType", type: STRING}, {VALUE: "INBOUND", type: STRING}]}, $customerFilter, $supplierFilter, $carrierFilter, $originFilter, $destinationFilter, $locationGroupsFilter]}
hint: {viewId: "graph"}
cursorParams: {first: 0}
) {
totalCount
}
shipmentsInTransitMetrics: businessObjects(
simpleFilter: {tenantId: $tenantId, type: Shipment}
advancedFilter: {AND: [{EQUALS: [{SELECT: "shipmentType", type: STRING}, {VALUE: "INBOUND", type: STRING}]}, {EQUALS: [{SELECT: "statusByDate", type: STRING}, {VALUE: "IN_TRANSIT", type: STRING}]}, $customerFilter, $supplierFilter, $carrierFilter, $originFilter, $destinationFilter]}
hint: {viewId: "graph"}
) {
totalCount
}
shipmentsDeliveredMetrics: businessObjects(
simpleFilter: {tenantId: $tenantId, type: Shipment}
advancedFilter: {AND: [{EQUALS: [{SELECT: "shipmentType", type: STRING}, {VALUE: "INBOUND", type: STRING}]}, {EQUALS: [{SELECT: "statusByDate", type: STRING}, {VALUE: "DELIVERED", type: STRING}]}, $customerFilter, $supplierFilter, $carrierFilter, $originFilter, $destinationFilter]}
hint: {viewId: "graph"}
) {
totalCount
}
shipmentsUnshippedMetrics: businessObjects(
simpleFilter: {tenantId: $tenantId, type: Shipment}
advancedFilter: {AND: [{EQUALS: [{SELECT: "shipmentType", type: STRING}, {VALUE: "INBOUND", type: STRING}]}, $customerFilter, $supplierFilter, $carrierFilter, $originFilter, $destinationFilter, {NOT: [{EQUALS: [{SELECT: "statusByDate", type: STRING}, {VALUE: "DELIVERED", type: STRING}]}]}, {NOT: [{EQUALS: [{SELECT: "statusByDate", type: STRING}, {VALUE: "IN_TRANSIT", type: STRING}]}]}]}
hint: {viewId: "graph"}
) {
totalCount
edges {
object {
... on Shipment {
shipToLocation {
locationGroups {
edges {
object {
locationGroupName
locationGroupIdentifier
}
}
}
}
}
}
}
}
}
The following code is an example of how to define the variables to use in the query.
{
"tenantId": "{{ tenantId }}"
}
The following code is an example of the data that is returned by the query.
"data": {
"totalShipmentMetrics": {
"totalCount": 164,
"__typename": "BusinessObjectsCursor"
},
"shipmentsInTransitMetrics": {
"totalCount": 21,
"__typename": "BusinessObjectsCursor"
},
"shipmentsDeliveredMetrics": {
"totalCount": 140,
"__typename": "BusinessObjectsCursor"
},
"shipmentsUnshippedMetrics": {
"totalCount": 3,
"edges": [
{
"object": {
"shipToLocation": {
"locationGroups": {
"edges": [],
"__typename": "LocationGroupsCursor"
},
"__typename": "Location"
},
"__typename": "Shipment"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"shipToLocation": {
"locationGroups": {
"edges": [],
"__typename": "LocationGroupsCursor"
},
"__typename": "Location"
},
"__typename": "Shipment"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"shipToLocation": {
"locationGroups": {
"edges": [],
"__typename": "LocationGroupsCursor"
},
"__typename": "Location"
},
"__typename": "Shipment"
},
"__typename": "BusinessObjectEdge"
}
],
"__typename": "BusinessObjectsCursor"
}
},
"loading": false,
"networkStatus": 7
}
The following code is an example of the transformation that is applied to the data.
The attributes that are chosen must match what is returned from the data. Any calculation can be
performed on the data that is returned. In the following example, color is modified for the
unshipped
, inTransit
, and delivered
data
groups.
{
"colorTemplate": {
"unshipped": "#6929c4",
"inTransit": "#009d9a",
"delivered": "#e0e0e0"
},
"totalCount": [
"{{ this.data.totalShipmentMetrics.totalCount }}"
],
"errors": "{{#? this.errors}}",
"pageInfo": "{}",
"results": [
{
"group": "unshipped",
"value": "{{this.data.shipmentsUnshippedMetrics.totalCount}}"
},
{
"group": "inTransit",
"value": "{{this.data.shipmentsInTransitMetrics.totalCount}}"
},
{
"group": "delivered",
"value": "{{this.data.shipmentsDeliveredMetrics.totalCount}}"
}
]
}
What to do next
Add the card to a page by using the Page builder.