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])