Creating area charts
About this task
- Y-axis title
- A label that is assigned to the vertical axis of the chart.
- Card title
- A unique label or heading assigned to the card.
- Card tooltip
- A tooltip provides extra details about the data that is displayed on the card.
- Threshold
- A line on the chart above or below which are significant values.
- X- axis title
- A label assigned to the horizontal axis of the chart.
- Footer link
- A clickable field or link with a label, for example
View all. - Legend
- The label of the data group.
Procedure
Example
The following GraphQL query retrieves data from the business object service. The query takes a tenant ID as an input parameter and returns a list of orders with their associated buyer information, quantity, and planned ship date. The query also includes pagination parameters for retrieving a limited number of results and sorting the results by planned ship date in ascending order. Additionally, the query includes an aggregation parameter that groups orders by their planned ship date and counts the number of buyers who placed each order.
query orders($tenantId: String) {
orderLineChart: businessObjects(
simpleFilter: {tenantId: $tenantId, type: Order}
hint: {viewId: "orderflow"}
cursorParams: {first: 10, sort: {fieldPath: "plannedShipDate", order: ASC}}
aggregationParams: {dimension: {fieldPath: "plannedShipDate", type: STRING}, reduce: {expression: {fieldPath: "quantity", operator: SUM, type: INT}, output: {resultAlias: "buyers", type: INT}}}
) {
totalCount
pageInfo {
endCursor
hasNextPage
}
edges {
object {
id
... on Order {
buyer {
id
name
}
quantity
plannedShipDate
}
}
}
aggregationResultsTotalCount
aggregationResults {
dimensionValues {
name
value
}
values {
name
value
}
}
}
}
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": {
"orderLineChart": {
"totalCount": 214,
"pageInfo": {
"endCursor": "ZTc4MDBmNjUtODMzOS00NTAyLTkyY2MtODc5NTNmNmNjZTVj",
"hasNextPage": true,
"__typename": "PageInfo"
},
"edges": [
{
"object": {
"id": "fd6e55d2-cd93-41af-b399-ef05409ef525",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 124,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "fcf6988a-4e88-42b9-a31f-109f6b71ede7",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 124,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "fa73fc29-ca86-4f78-b57d-064112907bed",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 124,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "f522826f-2f16-4d2a-b21d-b8d32350e85d",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 124,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "f206ed37-8bf0-497e-933a-15c872ce7296",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 512,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "f1e9a510-1976-4ec9-82ff-d8cbe764f49c",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 124,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "ed5194ed-cc73-42ee-a326-817f8173309c",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 124,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "eba89dd3-eb49-4bb7-a322-e43a011a3bc6",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 512,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "e7e2bb2a-7cd9-461f-b89a-708c9128a310",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 320,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
},
{
"object": {
"id": "e7800f65-8339-4502-92cc-87953f6cce5c",
"buyer": {
"id": "a6e2cf83-a684-42f7-b6ec-fe3593a86fd9",
"name": "LightTree",
"__typename": "Organization"
},
"quantity": 320,
"plannedShipDate": "2021-06-23T00:00:00.000Z",
"__typename": "Order"
},
"__typename": "BusinessObjectEdge"
}
],
"aggregationResultsTotalCount": 10,
"aggregationResults": [
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-06-23T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "24940.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-07-15T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "1113.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-07-06T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "1350.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-07-22T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "484.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-08-06T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "2478.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-07-24T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "176.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-08-10T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "1907.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-08-11T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "1495.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-06-25T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "956.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "plannedShipDate",
"value": "2021-06-30T00:00:00.000Z",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "buyers.sum",
"value": "732.0",
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
}
],
"__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.
{
"errors": "{{ #? this.errors }}",
"totalCount": "{{ this.data.orderLineChart.aggregationResultsTotalCount }}",
"pageInfo": {},
"results": {
"{{ #each this.data.orderLineChart.aggregationResults }}": {
"group": "orderLineChart",
"x-axis-key": "{{this.dimensionValues[0].value}}",
"y-axis-key": "{{this.values[0].value}}",
"tooltipsConfig": {
"name": "{{this.dimensionValues[0].name}}"
}
}
}
}
What to do next
Add the card to a dashboard by using the Dashboard builder.