From c22939ad5625736b46612f9c448e353f39344935 Mon Sep 17 00:00:00 2001 From: Eric Soderberg Date: Wed, 17 Jan 2018 15:16:04 -0800 Subject: [PATCH] Fixed an issue with Chart graphics when there is only one value --- src/js/components/chart/Graph.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/js/components/chart/Graph.js b/src/js/components/chart/Graph.js index 222cdd91de..d693795f1d 100644 --- a/src/js/components/chart/Graph.js +++ b/src/js/components/chart/Graph.js @@ -104,21 +104,21 @@ export default class Graph extends Component { let scale = 1; let step; if (vertical) { + if (max - min > 0) { + scale = (width - (2 * pad)) / (max - min); + } if (values.length <= 1) { step = height - (2 * pad); } else { - if (max - min > 0) { - scale = (width - (2 * pad)) / (max - min); - } step = (height - (2 * pad)) / (values.length - 1); } } else { + if (max - min > 0) { + scale = (height - (2 * pad)) / (max - min); + } if (values.length <= 1) { step = width - (2 * pad); } else { - if (max - min > 0) { - scale = (height - (2 * pad)) / (max - min); - } step = (width - (2 * pad)) / (values.length - 1); } } @@ -164,10 +164,10 @@ export default class Graph extends Component { return coordinate; }) - .filter(coordinate => coordinate); + .filter(coordinate => coordinate); let path; - if (coordinates.length > 1) { + if (coordinates.length > 0) { let pathProps = {}; let commands;