From 386b0d5d9fd635e2d9c930a4b4a7353bba62ac38 Mon Sep 17 00:00:00 2001 From: Robert Joonas Date: Fri, 22 Mar 2024 20:16:56 +0000 Subject: [PATCH] Make sure graph tooltip says "Converted Visitors" --- assets/js/dashboard/stats/graph/line-graph.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/assets/js/dashboard/stats/graph/line-graph.js b/assets/js/dashboard/stats/graph/line-graph.js index 999eb53e6..5ac82d32d 100644 --- a/assets/js/dashboard/stats/graph/line-graph.js +++ b/assets/js/dashboard/stats/graph/line-graph.js @@ -27,9 +27,19 @@ class LineGraph extends React.Component { this.updateWindowDimensions = this.updateWindowDimensions.bind(this); } + getGraphMetric() { + let metric = this.props.graphData.metric + + if (metric == 'visitors' && this.props.query.filters.goal) { + return 'conversions' + } else { + return metric + } + } + regenerateChart() { const { graphData, query } = this.props - const metric = graphData.metric + const metric = this.getGraphMetric() const graphEl = document.getElementById("main-graph-canvas") this.ctx = graphEl.getContext('2d'); const dataSet = buildDataSet(graphData.plot, graphData.comparison_plot, graphData.present_index, this.ctx, METRIC_LABELS[metric])