Merge pull request #53411 from rhcs-dashboard/align-charts

mgr/dashboard: align charts of landing page

Reviewed-by: Nizamudeen A <nia@redhat.com>
This commit is contained in:
Nizamudeen A 2023-09-19 18:08:29 +05:30 committed by GitHub
commit e068b2aabd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,6 +119,7 @@ export class DashboardAreaChartComponent implements OnChanges, AfterViewInit {
],
yAxes: [
{
afterFit: (scaleInstance: any) => (scaleInstance.width = 100),
gridLines: {
display: false
},
@ -129,7 +130,7 @@ export class DashboardAreaChartComponent implements OnChanges, AfterViewInit {
if (value === 0) {
return null;
}
return this.fillString(this.convertUnits(value));
return this.convertUnits(value);
}
}
}
@ -265,18 +266,6 @@ export class DashboardAreaChartComponent implements OnChanges, AfterViewInit {
return dataWithUnits;
}
private fillString(str: string): string {
let maxNumberOfChar: number = 8;
let numberOfChars: number = str.length;
if (str.length < 4) {
maxNumberOfChar = 11;
}
for (; numberOfChars < maxNumberOfChar; numberOfChars++) {
str = '\u00A0' + str;
}
return str + '\u00A0\u00A0';
}
private setChartTicks() {
if (!this.chart) {
return;
@ -305,9 +294,9 @@ export class DashboardAreaChartComponent implements OnChanges, AfterViewInit {
return null;
}
if (!maxValueDataUnits) {
return this.fillString(`${value}`);
return `${value}`;
}
return this.fillString(`${value} ${maxValueDataUnits}`);
return `${value} ${maxValueDataUnits}`;
};
this.chartDataUnits = maxValueDataUnits || '';
this.chart.chart.update();