Skip to content

order

Input Stack:
ordering: String
expr: TimeSeriesExpr
Output Stack:
StyleExpr
 

Specify the sort order to use when :sort is applied to time series results. This controls whether series appear in ascending or descending order based on the sort criteria. The order setting affects the visual arrangement of lines in legends and the stacking order for area charts.

Parameters

  • expr: The time series expression to apply ordering to
  • ordering: Sort direction - either asc (ascending, default) or desc (descending)

Supported Values

  • asc - Ascending order (smallest to largest)
  • desc - Descending order (largest to smallest)

If no order is specified, asc is used by default.

Examples

Default ascending order when sorting by max:

BeforeAfter
name,sps,:eq,
:sum,
(,nf.cluster,),:by,
max,:sort
name,sps,:eq,
:sum,
(,nf.cluster,),:by,
max,:sort,
asc,:order

Changing to descending order (highest values first):

BeforeAfter
name,sps,:eq,
:sum,
(,nf.cluster,),:by,
max,:sort
name,sps,:eq,
:sum,
(,nf.cluster,),:by,
max,:sort,
desc,:order
  • :sort - Sort time series (order specifies direction)
  • :by - Group data for sorting
  • :limit - Limit results after sorting

Since: 1.5