Skip to content
Skillpedia
Analysis & spreadsheets41k Β· #6903

formatting-insight-axes

What it does

This skill sets the axis format on a PostHog insight so numbers show clear units such as seconds, minutes or percentages. It is for analysts who build charts with time or ratio values.

When to use it

  • βœ“When you are about to divide a value only so it shows in minutes or as a percent.
  • βœ“When you want a chart axis to show time values in friendly units.
  • βœ“When you want a SQL insight column to show a unit without changing the numbers.

Skill link

https://github.com/PostHog/posthog/blob/master/products/product_analytics/skills/formatting-insight-axes/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/product_analytics/skills/formatting-insight-axes/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œShow the average response time on my chart in minutes, without changing the numbers.”

5 new skills a week. 1 minute to read.

How it works

It sets the built-in axis format instead of adding a division or a fixed text suffix. The formatter then picks a readable unit for each value, and the underlying numbers stay correct.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Formatting insight axes

PostHog renders insights with a built-in axis formatter. Use it instead of contorting the query or a literal prefix/postfix to fake units.

The two insight kinds configure it in different places:

  • TrendsQuery β€” trendsFilter.aggregationAxisFormat (this page, below)
  • SQL insights (DataVisualizationNode) β€” per-column settings.formatting (see SQL insights)

The anti-pattern

If you are reaching for any of these, stop and pick a format below first:

  • formula: "A / 60" with aggregationAxisPostfix: " mins" β€” manual seconds -> minutes
  • formula: "A / 1000" with aggregationAxisPostfix: " s" β€” manual ms -> seconds
  • formula: "A * 100" with aggregationAxisPostfix: "%" β€” manual ratio -> percent
  • aggregationAxisPostfix: "ms" / "s" / "min" / "hr" on raw values

These freeze the unit at one scale. The built-in formatter picks a friendly unit per value (1.5s, 2m 12s, 1h 4m) and keeps the underlying series numerically correct for further math, breakdowns, and alerts.

Available formats

Set trendsFilter.aggregationAxisFormat on the TrendsQuery:

Value Use when the series is... Renders as
numeric (default) a plain count 1,234
duration seconds (any scale) 45s, 2m 12s, 1h 4m
duration_ms milliseconds 850ms, 1.5s, 1m 4s
percentage already 0-100 47.3%
percentage_scaled a ratio 0-1 47.3%
currency money in the project's base currency $1,234.56 (or local code)
short large counts you want compacted 1.2K, 3.4M

Companion fields on trendsFilter:

  • aggregationAxisPrefix β€” literal prefix (e.g. "$") when you need a symbol pinned to a specific currency or unit, regardless of project settings
  • aggregationAxisPostfix β€” literal suffix; reserve for genuine units the format can't express (e.g. " req", " events"), never for "mins" / "s" / "%" β€” the percentage formats already append the % sign, so a "%" postfix renders 50%%
  • decimalPlaces β€” cap decimals (1 or 2 is usually right for currency / ratios)

Currency β€” pick format or prefix carefully

aggregationAxisFormat: "currency" renders with the project's base currency (set in project settings, defaults to USD). Use it when the underlying values are in that same currency β€” e.g. revenue events that PostHog auto-converts to the project's base currency.

If the values are pinned to a specific currency regardless of project (e.g. $ai_total_cost_usd is always USD, even on a EUR-base project), use aggregationAxisPrefix: "$" + decimalPlaces: 2 so the symbol matches the data. Using format: "currency" here would render USD values with € on a EUR project.

When the series is in seconds

If the series is in seconds (latency, session length, time-to-first-event, processing time, page load, etc.), silently default to aggregationAxisFormat: "duration". Do not stop to ask β€” the formatter is non-destructive (the underlying values stay in seconds either way, only the labels change), so picking it is always at least as good as raw seconds.

Only confirm with the user when they have explicitly named a fixed unit they want pinned ("show this in minutes", "graph the average in hours"):

"I can pin the y-axis to minutes by dividing the series by 60, or use PostHog's duration formatter which auto-picks seconds / minutes / hours per value β€” 90s renders as 1m 30s and 5400s as 1h 30m. Which would you prefer?"

In one-shot MCP contexts where no user is in the loop, just pick duration and move on.

Examples

Latency β€” duration in milliseconds

{
  "kind": "TrendsQuery",
  "series": [
    {
      "kind": "EventsNode",
      "event": "$pageview",
      "math": "p95",
      "math_property": "$performance_page_loaded"
    }
  ],
  "trendsFilter": {
    "aggregationAxisFormat": "duration_ms"
  }
}

Average session length β€” duration in seconds

{
  "kind": "TrendsQuery",
  "series": [
    {
      "kind": "E
FAQ

Why not add a formula to convert units?

A fixed conversion locks the unit to one scale, while the built-in format adjusts to each value and keeps the data usable for other math.

Does this work for SQL insights?

Yes. SQL insights set the formatting for each column in their chart settings.

Will it change my numbers?

No. Only the display changes, so the values stay numerically correct.

Details

Original description by the author

Pick the right y-axis unit when creating or updating an insight via `posthog:insight-create` or `posthog:insight-update` β€” both TrendsQuery (`trendsFilter.aggregationAxisFormat`) and SQL insights (`DataVisualizationNode`, `chartSettings.yAxis[].settings.formatting`). Use when the agent is about to add a `formula` purely to convert units (e.g. dividing seconds by 60 to display minutes), when a `math_property` or SQL column is a duration, currency, ratio, or large count, or whenever the user mentions "format the y-axis", "duration", "seconds", "minutes", "hours", "milliseconds", "ms", "percentag

repo: PostHog/posthog

Popularity

GitHub stars
41k
Ranking position
#6903
License
β€”
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills