Skip to content

Commit

Permalink
Fixed an issue with Chart graphics when there is only one value
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsoderberghp committed Jan 17, 2018
1 parent 7a012d5 commit c22939a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/js/components/chart/Graph.js
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit c22939a

Please sign in to comment.