Creating simple bar charts
A simple bar chart displays data in data groups that can be plotted in the form of bars with equal width and variable height that is represented as magnitude of quantity. You can use the simple bar chart to visualize quantity comparison based on statistical figure.
About this task
- 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.
- Y-axis title
- A label assigned to the vertical axis of the chart.
- X-axis title
- A label assigned to the horizontal axis of the chart.
- Legend
- The label of the data group.
- Footer link
- A clickable field or link with a label, for example,
View all.
You can use the Card builder to create a simple bar chart.
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
The following query retrieves data from the business object service and returns a list of past due order lines grouped by supplier. The query takes a tenant ID as an input parameter and allows filtering by location, category, and supplier. The query also includes an aggregation parameter that groups order lines by supplier and sums the total value of the order lines. The query returns the top five suppliers with the highest total value of past due order lines.
query pastDueOrderlineBySupplier($tenantId: String!, $locationFilter: BooleanExp = {CONSTANT_VALUE: true}, $categoryFilter: BooleanExp = {CONSTANT_VALUE: true}, $supplierFilter: BooleanExp = {CONSTANT_VALUE: true}) {
pastDueOrderLineBySupplierChar: businessObjects(
simpleFilter: {type: OrderLine, tenantId: $tenantId}
hint: {viewId: "graph"}
advancedFilter: {AND: [{GREATER_THAN: [{SELECT: "order.plannedDeliveryDelay", type: FLOAT}, {VALUE: "0.0", type: FLOAT}]}, {EQUALS: [{SELECT: "order.orderType", type: STRING}, {VALUE: "INBOUND", type: STRING}]}, $locationFilter, $categoryFilter, $supplierFilter]}
aggregationParams: {paginationParams: {first: 5, sort: [{fieldPath: "totalOrderLinesBySupplier.sum", order: DESC}]}, dimension: {fieldPath: "order.vendor.name", type: STRING}, reduce: {expression: {fieldPath: "value", operator: SUM, type: INT}, output: {resultAlias: "totalOrderLinesBySupplier", type: INT}}}
) {
totalCount
aggregationResults {
dimensionValues {
name
value
}
values {
name
numValue
}
}
edges {
cursor
object {
... on OrderLine {
valueCurrency
}
}
}
}
}
{
"tenantId": "{{ tenantId }}"
}
{
"data": {
"pastDueOrderLineBySupplierChar": {
"totalCount": 19,
"aggregationResults": [
{
"dimensionValues": [
{
"name": "order.vendor.name",
"value": "McGrey Electrical",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "totalOrderLinesBySupplier",
"numValue": 604160,
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "order.vendor.name",
"value": "Total Source Extrusion Corporation",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "totalOrderLinesBySupplier",
"numValue": 226800,
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "order.vendor.name",
"value": "F & M Metals",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "totalOrderLinesBySupplier",
"numValue": 125900,
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "order.vendor.name",
"value": "LightLens Industries",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "totalOrderLinesBySupplier",
"numValue": 107920,
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
},
{
"dimensionValues": [
{
"name": "order.vendor.name",
"value": "Alumi-lux Metal Products",
"__typename": "NameValuePair"
}
],
"values": [
{
"name": "totalOrderLinesBySupplier",
"numValue": 59605,
"__typename": "NameValueNumValuePair"
}
],
"__typename": "AggregationResult"
}
],
"edges": [
{
"cursor": "NTQ1NDE2NA==",
"object": {
"valueCurrency": "USD",
"__typename": "OrderLine"
},
"__typename": "BusinessObjectEdge"
},
{
"cursor": "NTQ1NjQ5OA==",
"object": {
"valueCurrency": "USD",
"__typename": "OrderLine"
},
"__typename": "BusinessObjectEdge"
},
{
"cursor": "NTQ1NjQ3MQ==",
"object": {
"valueCurrency": "USD",
"__typename": "OrderLine"
},
"__typename": "BusinessObjectEdge"
},
{
"cursor": "NTQ1NTc3MQ==",
"object": {
"valueCurrency": "USD",
"__typename": "OrderLine"
},
"__typename": "BusinessObjectEdge"
},
{
"cursor": "NTQ1NDIzOQ==",
"object": {
"valueCurrency": "USD",
"__typename": "OrderLine"
},
"__typename": "BusinessObjectEdge"
}
],
"__typename": "BusinessObjectsCursor"
}
},
"loading": false,
"networkStatus": 7
}The following code is an example of how to create a transform for the card.
{
"totalCount": "{{ this.data.pastDueOrderLineBySupplierChar.totalCount }}",
"errors": "{{#? this.errors}}",
"pageInfo": "{}",
"currency": [
{
"{{#if this.data.pastDueOrderLineBySupplierChar.edges.length > 0}}": "{{this.data.pastDueOrderLineBySupplierChar.edges[0].object.valueCurrency}}"
},
{
"{{#else}}": ""
}
],
"results": {
"{{#each this.data.pastDueOrderLineBySupplierChar.aggregationResults}}": {
"group": "{{dimensionValues[0].value}}",
"value": "{{values[0].numValue}}"
}
}
}
In a transformation, the data that is displayed on each axis of the chart must match the data
that is returned by the query. This attribute is chosen in the Data groups section. A calculation
can be made on the data that is returned. In the example,McGrey Electrical is added
to the group that the query returns.
What to do next
Add the card to a dashboard by using the Dashboard builder.