Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Pass only the series and display type to compute-chart-stats (#84205)

Andrei Simionescu31b8c1d3f09f
diff --git a/src/metabase/metabot/tools/analyze_chart.clj b/src/metabase/metabot/tools/analyze_chart.clj
index fbcaa3f9451..72fa85aa22c 100644
--- a/src/metabase/metabot/tools/analyze_chart.clj
+++ b/src/metabase/metabot/tools/analyze_chart.clj
@@ -91,7 +91,7 @@ Do not use headers (##). Do not list statistics. Do not analyze series separatel
(resource/stack-resource-context
(let [{:keys [timeline_events title display_type]} chart-config
opts {:deep? (if (nil? deep) true (boolean deep))}
- stats (interestingness/compute-chart-stats chart-config opts)
+ stats (interestingness/compute-chart-stats (select-keys chart-config [:series :display_type]) opts)
context {:title title
:display-type display_type
:stats stats
diff --git a/test/metabase/metabot/tools/analyze_chart_test.clj b/test/metabase/metabot/tools/analyze_chart_test.clj
index 1ceee57c775..a6e009611c0 100644
--- a/test/metabase/metabot/tools/analyze_chart_test.clj
+++ b/test/metabase/metabot/tools/analyze_chart_test.clj
@@ -38,6 +38,11 @@
(is (str/includes? output "Chart Analysis"))
(is (str/includes? output "Categorical")))))
+(deftest ^:parallel analyze-chart-tool-saved-question-test
+ (testing "a saved question's chart config, which carries its description, produces a chart analysis"
+ (let [configs (assoc-in (numeric-series-config) ["c1" :description] "Order counts per product category")]
+ (is (str/includes? (:output (analyze "c1" configs)) "Chart Analysis")))))
+
(deftest ^:parallel analyze-chart-tool-empty-series-test
(testing "a chart config with no series is rejected"
(is (= {:output "This chart has no series data to analyze."}