Skip to content

Commit

Permalink
fix(chart): corrige espaço em branco
Browse files Browse the repository at this point in the history
Corrige espaço em branco gerado ao atribuir números quebrados nas séries dentro de um po-widget.

Fixes DTHFUI-10263
  • Loading branch information
anabye authored and jcorrea97 committed Nov 21, 2024
1 parent 92796df commit 4c81889
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ describe('PoChartComponent:', () => {

expect(component['getAxisXLabelArea'](axisXLabel)).toBe(56);
});

it('getAxisXLabelArea: should calculate and return width for a decimal number', () => {
const axisXLabel = 12.111111111111;

expect(component['getAxisXLabelArea'](axisXLabel)).toBe(56);
});
});

describe('Template', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ export class PoChartComponent extends PoChartBaseComponent implements AfterViewI
const spanElement = this.renderer.createElement('span');

this.renderer.addClass(spanElement, 'po-chart-axis-x-label');
spanElement.innerHTML = axisXLabel;

const formattedLabel = typeof axisXLabel === 'number' ? axisXLabel.toFixed(2) : axisXLabel;
spanElement.innerHTML = formattedLabel;

this.renderer.appendChild(this.elementRef.nativeElement, spanElement);
const axisXLabelWidth = Math.ceil(spanElement.offsetWidth) + labelPoChartPadding;
Expand Down

0 comments on commit 4c81889

Please sign in to comment.