Skip to content

Commit

Permalink
fix: changed legends totalSpace calculation formula (#159)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexey Gryzin <[email protected]>
  • Loading branch information
feelsbadmans and Alexey Gryzin authored Oct 2, 2023
1 parent 7df0130 commit 900193c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/YagrCore/plugins/legend/legend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface LegendState {
}

const ALL_SERIES_IDX = 'null' as const;
const PAGINATION_BUTTON_HEIGHT = 18;
const TOTAL_LEGEND_VERTICAL_PADDING_BOTTOM = 20;
const TOTAL_LEGEND_VERTICAL_PADDING_TOP = 48;
const DEFAULT_FONT_SIZE = 12;
Expand Down Expand Up @@ -483,9 +484,10 @@ export default class LegendPlugin {
const paginated = requiredHeight > itemsPageSize;
const requiredSpace = Math.min(paginated ? paginatedPageSize : itemsPageSize, requiredHeight);
const pages = Math.ceil(requiredHeight / itemsPageSize);
const additionalSpace = paginated ? this.VERTICAL_PADDING + PAGINATION_BUTTON_HEIGHT : this.VERTICAL_PADDING;

this.state.requiredSpace = requiredSpace;
this.state.totalSpace = requiredSpace + this.VERTICAL_PADDING;
this.state.totalSpace = requiredSpace + additionalSpace;
this.state.paginated = paginated;
this.state.page = this.state.page || 0;
this.state.pages = pages;
Expand Down

0 comments on commit 900193c

Please sign in to comment.