formatting-insight-axes

Configures y-axis unit formatting for PostHog TrendsQuery and SQL insights.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill formatting-insight-axes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: formatting-insight-axes
Source: https://github.com/PostHog/posthog-foss/tree/main/products/product_analytics/skills/formatting-insight-axes
Command: npx skills add https://github.com/PostHog/posthog-foss --skill formatting-insight-axes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When creating or updating PostHog insights, agents often misuse formulas and literal postfixes to fake units (e.g. dividing seconds by 60 to show minutes, or appending "%" to ratios), which freezes the unit at one scale and produces broken labels like "50%%". This Skill guides correct use of PostHog's built-in axis formatter so values stay numerically correct while labels render in friendly units.

Core Features & Use Cases

  • TrendsQuery formatting: Set trendsFilter.aggregationAxisFormat to duration, duration_ms, percentage, percentage_scaled, currency, or short, with companion fields aggregationAxisPrefix, aggregationAxisPostfix, and decimalPlaces.
  • SQL insight formatting: Configure per-column chartSettings.yAxis[].settings.formatting on DataVisualizationNode with styles none, number, short, or percent, avoiding double-scaling pitfalls.
  • Anti-pattern detection: Recognize and fix formula/postfix hacks (e.g. A / 60 with " mins") during posthog:insight-update calls.
  • Use Case: When graphing p95 page load time stored in milliseconds, set aggregationAxisFormat: "duration_ms" so values render as 850ms, 1.5s, or 1m 4s automatically instead of raw numbers.

Quick Start

Ask the agent to create a PostHog trend insight of average session duration with the y-axis formatted as a duration.

Frequently Asked Questions about formatting-insight-axes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I format the y-axis of a PostHog trend insight as a duration?

Set trendsFilter.aggregationAxisFormat to "duration" for values in seconds or "duration_ms" for milliseconds. The formatter auto-picks friendly units per value, rendering 90 seconds as "1m 30s" without changing the underlying data.

How do I show a conversion rate as a percentage in a PostHog insight?

For a 0-1 ratio from a formula like A / B, set aggregationAxisFormat to "percentage_scaled" so it renders as "47.3%". Use "percentage" only when values are already on a 0-100 scale, and never add a "%" postfix since the format appends the sign itself.

Should I use a formula to convert seconds to minutes in PostHog trends?

No. Dividing by 60 with a " mins" postfix freezes the unit at one scale and distorts further math. Use aggregationAxisFormat: "duration" instead, which keeps values in seconds and renders each label in the most readable unit.

How do I format y-axis columns in PostHog SQL insights?

SQL insights (DataVisualizationNode) have no trendsFilter; set formatting per column under chartSettings.yAxis[].settings.formatting with style "none", "number", "short", or "percent". The percent style multiplies by 100, so feed it a 0-1 ratio and leave suffix unset.

Why does my PostHog insight show 50%% or 4730% on the axis?

This happens when a percentage format is combined with a literal "%" postfix, or when percent style is applied to an already-scaled 0-100 column. Remove the postfix and pick one shape: ratio plus percent style, or 0-100 values with number style and a "%" suffix.

When should I use aggregationAxisPrefix instead of the currency format?

Use aggregationAxisFormat: "currency" when values are in the project's base currency. Use aggregationAxisPrefix: "$" with decimalPlaces when values are pinned to a specific currency like USD, so the symbol matches the data regardless of project settings.