Bar Graph

📊 Visualize data using bars for easy comparison and insights.

A Bar Graph represents data using rectangular bars to compare values across categories. It helps users quickly identify trends, differences, and patterns in their data.

A Bar Graph widget consists of two main sections:

  • config: Controls the appearance and layout of the graph.
  • aggregation: Controls how the data is grouped, calculated, and sorted before display.

Configure the Average Widget

When configuring a Bar Graph widget from the UI, you can specify the following settings.


Display Settings

SettingDescription
TitleEnter a title to display at the top of the graph.
X-Axis FieldSelect the field used to group the data displayed along the horizontal axis.
X-Axis LabelEnter the label displayed beneath the horizontal axis.
Y-Axis ValueSelect the aggregated value displayed on the vertical axis.
Y-Axis LabelEnter the label displayed beside the vertical axis.
PrefixOptional text displayed before each Y-axis value, such as $.
Maximum Decimal PlacesSpecify the maximum number of decimal places displayed for numeric values.
Bar ColourSelect the colour used to display the bars.
Grouped DataDisplays grouped bars when multiple categories are available.
Hide Grid LinesRemoves the background grid lines from the graph.
Hide Axis LabelsHides the axis labels from the graph.

Aggregation Settings

Use the aggregation settings to determine how the data is grouped and calculated.

SettingDescription
Group BySelect the field used to group records into bars.
Aggregation FunctionSelect how the grouped values are calculated, such as Sum, Count, or Average.
SortChoose the field and sort order used to display the bars.

The following aggregation functions are available.

FunctionDescription
SUMAdds all numeric values together.
COUNTCounts the number of records.
AVGCalculates the average value.
MINReturns the smallest value.
MAXReturns the largest value.
DATE_FORMATGroups date values into periods such as months, weeks, or years.
NULLReturns the original field value without applying an aggregation function.

JSON Example

The following JSON produces the same configuration shown in the UI.

{
  "config": {
    "type": "bar-graph",
    "settings": {
      "title": "Support Cases by Status",
      "x-axis": {
        "accessor": "status",
        "label": "Status",
        "xMainAccessor": "status",
        "xSubAccessor": "team"
      },
      "y-axis": {
        "accessor": "case",
        "label": "Number of Cases",
        "prefix": "$",
        "maxDecimals": 1
      },
      "isGroupedData": false,
      "hideGrid": false,
      "hideLabels": false,
      "fill": "#8884d8"
    }
  },
  "aggregation": {
    "groupBy": [
      {
        "column": "status",
        "accessor": "status"
      }
    ],
    "functions": [
      {
        "column": "title",
        "fn": "COUNT",
        "alias": "case"
      },
      {
        "column": "status",
        "fn": "__NULL__",
        "alias": "status"
      }
    ],
    "sort": {
      "sortBy": "status",
      "order": "asc"
    }
  },
  "base-record": "72911",
  "saved-search": "265745"
}

📌 Need Help?

If you require assistance or encounter any issues, please don't hesitate to contact us for further support.



Did this page help you?