Grouped Bar

The Grouped Bar Chart allows you to view two layers of data with the 'Stacked by' value appearing as individual bars.

Required Fields

  • table - the table to query.

  • conditions - the conditions to apply to the chart

  • group_by - the primary grouping

  • second_group_by - the secondary grouping

  • record_limit - the maximum number of primary groupings to query

Optional Fields

  • aggregate_type - the type of aggregate to use. If none is provided 'COUNT' will be used.

  • aggregate_field - if an aggregate other than 'COUNT is used, an aggregate field must be provided to determine what to aggregate on.

Return Data

An array of objects. Each object is of the following format.

  • groupTotal: the total value of the primary group

  • groupField: the value of the primary group

  • group: the display value for the primary group

  • query: the query for the primary group

  • stacks: an array containing the display value of all secondary groupings in the following format:

    • stack: the display value of the secondary grouping

    • value: the value of the secondary grouping

  • keys: an array of all the display values of all secondary groupings.

  • a list of each key and the value for each secondary group within the primary group.

Example Payload

A Javascript Object:

    'true': 5,
    'false': 1,
    'group': "Beth Anglin",
    'groupField': "46d44a23a9fe19810012d100cca80666",
    'groupTotal': 6,
    'keys': ["false", "true"],
    'stacks': [{'stack': "false", 'value': "false"},{'stack': "true", 'value': "true"}],
    'query': "assigned_to=46d44a23a9fe19810012d100cca80666^active="
}, {
    'true': 2,
    'false': 7,
    'group': "Beth Anglin",
    'groupField': "5137153cc611227c000bbd1bd8cd2007",
    'groupTotal': 9,
    'keys': ["false", "true"],
    'stacks': [{'stack': "false", 'value': "false"},{'stack': "true", 'value': "true"}],
    'query': "assigned_to=5137153cc611227c000bbd1bd8cd2007^active="

A screenshot of the data in ServiceNow:

Last updated