@genspectrum/dashboard-components 0.4.5 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +2 -2
  2. package/custom-elements.json +178 -102
  3. package/dist/dashboard-components.js +473 -289
  4. package/dist/dashboard-components.js.map +1 -1
  5. package/dist/genspectrum-components.d.ts +93 -57
  6. package/dist/style.css +53 -13
  7. package/package.json +5 -5
  8. package/src/preact/aggregatedData/aggregate-table.tsx +4 -2
  9. package/src/preact/dateRangeSelector/date-range-selector.tsx +3 -5
  10. package/src/preact/mutationComparison/mutation-comparison-venn.tsx +1 -1
  11. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +18 -18
  12. package/src/preact/mutationComparison/mutation-comparison.tsx +6 -6
  13. package/src/preact/mutationComparison/queryMutationData.ts +4 -4
  14. package/src/preact/mutations/mutations.stories.tsx +3 -3
  15. package/src/preact/mutations/mutations.tsx +16 -6
  16. package/src/preact/mutations/queryMutations.ts +3 -3
  17. package/src/preact/prevalenceOverTime/__mockData__/{denominatorOneVariant.json → denominatorFilterOneDataset.json} +1 -1
  18. package/src/preact/prevalenceOverTime/__mockData__/{numeratorOneVariant.json → numeratorFilterOneDataset.json} +1 -1
  19. package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +42 -5
  20. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +26 -7
  21. package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +62 -28
  22. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +26 -16
  23. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +38 -11
  24. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +39 -7
  25. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +10 -4
  26. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +19 -10
  27. package/src/preact/shared/charts/confideceInterval.ts +7 -2
  28. package/src/preact/shared/charts/getYAxisMax.ts +24 -0
  29. package/src/preact/shared/charts/getYAxisScale.ts +1 -3
  30. package/src/query/queryAggregateData.ts +3 -3
  31. package/src/query/queryInsertions.ts +7 -2
  32. package/src/query/querySubstitutionsOrDeletions.ts +2 -2
  33. package/src/web-components/input/gs-date-range-selector.tsx +1 -1
  34. package/src/web-components/input/gs-location-filter.tsx +1 -1
  35. package/src/web-components/input/gs-mutation-filter.tsx +1 -1
  36. package/src/web-components/input/gs-text-input.tsx +1 -1
  37. package/src/web-components/visualization/gs-aggregate.tsx +2 -2
  38. package/src/web-components/visualization/gs-mutation-comparison.stories.ts +12 -12
  39. package/src/web-components/visualization/gs-mutation-comparison.tsx +18 -19
  40. package/src/web-components/visualization/gs-mutations.stories.ts +4 -4
  41. package/src/web-components/visualization/gs-mutations.tsx +10 -11
  42. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +46 -35
  43. package/src/web-components/visualization/gs-prevalence-over-time.tsx +54 -20
  44. package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +32 -18
  45. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +51 -13
  46. /package/src/preact/mutationComparison/__mockData__/{nucleotideMutationsOtherVariant.json → nucleotideMutationsOtherDataset.json} +0 -0
  47. /package/src/preact/mutationComparison/__mockData__/{nucleotideMutationsSomeVariant.json → nucleotideMutationsSomeDataset.json} +0 -0
  48. /package/src/preact/prevalenceOverTime/__mockData__/{denominator.json → denominatorFilter.json} +0 -0
  49. /package/src/preact/prevalenceOverTime/__mockData__/{numeratorEG.json → numeratorFilterEG.json} +0 -0
  50. /package/src/preact/prevalenceOverTime/__mockData__/{numeratorJN1.json → numeratorFilterJN1.json} +0 -0
  51. /package/src/preact/relativeGrowthAdvantage/__mockData__/{denominator.json → denominatorFilter.json} +0 -0
  52. /package/src/preact/relativeGrowthAdvantage/__mockData__/{numerator.json → numeratorFilter.json} +0 -0
@@ -1,15 +1,16 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
2
 
3
3
  import { PrevalenceOverTime, type PrevalenceOverTimeProps } from '../../preact/prevalenceOverTime/prevalence-over-time';
4
+ import { type AxisMax } from '../../preact/shared/charts/getYAxisMax';
4
5
  import { type Equals, type Expect } from '../../utils/typeAssertions';
5
6
  import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
6
7
 
7
8
  /**
8
9
  * ## Context
9
10
  *
10
- * This component displays the prevalence over time of one or more variants.
11
- * The prevalence is calculated as the ratio of the number of cases of each variant given as `numerator`
12
- * to the number of cases of the variant given as `denominator`.
11
+ * This component displays the prevalence over time of one or more datasets, selected by LAPIS filters.
12
+ * The prevalence is calculated as the ratio of the number of cases of each dataset to the number of cases of a reference dataset.
13
+ * The reference dataset is also selected by a LAPIS filter.
13
14
  *
14
15
  * In the chart views,
15
16
  * - the user can select whether to display a confidence interval (not available in the bubble chart).
@@ -23,19 +24,19 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
23
24
  * ### Bar View
24
25
  *
25
26
  * Displays the prevalence over time as a bar chart.
26
- * Shows a bar for each variant in the `numerator` on every time step.
27
+ * Shows a bar for each dataset of the `numeratorFilter` on every time step.
27
28
  *
28
29
  * ### Line View
29
30
  *
30
31
  * Displays the prevalence over time as a line chart.
31
32
  * Each data point is connected for better visibility.
32
- * Shows a line for each variant in the `numerator`.
33
+ * Shows a line for each dataset of the `numeratorFilter`.
33
34
  *
34
35
  * ### Bubble View
35
36
  *
36
37
  * Displays the prevalence over time as a bubble chart.
37
- * The size of the bubbles represents the number of cases of the `denominator` variant.
38
- * The height of the bubbles represents the prevalence of the `numerator` variants.
38
+ * The size of the bubbles represents the number of cases of the reference, defined by the `denominatorFilter`.
39
+ * The height of the bubbles represents the prevalence of the datasets selected by the `numeratorFilters`.
39
40
  *
40
41
  * ### Table View
41
42
  *
@@ -47,14 +48,17 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
47
48
  // The multiline union type must not start with `|` because it looks weird in the Storybook docs
48
49
  /**
49
50
  * Required.
51
+ * Either a LAPIS filter or an array of LAPIS filters to calculate the prevalence for.
52
+ *
53
+ * The `lapisFilter` will be sent as is to LAPIS to select the data.
54
+ * It must be a valid LAPIS filter object.
55
+ *
56
+ * The `displayName` will be used as the label the prevalence in the views.
57
+ * It should be human-readable.
50
58
  *
51
- * Either a single variant or an array of variants to compare.
52
- * This must be a valid LAPIS filter object with an additional `displayName` property
53
- * which will be used as the label for the variant in the views,
54
- * or an array of such objects.
55
59
  */
56
60
  @property({ type: Object })
57
- numerator:
61
+ numeratorFilter:
58
62
  {
59
63
  lapisFilter: Record<string, string | number | null | boolean>;
60
64
  displayName: string;
@@ -67,10 +71,11 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
67
71
  /**
68
72
  * Required.
69
73
  *
70
- * The variant that the variants in `numerator` are compared to.
74
+ * The LAPIS filter, to select the data of the reference.
75
+ * It must be a valid LAPIS filter object.
71
76
  */
72
77
  @property({ type: Object })
73
- denominator: Record<string, string | number | null | boolean> = {};
78
+ denominatorFilter: Record<string, string | number | null | boolean> = {};
74
79
 
75
80
  /**
76
81
  * The granularity of the time axis.
@@ -113,7 +118,7 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
113
118
  /**
114
119
  * The width of the component.
115
120
  *
116
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
121
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
117
122
  */
118
123
  @property({ type: String })
119
124
  width: string = '100%';
@@ -121,7 +126,7 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
121
126
  /**
122
127
  * The height of the component.
123
128
  *
124
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
129
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
125
130
  */
126
131
  @property({ type: String })
127
132
  height: string = '700px';
@@ -143,11 +148,31 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
143
148
  @property({ type: Object })
144
149
  pageSize: boolean | number = false;
145
150
 
151
+ /**
152
+ * The maximum value for the y-axis on all graphs in linear view.
153
+ * If set to a number, the maximum value is set to this number.
154
+ * If set to `maxInData`, the maximum value is set to the maximum value in the data.
155
+ * If set to `limitTo1`, the maximum value is set to `min(1, the maximum value in the data)`.
156
+ * If not set, the maximum value is set to the default value (1).
157
+ */
158
+ @property({ type: String })
159
+ yAxisMaxLinear: 'maxInData' | 'limitTo1' | number = 1;
160
+
161
+ /**
162
+ * The maximum value for the y-axis on all graphs in logarithmic view.
163
+ * If set to a number, the maximum value is set to this number.
164
+ * If set to `maxInData`, the maximum value is set to the maximum value in the data.
165
+ * If set to `limitTo1`, the maximum value is set to `min(1, the maximum value in the data)`.
166
+ * If not set, the maximum value is set to the default value (1).
167
+ */
168
+ @property({ type: String })
169
+ yAxisMaxLogarithmic: 'maxInData' | 'limitTo1' | number = 1;
170
+
146
171
  override render() {
147
172
  return (
148
173
  <PrevalenceOverTime
149
- numerator={this.numerator}
150
- denominator={this.denominator}
174
+ numeratorFilter={this.numeratorFilter}
175
+ denominatorFilter={this.denominatorFilter}
151
176
  granularity={this.granularity}
152
177
  smoothingWindow={this.smoothingWindow}
153
178
  views={this.views}
@@ -157,11 +182,20 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
157
182
  headline={this.headline}
158
183
  lapisDateField={this.lapisDateField}
159
184
  pageSize={this.pageSize}
185
+ yAxisMaxConfig={{
186
+ linear: this.yAxisMaxLinear,
187
+ logarithmic: this.yAxisMaxLogarithmic,
188
+ }}
160
189
  />
161
190
  );
162
191
  }
163
192
  }
164
193
 
194
+ export interface PrevalenceOverTimeComponentProps extends Omit<PrevalenceOverTimeProps, 'yAxisMaxConfig'> {
195
+ yAxisMaxLinear?: AxisMax;
196
+ yAxisMaxLogarithmic?: AxisMax;
197
+ }
198
+
165
199
  declare global {
166
200
  interface HTMLElementTagNameMap {
167
201
  'gs-prevalence-over-time': PrevalenceOverTimeComponent;
@@ -170,10 +204,10 @@ declare global {
170
204
 
171
205
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
172
206
  type NumeratorMatches = Expect<
173
- Equals<typeof PrevalenceOverTimeComponent.prototype.numerator, PrevalenceOverTimeProps['numerator']>
207
+ Equals<typeof PrevalenceOverTimeComponent.prototype.numeratorFilter, PrevalenceOverTimeProps['numeratorFilter']>
174
208
  >;
175
209
  type DenominatorMatches = Expect<
176
- Equals<typeof PrevalenceOverTimeComponent.prototype.denominator, PrevalenceOverTimeProps['denominator']>
210
+ Equals<typeof PrevalenceOverTimeComponent.prototype.denominatorFilter, PrevalenceOverTimeProps['denominatorFilter']>
177
211
  >;
178
212
  type GranularityMatches = Expect<
179
213
  Equals<typeof PrevalenceOverTimeComponent.prototype.granularity, PrevalenceOverTimeProps['granularity']>
@@ -3,30 +3,33 @@ import { html } from 'lit';
3
3
 
4
4
  import './gs-relative-growth-advantage';
5
5
  import '../app';
6
+ // eslint-disable-next-line no-duplicate-imports
7
+ import { type RelativeGrowthAdvantageComponentProps } from './gs-relative-growth-advantage';
6
8
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
7
9
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
8
- import denominator from '../../preact/relativeGrowthAdvantage/__mockData__/denominator.json';
9
- import numerator from '../../preact/relativeGrowthAdvantage/__mockData__/numerator.json';
10
- import { type RelativeGrowthAdvantageProps } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
10
+ import denominatorFilter from '../../preact/relativeGrowthAdvantage/__mockData__/denominatorFilter.json';
11
+ import numeratorFilter from '../../preact/relativeGrowthAdvantage/__mockData__/numeratorFilter.json';
11
12
 
12
13
  const codeExample = String.raw`
13
14
  <gs-relative-growth-advantage
14
- numerator='{ "country": "Switzerland", "pangoLineage": "B.1.1.7", "dateFrom": "2020-12-01" }'
15
- denominator='{ "country": "Switzerland", "dateFrom": "2020-12-01" }'
15
+ numeratorFilter='{ "country": "Switzerland", "pangoLineage": "B.1.1.7", "dateFrom": "2020-12-01" }'
16
+ denominatorFilter='{ "country": "Switzerland", "dateFrom": "2020-12-01" }'
16
17
  generationTime="7"
17
18
  views='["line"]'
18
19
  width='100%'
19
20
  height='700px'
20
21
  headline="Relative growth advantage"
21
22
  lapisDateField="date"
23
+ yAxisMaxLinear="1"
24
+ yAxisMaxLogarithmic="limitTo1"
22
25
  ></gs-relative-growth-advantage>`;
23
26
 
24
- const meta: Meta<RelativeGrowthAdvantageProps> = {
27
+ const meta: Meta<RelativeGrowthAdvantageComponentProps> = {
25
28
  title: 'Visualization/Relative growth advantage',
26
29
  component: 'gs-relative-growth-advantage',
27
30
  argTypes: {
28
- numerator: { control: 'object' },
29
- denominator: { control: 'object' },
31
+ numeratorFilter: { control: 'object' },
32
+ denominatorFilter: { control: 'object' },
30
33
  generationTime: { control: 'number' },
31
34
  views: {
32
35
  options: ['line'],
@@ -35,6 +38,8 @@ const meta: Meta<RelativeGrowthAdvantageProps> = {
35
38
  width: { control: 'text' },
36
39
  height: { control: 'text' },
37
40
  headline: { control: 'text' },
41
+ yAxisMaxLinear: { control: 'object' },
42
+ yAxisMaxLogarithmic: { control: 'object' },
38
43
  },
39
44
  parameters: withComponentDocs({
40
45
  componentDocs: {
@@ -48,41 +53,50 @@ const meta: Meta<RelativeGrowthAdvantageProps> = {
48
53
 
49
54
  export default meta;
50
55
 
51
- const Template: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
56
+ const Template: StoryObj<Required<RelativeGrowthAdvantageComponentProps>> = {
52
57
  render: (args) => html`
53
58
  <gs-app lapis="${LAPIS_URL}">
54
59
  <gs-relative-growth-advantage
55
- .numerator=${args.numerator}
56
- .denominator=${args.denominator}
60
+ .numeratorFilter=${args.numeratorFilter}
61
+ .denominatorFilter=${args.denominatorFilter}
57
62
  .generationTime=${args.generationTime}
58
63
  .views=${args.views}
59
64
  .width=${args.width}
60
65
  .height=${args.height}
61
66
  .headline=${args.headline}
62
67
  .lapisDateField=${args.lapisDateField}
68
+ .yAxisMaxLinear=${args.yAxisMaxLinear}
69
+ .yAxisMaxLogarithmic=${args.yAxisMaxLogarithmic}
63
70
  ></gs-relative-growth-advantage>
64
71
  </gs-app>
65
72
  `,
66
73
  };
67
74
 
68
- export const Default: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
75
+ export const Default: StoryObj<Required<RelativeGrowthAdvantageComponentProps>> = {
69
76
  ...Template,
70
77
  args: {
71
- numerator: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateFrom: '2020-12-01', dateTo: '2021-03-01' },
72
- denominator: { country: 'Switzerland', dateFrom: '2020-12-01', dateTo: '2021-03-01' },
78
+ numeratorFilter: {
79
+ country: 'Switzerland',
80
+ pangoLineage: 'B.1.1.7',
81
+ dateFrom: '2020-12-01',
82
+ dateTo: '2021-03-01',
83
+ },
84
+ denominatorFilter: { country: 'Switzerland', dateFrom: '2020-12-01', dateTo: '2021-03-01' },
73
85
  generationTime: 7,
74
86
  views: ['line'],
75
87
  width: '100%',
76
88
  height: '700px',
77
89
  headline: 'Relative growth advantage',
78
90
  lapisDateField: 'date',
91
+ yAxisMaxLinear: 1,
92
+ yAxisMaxLogarithmic: 'limitTo1',
79
93
  },
80
94
  parameters: {
81
95
  fetchMock: {
82
96
  mocks: [
83
97
  {
84
98
  matcher: {
85
- name: 'numerator',
99
+ name: 'numeratorFilter',
86
100
  url: AGGREGATED_ENDPOINT,
87
101
  body: {
88
102
  country: 'Switzerland',
@@ -94,12 +108,12 @@ export const Default: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
94
108
  },
95
109
  response: {
96
110
  status: 200,
97
- body: numerator,
111
+ body: numeratorFilter,
98
112
  },
99
113
  },
100
114
  {
101
115
  matcher: {
102
- name: 'denominator',
116
+ name: 'denominatorFilter',
103
117
  url: AGGREGATED_ENDPOINT,
104
118
  body: {
105
119
  country: 'Switzerland',
@@ -110,7 +124,7 @@ export const Default: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
110
124
  },
111
125
  response: {
112
126
  status: 200,
113
- body: denominator,
127
+ body: denominatorFilter,
114
128
  },
115
129
  },
116
130
  ],
@@ -1,6 +1,11 @@
1
1
  import { customElement, property } from 'lit/decorators.js';
2
2
 
3
- import { RelativeGrowthAdvantage, type View } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
3
+ import {
4
+ RelativeGrowthAdvantage,
5
+ type RelativeGrowthAdvantageProps,
6
+ type View,
7
+ } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
8
+ import { type AxisMax } from '../../preact/shared/charts/getYAxisMax';
4
9
  import type { LapisFilter } from '../../types';
5
10
  import { type Equals, type Expect } from '../../utils/typeAssertions';
6
11
  import { PreactLitAdapter } from '../PreactLitAdapter';
@@ -11,7 +16,7 @@ import { PreactLitAdapter } from '../PreactLitAdapter';
11
16
  * For this component, we assume a discrete time model, where new infections happen exactly every `generationTime` days.
12
17
  * This is what we call a "generation".
13
18
  *
14
- * This component estimates the relative growth advantage of a variant by performing a logistic regression.
19
+ * This component estimates the relative growth advantage of a variant (defined by its LAPIS filter) by performing a logistic regression.
15
20
  * Based on the inferred logistic growth rate, we derive the relative growth advantage (per generation).
16
21
  *
17
22
  * For details on the scientific method, see:
@@ -27,7 +32,7 @@ import { PreactLitAdapter } from '../PreactLitAdapter';
27
32
  * ### Line View
28
33
  *
29
34
  * The line view shows the relative growth advantage over time in a line chart.
30
- * The dots in the plot show the proportions of the focal variant (`numerator`) to the `denominator` variant
35
+ * The dots in the plot show the proportions of the focal variant (defined by the `numeratorFilter`) to the baseline variant (defined by the `denominatorFilter`)
31
36
  * for every day as observed in the data.
32
37
  * The line shows a logistic curve fitted to the data points, including a 95% confidence interval.
33
38
  */
@@ -36,18 +41,20 @@ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
36
41
  /**
37
42
  * Required.
38
43
  *
39
- * The LAPIS filter for the focal variant.
44
+ * LAPIS filter to select the data of the focal variant.
45
+ * It must be a valid LAPIS filter object.
40
46
  */
41
47
  @property({ type: Object })
42
- numerator: Record<string, string | number | null | boolean> = {};
48
+ numeratorFilter: Record<string, string | number | null | boolean> = {};
43
49
 
44
50
  /**
45
51
  * Required.
46
52
  *
47
- * The LAPIS filter for the variant that the focal variant (`numerator`) should be compared to.
53
+ * LAPIS filter to select the data of the baseline variant.
54
+ * It must be a valid LAPIS filter object.
48
55
  */
49
56
  @property({ type: Object })
50
- denominator: Record<string, string | number | null | boolean> = {};
57
+ denominatorFilter: Record<string, string | number | null | boolean> = {};
51
58
 
52
59
  /**
53
60
  * The generation time represents the number of days over which the variant's relative growth advantage is measured.
@@ -71,7 +78,7 @@ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
71
78
  /**
72
79
  * The width of the component.
73
80
  *
74
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
81
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
75
82
  */
76
83
  @property({ type: String })
77
84
  width: string = '100%';
@@ -79,7 +86,7 @@ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
79
86
  /**
80
87
  * The height of the component.
81
88
  *
82
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
89
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
83
90
  */
84
91
  @property({ type: String })
85
92
  height: string = '700px';
@@ -94,22 +101,51 @@ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
94
101
  @property({ type: String })
95
102
  lapisDateField: string = 'date';
96
103
 
104
+ /**
105
+ * The maximum value for the y-axis on all graphs in linear view.
106
+ * If set to a number, the maximum value is set to this number.
107
+ * If set to `maxInData`, the maximum value is set to the maximum value in the data.
108
+ * If set to `limitTo1`, the maximum value is set to `min(1, the maximum value in the data)`.
109
+ * If not set, the maximum value is set to the default value (1).
110
+ */
111
+ @property({ type: String })
112
+ yAxisMaxLinear: 'maxInData' | 'limitTo1' | number = 1;
113
+
114
+ /**
115
+ * The maximum value for the y-axis on all graphs in logarithmic view.
116
+ * If set to a number, the maximum value is set to this number.
117
+ * If set to `maxInData`, the maximum value is set to the maximum value in the data.
118
+ * If set to `limitTo1`, the maximum value is set to `min(1, the maximum value in the data)`.
119
+ * If not set, the maximum value is set to the default value (1).
120
+ */
121
+ @property({ type: String })
122
+ yAxisMaxLogarithmic: 'maxInData' | 'limitTo1' | number = 1;
123
+
97
124
  override render() {
98
125
  return (
99
126
  <RelativeGrowthAdvantage
100
- numerator={this.numerator}
101
- denominator={this.denominator}
127
+ numeratorFilter={this.numeratorFilter}
128
+ denominatorFilter={this.denominatorFilter}
102
129
  generationTime={this.generationTime}
103
130
  views={this.views}
104
131
  width={this.width}
105
132
  height={this.height}
106
133
  headline={this.headline}
107
134
  lapisDateField={this.lapisDateField}
135
+ yAxisMaxConfig={{
136
+ linear: this.yAxisMaxLinear,
137
+ logarithmic: this.yAxisMaxLogarithmic,
138
+ }}
108
139
  />
109
140
  );
110
141
  }
111
142
  }
112
143
 
144
+ export interface RelativeGrowthAdvantageComponentProps extends Omit<RelativeGrowthAdvantageProps, 'yAxisMaxConfig'> {
145
+ yAxisMaxLinear?: AxisMax;
146
+ yAxisMaxLogarithmic?: AxisMax;
147
+ }
148
+
113
149
  declare global {
114
150
  interface HTMLElementTagNameMap {
115
151
  'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
@@ -117,7 +153,9 @@ declare global {
117
153
  }
118
154
 
119
155
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
120
- type NumeratorMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.numerator, LapisFilter>>;
121
- type DenominatorMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.denominator, LapisFilter>>;
156
+ type NumeratorMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.numeratorFilter, LapisFilter>>;
157
+ type DenominatorMatches = Expect<
158
+ Equals<typeof RelativeGrowthAdvantageComponent.prototype.denominatorFilter, LapisFilter>
159
+ >;
122
160
  type ViewsMatches = Expect<Equals<typeof RelativeGrowthAdvantageComponent.prototype.views, View[]>>;
123
161
  /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */