Creating scatter charts
A scatter chart uses dots to represent values for two different
numeric variables. The position of each dot on the horizontal and vertical axis indicates values for
an individual data point. You can use scatter charts to visualize relationships
between variables.
About this task
- Card tooltip
- A tooltip that provides extra details about the data that is displayed on the card.
- Card title
- A unique label or heading that is assigned to the card.
- Y-axis title
- A label that is assigned to the vertical axis of the chart.
- Threshold
- A line on the chart above or below which are significant values.
- X-axis title
- A label that is 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 that is assigned to the data group that is returned by a query.
Procedure
Example
tenantId
variable.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. In the
example, the total number of orders is returned for each planned ship date.
{
"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 a transform. In a transform, the data that is
displayed on each axis of the chart must match the data that is returned by the query. This
attribute is selected in the Data groups section. A calculation can be made
on the data that is returned. In the example, orderLineChart
is added to the group
that the query returns.
{
"errors": "{{ #? this.errors }}",
"totalCount": "{{ this.data.orderLineChart.aggregationResultsTotalCount }}",
"pageInfo": "{}",
"results": {
"{{ #each this.data.orderLineChart.aggregationResults }}": {
"group": "orderLineChart",
"x-axis-key": "{{new Date(this.dimensionValues[0].value).toDateString()}}",
"y-axis-key": "{{this.values[0].value}}",
"tooltipsConfig": {
"name": "{{this.dimensionValues[0].name}}"
}
}
}
}
What to do next
Add the card to a page by using the Page builder.