Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(insights): document scatter plot in assistant chart guidance (#83581)

Sam Penningtonc0c347a549e3
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 99ff092bedb7..ed5db7d52f33 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -2187,7 +2187,7 @@
"description": "Settings for the right Y axis. Only applies when a Y series uses `settings.display.yAxisPosition: \"right\"`."
},
"seriesBreakdownColumn": {
- "description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable.",
+ "description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`.",
"type": ["string", "null"]
},
"showLegend": {
@@ -2212,7 +2212,7 @@
},
"xAxis": {
"$ref": "#/definitions/AssistantDataVisualizationAxis",
- "description": "Column used as the X axis. Typically a time bucket or categorical column."
+ "description": "Column used as the X axis. Typically a time bucket or categorical column, but `ScatterPlot` plots two measures against each other, so it needs a numeric column here too."
},
"xAxisLabel": {
"description": "Label rendered under the X axis.",
@@ -2268,7 +2268,7 @@
},
"display": {
"$ref": "#/definitions/AssistantDataVisualizationDisplayType",
- "description": "Visualization type. Defaults to `ActionsTable` when omitted.\n\nGuidance:\n- Single-value result (one numeric column, one row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n- Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n- Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Otherwise → `ActionsTable`."
+ "description": "Visualization type. Defaults to `ActionsTable` when omitted.\n\nGuidance:\n- Single-value result (one numeric column, one row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n- Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n- Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Relationship between two numeric measures, one point per row → `ScatterPlot`.\n- Otherwise → `ActionsTable`."
},
"kind": {
"const": "DataVisualizationNode",
diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.ts
index daf0bd418b17..42461b837f0d 100644
--- a/frontend/src/queries/schema/schema-assistant-queries.ts
+++ b/frontend/src/queries/schema/schema-assistant-queries.ts
@@ -1793,7 +1793,10 @@ export interface AssistantDataVisualizationYAxisSettings {
}
export interface AssistantDataVisualizationChartSettings {
- /** Column used as the X axis. Typically a time bucket or categorical column. */
+ /**
+ * Column used as the X axis. Typically a time bucket or categorical column, but `ScatterPlot`
+ * plots two measures against each other, so it needs a numeric column here too.
+ */
xAxis?: AssistantDataVisualizationAxis
/** Label rendered under the X axis. */
xAxisLabel?: string
@@ -1805,7 +1808,8 @@ export interface AssistantDataVisualizationChartSettings {
rightYAxisSettings?: AssistantDataVisualizationYAxisSettings
/**
* Column that splits a single Y series into multiple colored series — e.g. breaking down
- * a line chart by `country`. Set to `null` or omit to disable.
+ * a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by
+ * x value, so it is ignored when `display` is `ScatterPlot`.
*/
seriesBreakdownColumn?: string | null
/** Horizontal goal lines drawn across the chart. */
@@ -1852,6 +1856,7 @@ export interface AssistantDataVisualizationNode {
* - Categorical proportions → `ActionsPie`.
* - Categorical comparison → `ActionsBar` or `ActionsStackedBar`.
* - Two-dimensional aggregation → `TwoDimensionalHeatmap`.
+ * - Relationship between two numeric measures, one point per row → `ScatterPlot`.
* - Otherwise → `ActionsTable`.
*/
display?: AssistantDataVisualizationDisplayType
diff --git a/posthog/schema.py b/posthog/schema.py
index 47537fcab76d..bc8443c5b1d4 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -3287,7 +3287,8 @@ class AssistantDataVisualizationChartSettings(BaseModel):
description=(
"Column that splits a single Y series into multiple colored series — e.g."
" breaking down a line chart by `country`. Set to `null` or omit to"
- " disable."
+ " disable. A breakdown buckets rows by x value, so it is ignored when"
+ " `display` is `ScatterPlot`."
),
)
showLegend: bool | None = Field(default=None, description="Show the chart legend.")
@@ -3306,7 +3307,11 @@ class AssistantDataVisualizationChartSettings(BaseModel):
)
xAxis: AssistantDataVisualizationAxis | None = Field(
default=None,
- description=("Column used as the X axis. Typically a time bucket or categorical column."),
+ description=(
+ "Column used as the X axis. Typically a time bucket or categorical column,"
+ " but `ScatterPlot` plots two measures against each other, so it needs a"
+ " numeric column here too."
+ ),
)
xAxisLabel: str | None = Field(default=None, description="Label rendered under the X axis.")
yAxis: list[AssistantDataVisualizationAxis] | None = Field(
@@ -8956,8 +8961,9 @@ class AssistantDataVisualizationNode(BaseModel):
" row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or"
" `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n-"
" Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n-"
- " Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Otherwise →"
- " `ActionsTable`."
+ " Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Relationship"
+ " between two numeric measures, one point per row → `ScatterPlot`.\n-"
+ " Otherwise → `ActionsTable`."
),
)
kind: Literal["DataVisualizationNode"] = "DataVisualizationNode"
diff --git a/services/mcp/src/tools/generated/product_analytics.ts b/services/mcp/src/tools/generated/product_analytics.ts
index ff063ca53ec2..538274f7caeb 100644
--- a/services/mcp/src/tools/generated/product_analytics.ts
+++ b/services/mcp/src/tools/generated/product_analytics.ts
@@ -105,7 +105,7 @@ const AssistantDataVisualizationChartSettings = z.object({
.string()
.nullable()
.describe(
- 'Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable.'
+ 'Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`.'
)
.optional(),
showLegend: z.coerce.boolean().describe('Show the chart legend.').optional(),
@@ -123,7 +123,7 @@ const AssistantDataVisualizationChartSettings = z.object({
.describe('Stack bars to 100% of the total. Only meaningful with `ActionsStackedBar`.')
.optional(),
xAxis: AssistantDataVisualizationAxis.describe(
- 'Column used as the X axis. Typically a time bucket or categorical column.'
+ 'Column used as the X axis. Typically a time bucket or categorical column, but `ScatterPlot` plots two measures against each other, so it needs a numeric column here too.'
).optional(),
xAxisLabel: z.string().describe('Label rendered under the X axis.').optional(),
yAxis: z
@@ -158,7 +158,7 @@ const AssistantDataVisualizationNode = z.object({
'Chart configuration. Ignored when `display` is `ActionsTable` or `BoldNumber`.'
).optional(),
display: AssistantDataVisualizationDisplayType.describe(
- 'Visualization type. Defaults to `ActionsTable` when omitted.\n\nGuidance:\n- Single-value result (one numeric column, one row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n- Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n- Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Otherwise → `ActionsTable`.'
+ 'Visualization type. Defaults to `ActionsTable` when omitted.\n\nGuidance:\n- Single-value result (one numeric column, one row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n- Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n- Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Relationship between two numeric measures, one point per row → `ScatterPlot`.\n- Otherwise → `ActionsTable`.'
).optional(),
kind: z.literal('DataVisualizationNode').default('DataVisualizationNode'),
source: z.record(z.string(), z.unknown()).describe('HogQL query object that produces the rows to visualize.'),
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json
index e6191e74be67..4ff823870431 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json
@@ -141,7 +141,7 @@
"type": "null"
}
],
- "description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable."
+ "description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`."
},
"showLegend": {
"description": "Show the chart legend.",
@@ -164,7 +164,7 @@
"type": "boolean"
},
"xAxis": {
- "description": "Column used as the X axis. Typically a time bucket or categorical column.",
+ "description": "Column used as the X axis. Typically a time bucket or categorical column, but `ScatterPlot` plots two measures against each other, so it needs a numeric column here too.",
"properties": {
"column": {
"description": "Name of a column returned by the SQL query to map onto this axis.",
@@ -310,7 +310,7 @@
"type": "object"
},
"display": {
- "description": "Visualization type. Defaults to `ActionsTable` when omitted.\n\nGuidance:\n- Single-value result (one numeric column, one row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n- Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n- Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Otherwise → `ActionsTable`.",
+ "description": "Visualization type. Defaults to `ActionsTable` when omitted.\n\nGuidance:\n- Single-value result (one numeric column, one row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n- Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n- Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Relationship between two numeric measures, one point per row → `ScatterPlot`.\n- Otherwise → `ActionsTable`.",
"enum": [
"ActionsTable",
"BoldNumber",
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json
index 79f6e4751734..c48a165249f0 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json
@@ -152,7 +152,7 @@
"type": "null"
}
],
- "description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable."
+ "description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`."
},
"showLegend": {
"description": "Show the chart legend.",
@@ -175,7 +175,7 @@
"type": "boolean"
},
"xAxis": {
- "description": "Column used as the X axis. Typically a time bucket or categorical column.",
+ "description": "Column used as the X axis. Typically a time bucket or categorical column, but `ScatterPlot` plots two measures against each other, so it needs a numeric column here too.",
"properties": {
"column": {
"description": "Name of a column returned by the SQL query to map onto this axis.",
@@ -321,7 +321,7 @@
"type": "object"
},
"display": {
- "description": "Visualization type. Defaults to `ActionsTable` when omitted.\n\nGuidance:\n- Single-value result (one numeric column, one row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n- Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n- Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Otherwise → `ActionsTable`.",
+ "description": "Visualization type. Defaults to `ActionsTable` when omitted.\n\nGuidance:\n- Single-value result (one numeric column, one row) → `BoldNumber`.\n- Time series → `ActionsLineGraph` or `ActionsAreaGraph`.\n- Categorical proportions → `ActionsPie`.\n- Categorical comparison → `ActionsBar` or `ActionsStackedBar`.\n- Two-dimensional aggregation → `TwoDimensionalHeatmap`.\n- Relationship between two numeric measures, one point per row → `ScatterPlot`.\n- Otherwise → `ActionsTable`.",
"enum": [
"ActionsTable",
"BoldNumber",