Skip to content
pyautark (soon)

Transformations

AutkPlot can pre-process a FeatureCollection before rendering through the transform config. Transforms let you bin, sort, aggregate arrays, and reduce time series without leaving the charting API.

This page shows the chart types that are most useful with a transform: bar charts, line charts, tables, and heat matrices. Scatter plots and parallel coordinates, which work directly on the input GeoJSON, are covered in the Overview.

The @transform placeholder

Most presets require you to mark where the computed result should appear:

  • For binning-1d, put '@transform' in attributes.axis[1].
  • For binning-2d, put '@transform' in attributes.color.
  • For binning-events and reduce-series, put '@transform' in attributes.axis[1].

sort is the exception: it reorders the original rows and does not use '@transform'.

Transform presets

PresetPurposeOutput channelTypical chart
sortReorder rows by a columnnoneBar chart, table
binning-1dGroup a numeric attribute into binsaxis[1]Bar chart
binning-2dGroup two numeric attributes into a gridcolorHeat matrix
binning-eventsBucket event arrays by timeaxis[1]Line chart, bar chart
reduce-seriesReduce series arrays by timestampaxis[1]Line chart

Bar chart

A bar chart expects a categorical first axis and a numeric second axis. Pair it with binning-1d to turn a numeric attribute into a histogram: each bar becomes an area range, and the height shows how many features fall inside it.

Sorted bars

Use the sort transform with attributes: { axis: ['cdta2020', 'shape_area'] } when you want to rank categorical bars by value instead of binning a numeric attribute.

Line chart

Line charts connect sequential numeric values. The example below loads a pre-aggregated file where each feature holds a series array of daily noise-complaint counts, then uses reduce-series to render the line.

From raw events to a series

If you start from raw event rows, use binning-events to bucket them into a daily series. If you already aggregated the data, store it as a series array and use reduce-series as shown here.

Table

The table chart displays raw feature properties. Adding a sort transform orders the rows by any column, which is often more useful than the original GeoJSON order.

Heat matrix

A heat matrix requires binning-2d. Two numeric attributes define the grid, and the reducer determines the color of each cell.

Reducers and resolutions

Supported reducers are count, sum, avg, min, and max. For binning-events, resolution can be year, month, week, day, hour, minute, or second.

Transform results are ephemeral

The original collection is not modified. The transform produces an internal derived table used only for rendering. Call updateCollection if you need to change the source data.

Next steps

Released under the MIT License.