@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
@@ -45,7 +45,7 @@ export class TextInputComponent extends PreactLitAdapter {
45
45
  /**
46
46
  * The width of the component.
47
47
  *
48
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
48
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
49
49
  */
50
50
  @property({ type: String })
51
51
  width: string = '100%';
@@ -48,7 +48,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
48
48
  /**
49
49
  * The width of the component.
50
50
  *
51
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
51
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
52
52
  */
53
53
  @property({ type: String })
54
54
  width: string = '100%';
@@ -56,7 +56,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
56
56
  /**
57
57
  * The height of the component.
58
58
  *
59
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
59
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
60
60
  */
61
61
  @property({ type: String })
62
62
  height: string = '700px';
@@ -6,14 +6,14 @@ import './gs-mutation-comparison';
6
6
  import '../app';
7
7
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
8
8
  import { LAPIS_URL, NUCLEOTIDE_MUTATIONS_ENDPOINT } from '../../constants';
9
- import nucleotideMutationsOtherVariant from '../../preact/mutationComparison/__mockData__/nucleotideMutationsOtherVariant.json';
10
- import nucleotideMutationsSomeVariant from '../../preact/mutationComparison/__mockData__/nucleotideMutationsSomeVariant.json';
9
+ import nucleotideMutationsOtherDataset from '../../preact/mutationComparison/__mockData__/nucleotideMutationsOtherDataset.json';
10
+ import nucleotideMutationsSomeDataset from '../../preact/mutationComparison/__mockData__/nucleotideMutationsSomeDataset.json';
11
11
  import { type MutationComparisonProps } from '../../preact/mutationComparison/mutation-comparison';
12
12
  import { withinShadowRoot } from '../withinShadowRoot.story';
13
13
 
14
14
  const codeExample = String.raw`
15
15
  <gs-mutation-comparison
16
- variants='[{ "displayName": "variant1", "lapisFilter": { "country": "Switzerland" }}, { "displayName": "variant2", "lapisFilter": { "country": "Germany" }}]'
16
+ lapisFilters='[{ "displayName": "Data in Switzerland", "lapisFilter": { "country": "Switzerland" }}, { "displayName": "Data in Germany", "lapisFilter": { "country": "Germany" }}]'
17
17
  sequenceType="nucleotide"
18
18
  views='["table", "venn"]'
19
19
  headline="Mutation comparison"
@@ -26,7 +26,7 @@ const meta: Meta<Required<MutationComparisonProps>> = {
26
26
  title: 'Visualization/Mutation comparison',
27
27
  component: 'gs-mutation-comparison',
28
28
  argTypes: {
29
- variants: { control: 'object' },
29
+ lapisFilters: { control: 'object' },
30
30
  sequenceType: {
31
31
  options: ['nucleotide', 'amino acid'],
32
32
  control: { type: 'radio' },
@@ -56,7 +56,7 @@ const Template: StoryObj<Required<MutationComparisonProps>> = {
56
56
  render: (args) => html`
57
57
  <gs-app lapis="${LAPIS_URL}">
58
58
  <gs-mutation-comparison
59
- .variants=${args.variants}
59
+ .lapisFilters=${args.lapisFilters}
60
60
  .sequenceType=${args.sequenceType}
61
61
  .views=${args.views}
62
62
  .width=${args.width}
@@ -74,13 +74,13 @@ const dateFrom = '2021-01-01';
74
74
  export const Default: StoryObj<Required<MutationComparisonProps>> = {
75
75
  ...Template,
76
76
  args: {
77
- variants: [
77
+ lapisFilters: [
78
78
  {
79
- displayName: 'Some variant',
79
+ displayName: 'Some dataset',
80
80
  lapisFilter: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo },
81
81
  },
82
82
  {
83
- displayName: 'Other variant',
83
+ displayName: 'Other dataset',
84
84
  lapisFilter: {
85
85
  country: 'Switzerland',
86
86
  pangoLineage: 'B.1.1.7',
@@ -101,7 +101,7 @@ export const Default: StoryObj<Required<MutationComparisonProps>> = {
101
101
  mocks: [
102
102
  {
103
103
  matcher: {
104
- name: 'nucleotideMutationsSomeVariant',
104
+ name: 'nucleotideMutationsSomeDataset',
105
105
  url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
106
106
  body: {
107
107
  country: 'Switzerland',
@@ -112,12 +112,12 @@ export const Default: StoryObj<Required<MutationComparisonProps>> = {
112
112
  },
113
113
  response: {
114
114
  status: 200,
115
- body: nucleotideMutationsSomeVariant,
115
+ body: nucleotideMutationsSomeDataset,
116
116
  },
117
117
  },
118
118
  {
119
119
  matcher: {
120
- name: 'nucleotideMutationsOtherVariant',
120
+ name: 'nucleotideMutationsOtherDataset',
121
121
  url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
122
122
  body: {
123
123
  country: 'Switzerland',
@@ -129,7 +129,7 @@ export const Default: StoryObj<Required<MutationComparisonProps>> = {
129
129
  },
130
130
  response: {
131
131
  status: 200,
132
- body: nucleotideMutationsOtherVariant,
132
+ body: nucleotideMutationsOtherDataset,
133
133
  },
134
134
  },
135
135
  ],
@@ -7,8 +7,8 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
7
7
  /**
8
8
  * ## Context
9
9
  *
10
- * This component allows to compare mutations between different variants.
11
- * A variant is defined by its LAPIS filter.
10
+ * This component allows to compare mutations between two different datasets.
11
+ * The datasets are selected by LAPIS filters.
12
12
  *
13
13
  * It only shows substitutions and deletions, it does not show insertions.
14
14
  *
@@ -16,34 +16,33 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
16
16
  *
17
17
  * ### Table View
18
18
  *
19
- * The table view shows mutations
20
- * and the proportions with which the mutation occurs in the respective variant.
21
- * It only shows mutations that are present in at least one of the variants
22
- * and where the proportion is within the selected proportion interval for at least one variant.
19
+ * The table view shows mutations and the proportions with which the mutation occurs in the respective data subsets.
20
+ * It only shows mutations that are present in at least one of the data subsets
21
+ * and where the proportion is within the selected proportion interval for at least one data subset.
23
22
  *
24
23
  * ### Venn View
25
24
  *
26
- * The Venn view shows the overlap of mutations between the variants in a Venn diagram.
27
- * A variant is considered to have a certain mutation,
28
- * if the proportion of the mutation in the variant is within the selected proportion interval.
29
- * Thus, changing the proportion interval may change a mutations from being "common" between variant
30
- * to being "for one variant only".
25
+ * The Venn view shows the overlap of mutations between the datasets in a Venn diagram.
26
+ * A dataset is considered to have a certain mutation, if the proportion of the mutation in the dataset is within the
27
+ * selected proportion interval.
28
+ * Thus, changing the proportion interval may change a mutations from being "common" between the datasets
29
+ * to being "for one dataset only".
31
30
  */
32
31
  @customElement('gs-mutation-comparison')
33
32
  export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyles {
34
33
  /**
35
34
  * Required.
36
35
  *
37
- * An array of variants to compare.
36
+ * An array of LAPIS filters to select the data to compare.
38
37
  *
39
38
  * The `lapisFilter` will be sent as is to LAPIS to filter the mutation data.
40
39
  * It must be a valid LAPIS filter object.
41
40
  *
42
- * The `displayName` will be used as the label for the variant in the views.
41
+ * The `displayName` will be used as the label for the filtered dataset in the views.
43
42
  * It should be human-readable.
44
43
  */
45
44
  @property({ type: Array })
46
- variants: {
45
+ lapisFilters: {
47
46
  lapisFilter: Record<string, string | number | null | boolean>;
48
47
  displayName: string;
49
48
  }[] = [];
@@ -63,7 +62,7 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
63
62
  /**
64
63
  * The width of the component.
65
64
  *
66
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
65
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
67
66
  */
68
67
  @property({ type: String })
69
68
  width: string = '100%';
@@ -71,7 +70,7 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
71
70
  /**
72
71
  * The height of the component.
73
72
  *
74
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
73
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
75
74
  */
76
75
  @property({ type: String })
77
76
  height: string = '700px';
@@ -92,7 +91,7 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
92
91
  override render() {
93
92
  return (
94
93
  <MutationComparison
95
- variants={this.variants}
94
+ lapisFilters={this.lapisFilters}
96
95
  sequenceType={this.sequenceType}
97
96
  views={this.views}
98
97
  width={this.width}
@@ -111,8 +110,8 @@ declare global {
111
110
  }
112
111
 
113
112
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
114
- type VariantsMatches = Expect<
115
- Equals<typeof MutationComparisonComponent.prototype.variants, MutationComparisonProps['variants']>
113
+ type LapisFiltersMatches = Expect<
114
+ Equals<typeof MutationComparisonComponent.prototype.lapisFilters, MutationComparisonProps['lapisFilters']>
116
115
  >;
117
116
  type SequenceTypeMatches = Expect<
118
117
  Equals<typeof MutationComparisonComponent.prototype.sequenceType, MutationComparisonProps['sequenceType']>
@@ -13,7 +13,7 @@ import { withinShadowRoot } from '../withinShadowRoot.story';
13
13
 
14
14
  const codeExample = String.raw`
15
15
  <gs-mutations
16
- variant='{ "country": "Switzerland", "pangoLineage": "B.1.1.7", "dateTo": "2022-01-01" }'
16
+ lapisFilter='{ "country": "Switzerland", "pangoLineage": "B.1.1.7", "dateTo": "2022-01-01" }'
17
17
  sequenceType="nucleotide"
18
18
  views='["grid", "table", "insertions"]'
19
19
  headline="Mutations"
@@ -26,7 +26,7 @@ const meta: Meta<Required<MutationsProps>> = {
26
26
  title: 'Visualization/Mutations',
27
27
  component: 'gs-mutations',
28
28
  argTypes: {
29
- variant: { control: 'object' },
29
+ lapisFilter: { control: 'object' },
30
30
  sequenceType: {
31
31
  options: ['nucleotide', 'amino acid'],
32
32
  control: { type: 'radio' },
@@ -41,7 +41,7 @@ const meta: Meta<Required<MutationsProps>> = {
41
41
  pageSize: { control: 'object' },
42
42
  },
43
43
  args: {
44
- variant: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },
44
+ lapisFilter: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },
45
45
  sequenceType: 'nucleotide',
46
46
  views: ['grid', 'table', 'insertions'],
47
47
  width: '100%',
@@ -65,7 +65,7 @@ const Template: StoryObj<Required<MutationsProps>> = {
65
65
  render: (args) => html`
66
66
  <gs-app lapis="${LAPIS_URL}">
67
67
  <gs-mutations
68
- .variant=${args.variant}
68
+ .lapisFilter=${args.lapisFilter}
69
69
  .sequenceType=${args.sequenceType}
70
70
  .views=${args.views}
71
71
  .width=${args.width}
@@ -8,15 +8,15 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
8
8
  /**
9
9
  * ## Context
10
10
  *
11
- * This component displays mutations (substitutions, deletions and insertions) for a given variant.
11
+ * This component displays mutations (substitutions, deletions and insertions) for a dataset selected by a LAPIS filter.
12
12
  *
13
13
  * ## Views
14
14
  *
15
15
  * ### Table View
16
16
  *
17
- * The table view shows all substitutions and deletions for the given variant.
17
+ * The table view shows all substitutions and deletions for the dataset.
18
18
  * It shows the type (substitution or deletion), the total count of the mutation
19
- * and the proportion of the mutation in the variant.
19
+ * and the proportion of the mutation in the dataset.
20
20
  * The proportion is relative to the total number of sequences matching
21
21
  * the specified sequence filters with non-ambiguous reads at that position.
22
22
  *
@@ -29,7 +29,7 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
29
29
  *
30
30
  * ### Insertions View
31
31
  *
32
- * The insertions view shows the count of all insertions for the given variant.
32
+ * The insertions view shows the count of all insertions for the dataset.
33
33
  *
34
34
  */
35
35
  @customElement('gs-mutations')
@@ -37,11 +37,10 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
37
37
  /**
38
38
  * Required.
39
39
  *
40
- * The `variant` will be sent as is to LAPIS to filter the mutation data.
41
- * It must be a valid LAPIS filter object.
40
+ * LAPIS filter to select the displayed data.
42
41
  */
43
42
  @property({ type: Object })
44
- variant: Record<string, string | number | null | boolean> = {};
43
+ lapisFilter: Record<string, string | number | null | boolean> = {};
45
44
 
46
45
  /**
47
46
  * The type of the sequence for which the mutations should be shown.
@@ -58,7 +57,7 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
58
57
  /**
59
58
  * The width of the component.
60
59
  *
61
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
60
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
62
61
  */
63
62
  @property({ type: String })
64
63
  width: string = '100%';
@@ -66,7 +65,7 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
66
65
  /**
67
66
  * The height of the component.
68
67
  *
69
- * Visit https://genspectrum.github.io/dashboards/?path=/docs/components-size-of-components--docs for more information.
68
+ * Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
70
69
  */
71
70
  @property({ type: String })
72
71
  height: string = '700px';
@@ -87,7 +86,7 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
87
86
  override render() {
88
87
  return (
89
88
  <Mutations
90
- variant={this.variant}
89
+ lapisFilter={this.lapisFilter}
91
90
  sequenceType={this.sequenceType}
92
91
  views={this.views}
93
92
  width={this.width}
@@ -106,7 +105,7 @@ declare global {
106
105
  }
107
106
 
108
107
  /* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
109
- type VariantsMatches = Expect<Equals<typeof MutationsComponent.prototype.variant, LapisFilter>>;
108
+ type LapisFilterMatches = Expect<Equals<typeof MutationsComponent.prototype.lapisFilter, LapisFilter>>;
110
109
  type SequenceTypeMatches = Expect<Equals<typeof MutationsComponent.prototype.sequenceType, SequenceType>>;
111
110
  type ViewsMatches = Expect<Equals<typeof MutationsComponent.prototype.views, View[]>>;
112
111
  /* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
@@ -4,20 +4,21 @@ import { html } from 'lit';
4
4
 
5
5
  import '../app';
6
6
  import './gs-prevalence-over-time';
7
+ // eslint-disable-next-line no-duplicate-imports
8
+ import { type PrevalenceOverTimeComponentProps } from './gs-prevalence-over-time';
7
9
  import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
8
10
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
9
- import denominator from '../../preact/prevalenceOverTime/__mockData__/denominator.json';
10
- import denominatorOneVariant from '../../preact/prevalenceOverTime/__mockData__/denominatorOneVariant.json';
11
- import numeratorEG from '../../preact/prevalenceOverTime/__mockData__/numeratorEG.json';
12
- import numeratorJN1 from '../../preact/prevalenceOverTime/__mockData__/numeratorJN1.json';
13
- import numeratorOneVariant from '../../preact/prevalenceOverTime/__mockData__/numeratorOneVariant.json';
14
- import { type PrevalenceOverTimeProps } from '../../preact/prevalenceOverTime/prevalence-over-time';
11
+ import denominatorFilter from '../../preact/prevalenceOverTime/__mockData__/denominatorFilter.json';
12
+ import denominatorFilterOneDataset from '../../preact/prevalenceOverTime/__mockData__/denominatorFilterOneDataset.json';
13
+ import numeratorFilterEG from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterEG.json';
14
+ import numeratorFilterJN1 from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterJN1.json';
15
+ import numeratorFilterOneDataset from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterOneDataset.json';
15
16
  import { withinShadowRoot } from '../withinShadowRoot.story';
16
17
 
17
18
  const codeExample = String.raw`
18
19
  <gs-prevalence-over-time
19
- numerator='[{ "displayName": "EG", "lapisFilter": { "country": "USA", "pangoLineage": "EG*" }}, { "displayName": "JN.1", "lapisFilter": { "country": "USA", "pangoLineage": "JN.1*" }}]'
20
- denominator='{ "country": "USA"}'
20
+ numeratorFilter='[{ "displayName": "EG", "lapisFilter": { "country": "USA", "pangoLineage": "EG*" }}, { "displayName": "JN.1", "lapisFilter": { "country": "USA", "pangoLineage": "JN.1*" }}]'
21
+ denominatorFilter='{ "country": "USA"}'
21
22
  granularity="month"
22
23
  smoothingWindow="0"
23
24
  views='["bar", "line", "bubble", "table"]'
@@ -27,14 +28,16 @@ const codeExample = String.raw`
27
28
  height="700px"
28
29
  lapisDateField="date"
29
30
  pageSize="10"
31
+ yAxisMaxLinear="1"
32
+ yAxisMaxLogarithmic="limitTo1"
30
33
  ></gs-prevalence-over-time>`;
31
34
 
32
- const meta: Meta<Required<PrevalenceOverTimeProps>> = {
35
+ const meta: Meta<Required<PrevalenceOverTimeComponentProps>> = {
33
36
  title: 'Visualization/Prevalence over time',
34
37
  component: 'gs-prevalence-over-time',
35
38
  argTypes: {
36
- numerator: { control: 'object' },
37
- denominator: { control: 'object' },
39
+ numeratorFilter: { control: 'object' },
40
+ denominatorFilter: { control: 'object' },
38
41
  granularity: {
39
42
  options: ['day', 'week', 'month', 'year'],
40
43
  control: { type: 'radio' },
@@ -52,6 +55,8 @@ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
52
55
  height: { control: 'text' },
53
56
  headline: { control: 'text' },
54
57
  pageSize: { control: 'object' },
58
+ yAxisMaxLinear: { control: 'object' },
59
+ yAxisMaxLogarithmic: { control: 'object' },
55
60
  },
56
61
  parameters: withComponentDocs({
57
62
  componentDocs: {
@@ -65,12 +70,12 @@ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
65
70
 
66
71
  export default meta;
67
72
 
68
- const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
73
+ const Template: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
69
74
  render: (args) => html`
70
75
  <gs-app lapis="${LAPIS_URL}">
71
76
  <gs-prevalence-over-time
72
- .numerator=${args.numerator}
73
- .denominator=${args.denominator}
77
+ .numeratorFilter=${args.numeratorFilter}
78
+ .denominatorFilter=${args.denominatorFilter}
74
79
  .granularity=${args.granularity}
75
80
  .smoothingWindow=${args.smoothingWindow}
76
81
  .views=${args.views}
@@ -80,19 +85,21 @@ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
80
85
  .headline=${args.headline}
81
86
  .lapisDateField=${args.lapisDateField}
82
87
  .pageSize=${args.pageSize}
88
+ .yAxisMaxLinear=${args.yAxisMaxLinear}
89
+ .yAxisMaxLogarithmic=${args.yAxisMaxLogarithmic}
83
90
  ></gs-prevalence-over-time>
84
91
  </gs-app>
85
92
  `,
86
93
  };
87
94
 
88
- export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
95
+ export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
89
96
  ...Template,
90
97
  args: {
91
- numerator: [
98
+ numeratorFilter: [
92
99
  { displayName: 'EG', lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' } },
93
100
  { displayName: 'JN.1', lapisFilter: { country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' } },
94
101
  ],
95
- denominator: { country: 'USA', dateFrom: '2023-01-01' },
102
+ denominatorFilter: { country: 'USA', dateFrom: '2023-01-01' },
96
103
  granularity: 'month',
97
104
  smoothingWindow: 0,
98
105
  views: ['bar', 'line', 'bubble', 'table'],
@@ -102,6 +109,8 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
102
109
  headline: 'Prevalence over time',
103
110
  lapisDateField: 'date',
104
111
  pageSize: 10,
112
+ yAxisMaxLinear: 1,
113
+ yAxisMaxLogarithmic: 'limitTo1',
105
114
  },
106
115
  parameters: {
107
116
  fetchMock: {
@@ -119,7 +128,7 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
119
128
  },
120
129
  response: {
121
130
  status: 200,
122
- body: numeratorEG,
131
+ body: numeratorFilterEG,
123
132
  },
124
133
  },
125
134
  {
@@ -135,7 +144,7 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
135
144
  },
136
145
  response: {
137
146
  status: 200,
138
- body: numeratorJN1,
147
+ body: numeratorFilterJN1,
139
148
  },
140
149
  },
141
150
  {
@@ -150,7 +159,7 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
150
159
  },
151
160
  response: {
152
161
  status: 200,
153
- body: denominator,
162
+ body: denominatorFilter,
154
163
  },
155
164
  },
156
165
  ],
@@ -158,16 +167,16 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
158
167
  },
159
168
  };
160
169
 
161
- export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
170
+ export const OneDataset: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
162
171
  ...Template,
163
172
  args: {
164
- numerator: {
173
+ numeratorFilter: {
165
174
  displayName: 'EG',
166
175
  lapisFilter: { country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
167
176
  },
168
- denominator: { country: 'USA', dateFrom: '2023-10-01' },
169
- granularity: 'day',
170
- smoothingWindow: 7,
177
+ denominatorFilter: { country: 'USA', dateFrom: '2023-10-01' },
178
+ granularity: 'week',
179
+ smoothingWindow: 2,
171
180
  views: ['bar', 'line', 'bubble', 'table'],
172
181
  confidenceIntervalMethods: ['wilson'],
173
182
  width: '100%',
@@ -175,13 +184,15 @@ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
175
184
  headline: 'Prevalence over time',
176
185
  lapisDateField: 'date',
177
186
  pageSize: 10,
187
+ yAxisMaxLinear: 1,
188
+ yAxisMaxLogarithmic: 'limitTo1',
178
189
  },
179
190
  parameters: {
180
191
  fetchMock: {
181
192
  mocks: [
182
193
  {
183
194
  matcher: {
184
- name: 'numeratorOneVariant',
195
+ name: 'numeratorOneDataset',
185
196
  url: AGGREGATED_ENDPOINT,
186
197
  body: {
187
198
  country: 'USA',
@@ -192,12 +203,12 @@ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
192
203
  },
193
204
  response: {
194
205
  status: 200,
195
- body: numeratorOneVariant,
206
+ body: numeratorFilterOneDataset,
196
207
  },
197
208
  },
198
209
  {
199
210
  matcher: {
200
- name: 'denominatorOneVariant',
211
+ name: 'denominatorOneDataset',
201
212
  url: AGGREGATED_ENDPOINT,
202
213
  body: {
203
214
  country: 'USA',
@@ -207,7 +218,7 @@ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
207
218
  },
208
219
  response: {
209
220
  status: 200,
210
- body: denominatorOneVariant,
221
+ body: denominatorFilterOneDataset,
211
222
  },
212
223
  },
213
224
  ],
@@ -215,8 +226,8 @@ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
215
226
  },
216
227
  };
217
228
 
218
- export const OneVariantOnLineTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
219
- ...OneVariant,
229
+ export const OneDatasetOnLineTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
230
+ ...OneDataset,
220
231
  play: async ({ canvasElement }) => {
221
232
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
222
233
 
@@ -226,8 +237,8 @@ export const OneVariantOnLineTab: StoryObj<Required<PrevalenceOverTimeProps>> =
226
237
  },
227
238
  };
228
239
 
229
- export const OneVariantOnBubbleTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
230
- ...OneVariant,
240
+ export const OneDatasetOnBubbleTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
241
+ ...OneDataset,
231
242
  play: async ({ canvasElement }) => {
232
243
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
233
244
 
@@ -237,8 +248,8 @@ export const OneVariantOnBubbleTab: StoryObj<Required<PrevalenceOverTimeProps>>
237
248
  },
238
249
  };
239
250
 
240
- export const OneVariantOnTableTab: StoryObj<Required<PrevalenceOverTimeProps>> = {
241
- ...OneVariant,
251
+ export const OneDatasetOnTableTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
252
+ ...OneDataset,
242
253
  play: async ({ canvasElement }) => {
243
254
  const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
244
255