Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 5d1e3a8

Browse files
feat(#16): improve chart margin and padding
1 parent ca44a44 commit 5d1e3a8

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/components/slides/deckdeckgo-slide-chart/deckdeckgo-slide-chart.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ div.deckgo-slide {
77
}
88

99
div.deckgo-chart-container {
10-
width: 100%;
11-
height: 100%;
10+
margin: var(--slide-chart-margin-top, 32px) var(--slide-chart-margin-end, 96px) var(--slide-chart-margin-bottom, 32px) var(--slide-chart-margin-start, 32px);
11+
12+
width: calc(100vw - var(--slide-chart-margin-end, 96px) - var(--slide-chart-margin-start, 32px));
13+
height: calc(100vw - var(--slide-chart-margin-top, 32px) - var(--slide-chart-margin-bottom, 32px));
1214

1315
display: flex;
1416
align-items: center;

src/components/slides/deckdeckgo-slide-chart/deckdeckgo-slide-chart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ export class DeckdeckgoSlideChart implements DeckdeckgoSlide {
8080
return new Promise<void>((resolve) => {
8181
// If width and height, use them otherwise full size
8282
if (this.width > 0 && this.height > 0) {
83-
this.chartWidth = this.width;
84-
this.chartHeight = this.height;
83+
this.chartWidth = this.width - this.marginLeft - this.marginRight;
84+
this.chartHeight = this.height - this.marginTop - this.marginBottom;
8585
} else {
8686
const container: HTMLElement = this.el.shadowRoot.querySelector('div.deckgo-chart-container');
8787

8888
if (container) {
89-
this.chartWidth = container.clientWidth;
90-
this.chartHeight = container.clientHeight;
89+
this.chartWidth = container.clientWidth - this.marginLeft - this.marginRight;
90+
this.chartHeight = container.clientHeight - this.marginTop - this.marginBottom;
9191
}
9292
}
9393

0 commit comments

Comments
 (0)