From 6ea676c14acaf911739975eb0b6a6ab5a7bdd6a5 Mon Sep 17 00:00:00 2001 From: Dmitri Wolf Date: Fri, 8 Jun 2018 15:57:06 -0500 Subject: [PATCH] fix(line-graph): isUTC does NOT Display UTC Times in X Axis (#110) --- components/LineGraph/LineGraph.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/LineGraph/LineGraph.js b/components/LineGraph/LineGraph.js index 18ee29e8..567b73d8 100644 --- a/components/LineGraph/LineGraph.js +++ b/components/LineGraph/LineGraph.js @@ -313,11 +313,15 @@ class LineGraph extends Component { .y(d => this.y(d[this.count])) .defined(d => !isNaN(d[this.count])); + const tickFormat = isUTC + ? d3.utcFormat(timeFormat) + : d3.timeFormat(timeFormat); + this.xAxis = d3 .axisBottom() .scale(this.x) .tickSize(0) - .tickFormat(isXTime ? d3.timeFormat(timeFormat) : null); + .tickFormat(isXTime ? tickFormat : null); this.yAxis = d3 .axisLeft()