visualizing-change-over-time

Ayuda a los ingenieros y agentes de PostHog a elegir el gráfico correcto cuando una solicitud trata sobre visualizar cambios a lo largo del tiempo, comparaciones antes/después o período tras período…

npx skills add https://github.com/posthog/posthog-foss --skill visualizing-change-over-time

Visualizing change over time

When a request is about how something changed, the default reach is a line/area trend — and that is usually right for a continuous series with many x points. But for some change-over-time shapes a different chart reads far better. This skill is the menu to offer, including the slope graph, when building visualizations with @posthog/quill-charts.

Present the fitting option(s) and let the user choose — none of these is mandatory.

Pick by the shape of the change

The change is…Reach forWhy
A continuous series over many time points (a trend)TimeSeriesLineChart / LineChart (area fill for emphasis)The standard trend; the slope between every pair of points is visible.
Two points only (before → after) across several series/categoriesSlopeChartOne line per entity from a left "before" to a right "after" — direction and magnitude of each entity's change, and rank flips, read at a glance.
Magnitude comparison at points in time (not the path between them)BarChart / TimeSeriesBarChartBars compare discrete values; group/stack for sub-series.
A single headline number plus its change vs a prior periodMetricCardBig number + sparkline + change pill.

If the user is comparing exactly two snapshots (this week vs last, control vs treatment, Q1 vs Q2) and especially when there are many categories whose relative movement matters, offer the slope graph as the cleaner alternative to a grouped bar or a 2-point line chart.

Using the SlopeChart

import { SlopeChart } from '@posthog/quill-charts'
import type { Series } from '@posthog/quill-charts'
import type { SlopeSeriesMeta } from '@posthog/quill-charts'

// One series per entity; `data` is exactly [start, end].
const series: Series<SlopeSeriesMeta>[] = [
    { key: 'us', label: 'US', data: [120, 185] },
    { key: 'eu', label: 'EU', data: [200, 150] },
]

<SlopeChart
    series={series}
    labels={['Before', 'After']}
    theme={theme}
    config={{
        showSeriesLabels: true, // name beside each end point; steepest line always keeps its label
        legend: { show: true }, // each row shows the color, label, and the formatted change
        deltaFormatter: (d) => `${d >= 0 ? '+' : ''}${d}`,
    }}
/>

Key options (full list in the charts AGENTS.md "Composition" section):

  • showStartLabels / showEndLabels — chart-level defaults for the value labels; override per series with meta.showStartLabel / meta.showEndLabel.
  • showSeriesLabels — the name labels; on collision the series with the largest change (|end − start|) always keeps its label.
  • legend: { show, position } — rows carry the per-series change (deltaFormatter).
  • The value axis is hidden by default — the start/end labels are the readout.

The theme comes from useChartTheme(); give the wrapper a real height. See the charts AGENTS.md for theme wiring and sizing.

Scope note

There are two ways to render a slope graph; which you reach for depends on the surface:

  • SlopeChart — the @posthog/quill-charts component. Use it when building UI directly: dashboards, reports, the mcp_analytics frontend, custom visualizations. It backs the Slope view toggle on Max's inline trends result card (services/mcp/src/ui-apps/components/TrendsVisualizer.tsx).
  • ChartDisplayType.SlopeGraph — a first-class insight display (value 'SlopeGraph' in frontend/src/types.ts), rendered by the backend SlopeGraphTrendsQueryRunner (posthog/hogql_queries/insights/trends/slope_graph_trends_query_runner.py). It takes a TrendsQuery and keeps the first and last bucket of the date range as the two slope points (the last segment is dashed when it's the current, still-accumulating period). Set it via trendsFilter.display: "SlopeGraph" (trends-only).
    • In the product insight editor, the picker entry is gated behind FEATURE_FLAGS.SLOPE_GRAPH_INSIGHT (slope-graph-insight).
    • Via the API / posthog:insight-create MCP tool it works without the flag — pass a TrendsQuery with trendsFilter.display: "SlopeGraph". To frame a clean before → after, choose the date range and interval so the first bucket is your baseline and the last is "now" (e.g. monthly buckets starting from the baseline month).

Más skills de posthog

managing-experiment-lifecycle
posthog
Guía las transiciones de estado de los experimentos: iniciar, pausar, reanudar, finalizar, enviar variantes, archivar, restablecer y duplicar. Cubre condiciones previas,…
official
configuring-experiment-analytics
posthog
Configures the analytics side of a PostHog experiment — exposure criteria (default `$feature_flag_called` vs custom exposure events), primary and secondary…
official
error-tracking-hono
posthog
Seguimiento de errores de PostHog para Hono
official
error-tracking-react
posthog
Seguimiento de errores de PostHog para React
official
integration-android
posthog
Integración de PostHog para aplicaciones Android
official
integration-ruby
posthog
Integración de PostHog para cualquier aplicación Ruby que utilice el SDK de Ruby
official
tuning-incremental-sync-config
posthog
La configuración de una sincronización reside en ExternalDataSchema y puede modificarse en cualquier momento mediante external-data-schemas-partial-update. La mayoría de los cambios no son destructivos (entran en vigor en la siguiente sincronización), pero algunos (cambiar sync_type, modificar claves primarias) requieren un manejo cuidadoso para evitar corromper los datos sincronizados.
official
instrument-integration
posthog
Usa esta habilidad para agregar el SDK de PostHog a una aplicación. Úsala al configurar PostHog por primera vez, o al revisar PRs que necesiten inicialización de PostHog. Cubre la instalación del SDK, la configuración del proveedor y la configuración básica. Compatible con cualquier framework o lenguaje.
official