Skip to content

Commit

Permalink
(fix): fix minimum y scale value for vertical bar charts
Browse files Browse the repository at this point in the history
  • Loading branch information
marjan-georgiev committed Mar 6, 2018
1 parent d8849a5 commit 6f66cf0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/bar-chart/bar-vertical.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ export class BarVerticalComponent extends BaseChartComponent {

getYDomain() {
const values = this.results.map(d => d.value);
const min = this.yScaleMin

const min = this.yScaleMin
? Math.min(this.yScaleMin, ...values)
: Math.min(...values);
const max = this.yScaleMax
: Math.min(0, ...values);

const max = this.yScaleMax
? Math.max(this.yScaleMax, ...values)
: Math.max(...values);

Expand Down
8 changes: 4 additions & 4 deletions src/common/shape.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
export function roundedRect(x, y, w, h, r, [tl, tr, bl, br]: boolean[]) {
let retval = '';

w = w | 0;
h = h | 0;
w = w | 1;
h = h | 1;

w = w < 1 ? 1 : w;
h = h < 1 ? 1 : h;
w = w === 0 ? 1 : w;
h = h === 0 ? 1 : h;

retval = `M${[x + r, y]}`;
retval += `h${w - 2 * r}`;
Expand Down

0 comments on commit 6f66cf0

Please sign in to comment.