Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix charts clipped on small devices #385

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions webui/src/app/charting/chart.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,21 @@ <h4>
</mat-card-title>
</mat-card-header>
<mat-card-content>
<canvas
baseChart
[data]="chartConfig.data"
[options]="chartConfig.options"
[type]="chartConfig.type"
[height]="height"
[width]="width"
<div
[class]="
breakpoints.sizeAtLeast('Large') ? 'app-chart' : 'app-chart-small'
"
>
</canvas>
<canvas
baseChart
[data]="chartConfig.data"
[options]="chartConfig.options"
[type]="chartConfig.type"
[height]="height"
[width]="width"
>
</canvas>
</div>
</mat-card-content>
</mat-card>
</ng-container>
9 changes: 9 additions & 0 deletions webui/src/app/charting/chart.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@
opacity: 1;
}
}

.app-chart {
position: relative;
}

.app-chart-small {
position: relative;
width: calc(40vw + 100px);
}
2 changes: 2 additions & 0 deletions webui/src/app/charting/chart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { MatIcon } from "@angular/material/icon";
import { MatTooltip } from "@angular/material/tooltip";
import { ThemeInfoService } from "../themes/theme-info.service";
import { BreakpointsService } from "../layout/breakpoints.service";
import { ChartAdapter } from "./types";

@Component({
Expand All @@ -35,6 +36,7 @@ export class ChartComponent<Data = unknown, Type extends ChartType = ChartType>
{
private themeInfo = inject(ThemeInfoService);
private transloco = inject(TranslocoService);
breakpoints = inject(BreakpointsService);

@Input() title: string;
@Input() $data: Observable<Data> = new Observable();
Expand Down