@genspectrum/dashboard-components 0.4.4 → 0.5.0

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 (64) hide show
  1. package/README.md +2 -2
  2. package/custom-elements.json +279 -108
  3. package/dist/dashboard-components.js +495 -283
  4. package/dist/dashboard-components.js.map +1 -1
  5. package/dist/genspectrum-components.d.ts +115 -55
  6. package/dist/style.css +34 -7
  7. package/package.json +5 -5
  8. package/src/preact/aggregatedData/aggregate-table.tsx +3 -2
  9. package/src/preact/aggregatedData/aggregate.stories.tsx +2 -0
  10. package/src/preact/aggregatedData/aggregate.tsx +8 -3
  11. package/src/preact/components/table.stories.tsx +51 -1
  12. package/src/preact/components/table.tsx +4 -3
  13. package/src/preact/locationFilter/location-filter.stories.tsx +12 -1
  14. package/src/preact/locationFilter/location-filter.tsx +10 -3
  15. package/src/preact/mutationComparison/mutation-comparison-table.tsx +7 -2
  16. package/src/preact/mutationComparison/mutation-comparison-venn.tsx +1 -1
  17. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +21 -18
  18. package/src/preact/mutationComparison/mutation-comparison.tsx +30 -8
  19. package/src/preact/mutationComparison/queryMutationData.ts +4 -4
  20. package/src/preact/mutations/mutations-grid.tsx +8 -2
  21. package/src/preact/mutations/mutations-insertions-table.tsx +3 -2
  22. package/src/preact/mutations/mutations-table.tsx +3 -2
  23. package/src/preact/mutations/mutations.stories.tsx +6 -3
  24. package/src/preact/mutations/mutations.tsx +30 -10
  25. package/src/preact/mutations/queryMutations.ts +3 -3
  26. package/src/preact/prevalenceOverTime/__mockData__/{denominatorOneVariant.json → denominatorFilterOneDataset.json} +1 -1
  27. package/src/preact/prevalenceOverTime/__mockData__/{numeratorOneVariant.json → numeratorFilterOneDataset.json} +1 -1
  28. package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +42 -5
  29. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +26 -7
  30. package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +62 -28
  31. package/src/preact/prevalenceOverTime/prevalence-over-time-table.tsx +3 -2
  32. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +30 -16
  33. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +46 -12
  34. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +39 -7
  35. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +10 -4
  36. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +19 -10
  37. package/src/preact/shared/charts/confideceInterval.ts +7 -2
  38. package/src/preact/shared/charts/getYAxisMax.ts +24 -0
  39. package/src/preact/shared/charts/getYAxisScale.ts +1 -3
  40. package/src/query/queryAggregateData.ts +2 -2
  41. package/src/query/queryInsertions.ts +7 -2
  42. package/src/query/querySubstitutionsOrDeletions.ts +2 -2
  43. package/src/web-components/input/gs-date-range-selector.tsx +1 -1
  44. package/src/web-components/input/gs-location-filter.stories.ts +11 -0
  45. package/src/web-components/input/gs-location-filter.tsx +15 -2
  46. package/src/web-components/input/gs-mutation-filter.tsx +1 -1
  47. package/src/web-components/input/gs-text-input.tsx +1 -1
  48. package/src/web-components/visualization/gs-aggregate.stories.ts +4 -0
  49. package/src/web-components/visualization/gs-aggregate.tsx +10 -2
  50. package/src/web-components/visualization/gs-mutation-comparison.stories.ts +16 -12
  51. package/src/web-components/visualization/gs-mutation-comparison.tsx +26 -19
  52. package/src/web-components/visualization/gs-mutations.stories.ts +8 -4
  53. package/src/web-components/visualization/gs-mutations.tsx +18 -11
  54. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +51 -35
  55. package/src/web-components/visualization/gs-prevalence-over-time.tsx +66 -24
  56. package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +32 -18
  57. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +51 -13
  58. /package/src/preact/mutationComparison/__mockData__/{nucleotideMutationsOtherVariant.json → nucleotideMutationsOtherDataset.json} +0 -0
  59. /package/src/preact/mutationComparison/__mockData__/{nucleotideMutationsSomeVariant.json → nucleotideMutationsSomeDataset.json} +0 -0
  60. /package/src/preact/prevalenceOverTime/__mockData__/{denominator.json → denominatorFilter.json} +0 -0
  61. /package/src/preact/prevalenceOverTime/__mockData__/{numeratorEG.json → numeratorFilterEG.json} +0 -0
  62. /package/src/preact/prevalenceOverTime/__mockData__/{numeratorJN1.json → numeratorFilterJN1.json} +0 -0
  63. /package/src/preact/relativeGrowthAdvantage/__mockData__/{denominator.json → denominatorFilter.json} +0 -0
  64. /package/src/preact/relativeGrowthAdvantage/__mockData__/{numerator.json → numeratorFilter.json} +0 -0
@@ -10,12 +10,12 @@ import { type DisplayedSegment } from '../components/SegmentSelector';
10
10
  import { type DisplayedMutationType } from '../components/mutation-type-selector';
11
11
 
12
12
  export async function queryMutationsData(
13
- variant: LapisFilter,
13
+ lapisFilter: LapisFilter,
14
14
  sequenceType: 'nucleotide' | 'amino acid',
15
15
  lapis: string,
16
16
  ) {
17
- const substitutionsOrDeletions = (await querySubstitutionsOrDeletions(variant, sequenceType, lapis)).content;
18
- const insertions = (await queryInsertions(variant, sequenceType, lapis)).content;
17
+ const substitutionsOrDeletions = (await querySubstitutionsOrDeletions(lapisFilter, sequenceType, lapis)).content;
18
+ const insertions = (await queryInsertions(lapisFilter, sequenceType, lapis)).content;
19
19
 
20
20
  return {
21
21
  substitutionsOrDeletions,
@@ -25,7 +25,7 @@
25
25
  "count": 289
26
26
  },
27
27
  {
28
- "date": "2023-11-24",
28
+ "date": null,
29
29
  "count": 516
30
30
  },
31
31
  {
@@ -25,7 +25,7 @@
25
25
  "count": 27
26
26
  },
27
27
  {
28
- "date": "2023-11-24",
28
+ "date": null,
29
29
  "count": 62
30
30
  },
31
31
  {
@@ -1,17 +1,21 @@
1
1
  import { Chart, type ChartConfiguration, registerables, type TooltipItem } from 'chart.js';
2
2
  import { BarWithErrorBar, BarWithErrorBarsController } from 'chartjs-chart-error-bars';
3
3
 
4
+ import { maxInData } from './prevalence-over-time';
4
5
  import { type PrevalenceOverTimeData, type PrevalenceOverTimeVariantData } from '../../query/queryPrevalenceOverTime';
6
+ import type { Temporal } from '../../utils/temporal';
5
7
  import GsChart from '../components/chart';
6
8
  import { LogitScale } from '../shared/charts/LogitScale';
7
9
  import { singleGraphColorRGBAById } from '../shared/charts/colors';
8
10
  import { type ConfidenceIntervalMethod, wilson95PercentConfidenceInterval } from '../shared/charts/confideceInterval';
11
+ import { getYAxisMax, type YAxisMaxConfig } from '../shared/charts/getYAxisMax';
9
12
  import { getYAxisScale, type ScaleType } from '../shared/charts/getYAxisScale';
10
13
 
11
14
  interface PrevalenceOverTimeBarChartProps {
12
15
  data: PrevalenceOverTimeData;
13
16
  yAxisScaleType: ScaleType;
14
17
  confidenceIntervalMethod: ConfidenceIntervalMethod;
18
+ yAxisMaxConfig: YAxisMaxConfig;
15
19
  }
16
20
 
17
21
  Chart.register(...registerables, LogitScale, BarWithErrorBarsController, BarWithErrorBar);
@@ -20,18 +24,32 @@ const PrevalenceOverTimeBarChart = ({
20
24
  data,
21
25
  yAxisScaleType,
22
26
  confidenceIntervalMethod,
27
+ yAxisMaxConfig,
23
28
  }: PrevalenceOverTimeBarChartProps) => {
29
+ const nullFirstData = data.map((variantData) => {
30
+ return {
31
+ content: variantData.content.sort(sortNullToBeginningThenByDate),
32
+ displayName: variantData.displayName,
33
+ };
34
+ });
35
+
36
+ const datasets = nullFirstData.map((graphData, index) => getDataset(graphData, index, confidenceIntervalMethod));
37
+
38
+ const maxY =
39
+ yAxisScaleType !== 'logit'
40
+ ? getYAxisMax(maxInData(nullFirstData), yAxisMaxConfig?.[yAxisScaleType])
41
+ : undefined;
42
+
24
43
  const config: ChartConfiguration = {
25
44
  type: BarWithErrorBarsController.id,
26
45
  data: {
27
- labels: data[0]?.content.map((dateRange) => dateRange.dateRange?.toString() ?? 'Unknown') || [],
28
- datasets: data.map((graphData, index) => datasets(graphData, index, confidenceIntervalMethod)),
46
+ datasets,
29
47
  },
30
48
  options: {
31
49
  maintainAspectRatio: false,
32
50
  animation: false,
33
51
  scales: {
34
- y: getYAxisScale(yAxisScaleType),
52
+ y: { ...getYAxisScale(yAxisScaleType), max: maxY },
35
53
  },
36
54
  plugins: {
37
55
  legend: {
@@ -45,7 +63,23 @@ const PrevalenceOverTimeBarChart = ({
45
63
  return <GsChart configuration={config} />;
46
64
  };
47
65
 
48
- const datasets = (
66
+ function sortNullToBeginningThenByDate(
67
+ a: { count: number; prevalence: number; total: number; dateRange: Temporal | null },
68
+ b: {
69
+ count: number;
70
+ prevalence: number;
71
+ total: number;
72
+ dateRange: Temporal | null;
73
+ },
74
+ ) {
75
+ return a.dateRange === null
76
+ ? -1
77
+ : b.dateRange === null
78
+ ? 1
79
+ : a.dateRange.toString().localeCompare(b.dateRange.toString());
80
+ }
81
+
82
+ const getDataset = (
49
83
  prevalenceOverTimeVariant: PrevalenceOverTimeVariantData,
50
84
  index: number,
51
85
  confidenceIntervalMethod: ConfidenceIntervalMethod,
@@ -66,12 +100,15 @@ const datasets = (
66
100
  y: dataPoint.prevalence,
67
101
  yMin: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
68
102
  yMax: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit,
103
+ x: dataPoint.dateRange?.toString() ?? 'Unknown',
69
104
  })),
70
105
  };
71
106
  default:
72
107
  return {
73
108
  ...generalConfig,
74
- data: prevalenceOverTimeVariant.content.map((dataPoint) => dataPoint.prevalence),
109
+ data: prevalenceOverTimeVariant.content.map((dataPoint) => {
110
+ return { y: dataPoint.prevalence, x: dataPoint.dateRange };
111
+ }),
75
112
  };
76
113
  }
77
114
  };
@@ -1,32 +1,51 @@
1
1
  import { Chart, type ChartConfiguration, registerables } from 'chart.js';
2
2
 
3
+ import { maxInData } from './prevalence-over-time';
3
4
  import { type PrevalenceOverTimeData } from '../../query/queryPrevalenceOverTime';
4
5
  import { addUnit, minusTemporal } from '../../utils/temporal';
5
6
  import { getMinMaxNumber } from '../../utils/utils';
6
7
  import GsChart from '../components/chart';
7
8
  import { LogitScale } from '../shared/charts/LogitScale';
8
9
  import { singleGraphColorRGBAById } from '../shared/charts/colors';
10
+ import { getYAxisMax, type YAxisMaxConfig } from '../shared/charts/getYAxisMax';
9
11
  import { getYAxisScale, type ScaleType } from '../shared/charts/getYAxisScale';
10
12
 
11
13
  interface PrevalenceOverTimeBubbleChartProps {
12
14
  data: PrevalenceOverTimeData;
13
15
  yAxisScaleType: ScaleType;
16
+ yAxisMaxConfig: YAxisMaxConfig;
14
17
  }
15
18
 
16
19
  Chart.register(...registerables, LogitScale);
17
20
 
18
- const PrevalenceOverTimeBubbleChart = ({ data, yAxisScaleType }: PrevalenceOverTimeBubbleChartProps) => {
19
- const firstDate = data[0].content[0].dateRange!;
20
- const total = data.map((graphData) => graphData.content.map((dataPoint) => dataPoint.total)).flat();
21
+ const PrevalenceOverTimeBubbleChart = ({
22
+ data,
23
+ yAxisScaleType,
24
+ yAxisMaxConfig,
25
+ }: PrevalenceOverTimeBubbleChartProps) => {
26
+ const nonNullDateRangeData = data.map((variantData) => {
27
+ return {
28
+ content: variantData.content.filter((dataPoint) => dataPoint.dateRange !== null),
29
+ displayName: variantData.displayName,
30
+ };
31
+ });
32
+
33
+ const firstDate = nonNullDateRangeData[0].content[0].dateRange!;
34
+ const total = nonNullDateRangeData.map((graphData) => graphData.content.map((dataPoint) => dataPoint.total)).flat();
21
35
  const [minTotal, maxTotal] = getMinMaxNumber(total)!;
22
36
  const scaleBubble = (value: number) => {
23
37
  return ((value - minTotal) / (maxTotal - minTotal)) * 4.5 + 0.5;
24
38
  };
25
39
 
40
+ const maxY =
41
+ yAxisScaleType !== 'logit'
42
+ ? getYAxisMax(maxInData(nonNullDateRangeData), yAxisMaxConfig?.[yAxisScaleType])
43
+ : undefined;
44
+
26
45
  const config: ChartConfiguration = {
27
46
  type: 'bubble',
28
47
  data: {
29
- datasets: data.map((graphData, index) => ({
48
+ datasets: nonNullDateRangeData.map((graphData, index) => ({
30
49
  label: graphData.displayName,
31
50
  data: graphData.content
32
51
  .filter((dataPoint) => dataPoint.dateRange !== null)
@@ -50,7 +69,7 @@ const PrevalenceOverTimeBubbleChart = ({ data, yAxisScaleType }: PrevalenceOverT
50
69
  callback: (value) => addUnit(firstDate, value as number).toString(),
51
70
  },
52
71
  },
53
- y: getYAxisScale(yAxisScaleType),
72
+ y: { ...getYAxisScale(yAxisScaleType), max: maxY },
54
73
  },
55
74
  plugins: {
56
75
  legend: {
@@ -61,12 +80,12 @@ const PrevalenceOverTimeBubbleChart = ({ data, yAxisScaleType }: PrevalenceOverT
61
80
  intersect: false,
62
81
  callbacks: {
63
82
  title: (context) => {
64
- const dataset = data[context[0].datasetIndex!];
83
+ const dataset = nonNullDateRangeData[context[0].datasetIndex!];
65
84
  const dataPoint = dataset.content[context[0].dataIndex!];
66
85
  return dataPoint.dateRange?.toString();
67
86
  },
68
87
  label: (context) => {
69
- const dataset = data[context.datasetIndex!];
88
+ const dataset = nonNullDateRangeData[context.datasetIndex!];
70
89
  const dataPoint = dataset.content[context.dataIndex!];
71
90
 
72
91
  const percentage = (dataPoint.prevalence * 100).toFixed(2);
@@ -1,6 +1,7 @@
1
1
  import { Chart, type ChartConfiguration, registerables } from 'chart.js';
2
2
  import { type TooltipItem } from 'chart.js/dist/types';
3
3
 
4
+ import { maxInData } from './prevalence-over-time';
4
5
  import { type PrevalenceOverTimeData, type PrevalenceOverTimeVariantData } from '../../query/queryPrevalenceOverTime';
5
6
  import GsChart from '../components/chart';
6
7
  import { LogitScale } from '../shared/charts/LogitScale';
@@ -10,12 +11,14 @@ import {
10
11
  type ConfidenceIntervalMethod,
11
12
  wilson95PercentConfidenceInterval,
12
13
  } from '../shared/charts/confideceInterval';
14
+ import { getYAxisMax, type YAxisMaxConfig } from '../shared/charts/getYAxisMax';
13
15
  import { getYAxisScale, type ScaleType } from '../shared/charts/getYAxisScale';
14
16
 
15
17
  interface PrevalenceOverTimeLineChartProps {
16
18
  data: PrevalenceOverTimeData;
17
19
  yAxisScaleType: ScaleType;
18
20
  confidenceIntervalMethod: ConfidenceIntervalMethod;
21
+ yAxisMaxConfig: YAxisMaxConfig;
19
22
  }
20
23
 
21
24
  Chart.register(...registerables, LogitScale);
@@ -24,21 +27,34 @@ const PrevalenceOverTimeLineChart = ({
24
27
  data,
25
28
  yAxisScaleType,
26
29
  confidenceIntervalMethod,
30
+ yAxisMaxConfig,
27
31
  }: PrevalenceOverTimeLineChartProps) => {
28
- const datasets = data.map((graphData, index) => getDataset(graphData, index, confidenceIntervalMethod)).flat();
29
- const labels = data[0]?.content.map((dateRange) => dateRange.dateRange?.toString() ?? 'Unknown') || [];
32
+ const nonNullDateRangeData = data.map((variantData) => {
33
+ return {
34
+ content: variantData.content.filter((dataPoint) => dataPoint.dateRange !== null),
35
+ displayName: variantData.displayName,
36
+ };
37
+ });
38
+
39
+ const datasets = nonNullDateRangeData
40
+ .map((graphData, index) => getDataset(graphData, index, confidenceIntervalMethod))
41
+ .flat();
42
+
43
+ const maxY =
44
+ yAxisScaleType !== 'logit'
45
+ ? getYAxisMax(maxInData(nonNullDateRangeData), yAxisMaxConfig?.[yAxisScaleType])
46
+ : undefined;
30
47
 
31
48
  const config: ChartConfiguration = {
32
49
  type: 'line',
33
50
  data: {
34
- labels,
35
51
  datasets,
36
52
  },
37
53
  options: {
38
54
  animation: false,
39
55
  maintainAspectRatio: false,
40
56
  scales: {
41
- y: getYAxisScale(yAxisScaleType),
57
+ y: { ...getYAxisScale(yAxisScaleType), max: maxY },
42
58
  },
43
59
  plugins: {
44
60
  legend: {
@@ -71,9 +87,12 @@ const getDataset = (
71
87
 
72
88
  const getDatasetCIUpper = (prevalenceOverTimeVariant: PrevalenceOverTimeVariantData, dataIndex: number) => ({
73
89
  label: `${prevalenceOverTimeVariant.displayName} CI upper`,
74
- data: prevalenceOverTimeVariant.content.map(
75
- (dataPoint) => wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit,
76
- ),
90
+ data: prevalenceOverTimeVariant.content.map((dataPoint): Datapoint => {
91
+ return {
92
+ y: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit,
93
+ x: dataPoint.dateRange?.toString(),
94
+ };
95
+ }),
77
96
  borderWidth: 0,
78
97
  pointRadius: 0,
79
98
  fill: '+1',
@@ -82,9 +101,12 @@ const getDatasetCIUpper = (prevalenceOverTimeVariant: PrevalenceOverTimeVariantD
82
101
 
83
102
  const getDatasetCILower = (prevalenceOverTimeVariant: PrevalenceOverTimeVariantData, dataIndex: number) => ({
84
103
  label: `${prevalenceOverTimeVariant.displayName} CI lower`,
85
- data: prevalenceOverTimeVariant.content.map(
86
- (dataPoint) => wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
87
- ),
104
+ data: prevalenceOverTimeVariant.content.map((dataPoint): Datapoint => {
105
+ return {
106
+ y: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
107
+ x: dataPoint.dateRange?.toString(),
108
+ };
109
+ }),
88
110
  borderWidth: 0,
89
111
  pointRadius: 0,
90
112
  fill: '-1',
@@ -93,13 +115,29 @@ const getDatasetCILower = (prevalenceOverTimeVariant: PrevalenceOverTimeVariantD
93
115
 
94
116
  const getDatasetLine = (prevalenceOverTimeVariant: PrevalenceOverTimeVariantData, dataIndex: number) => ({
95
117
  label: prevalenceOverTimeVariant.displayName,
96
- data: prevalenceOverTimeVariant.content.map((dataPoint) => dataPoint.prevalence),
118
+ data: prevalenceOverTimeVariant.content.map((dataPoint): Datapoint => {
119
+ const ciLimits = wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total);
120
+
121
+ return {
122
+ y: dataPoint.prevalence,
123
+ x: dataPoint.dateRange?.toString(),
124
+ yCiUpper: ciLimits.upperLimit,
125
+ yCiLower: ciLimits.lowerLimit,
126
+ };
127
+ }),
97
128
  borderWidth: 1,
98
129
  pointRadius: 0,
99
130
  borderColor: singleGraphColorRGBAById(dataIndex),
100
131
  backgroundColor: singleGraphColorRGBAById(dataIndex),
101
132
  });
102
133
 
134
+ interface Datapoint {
135
+ y: number;
136
+ yCiLower?: number;
137
+ yCiUpper?: number;
138
+ x?: string;
139
+ }
140
+
103
141
  const tooltip = (confidenceIntervalMethod?: ConfidenceIntervalMethod) => {
104
142
  const generalConfig = {
105
143
  mode: 'index' as const,
@@ -111,26 +149,18 @@ const tooltip = (confidenceIntervalMethod?: ConfidenceIntervalMethod) => {
111
149
  return {
112
150
  ...generalConfig,
113
151
  filter: ({ datasetIndex }: TooltipItem<'line'>) => {
114
- return datasetIndex % 3 === 1;
152
+ return isNotCiIndex(datasetIndex);
115
153
  },
116
154
  callbacks: {
117
155
  label: (context: TooltipItem<'line'>) => {
118
- if (context.datasetIndex % 3 === 1) {
119
- const value = context.dataset.data[context.dataIndex];
120
- const ciLower = context.dataset.data[context.dataIndex - 1];
121
- const ciUpper = context.dataset.data[context.dataIndex + 1];
122
-
123
- if (
124
- typeof value !== 'number' ||
125
- typeof ciLower !== 'number' ||
126
- typeof ciUpper !== 'number'
127
- ) {
128
- return '';
129
- }
130
-
131
- return confidenceIntervalDataLabel(value, ciLower, ciUpper, context.dataset.label);
132
- }
133
- return context.dataset.label;
156
+ const dataPoint = context.dataset.data[context.dataIndex] as unknown as Datapoint;
157
+
158
+ return confidenceIntervalDataLabel(
159
+ dataPoint.y,
160
+ dataPoint.yCiLower,
161
+ dataPoint.yCiUpper,
162
+ context.dataset.label,
163
+ );
134
164
  },
135
165
  },
136
166
  };
@@ -139,4 +169,8 @@ const tooltip = (confidenceIntervalMethod?: ConfidenceIntervalMethod) => {
139
169
  }
140
170
  };
141
171
 
172
+ function isNotCiIndex(datasetIndex: number) {
173
+ return datasetIndex % 3 === 1;
174
+ }
175
+
142
176
  export default PrevalenceOverTimeLineChart;
@@ -7,9 +7,10 @@ import { formatProportion } from '../shared/table/formatProportion';
7
7
  interface PrevalenceOverTimeTableProps {
8
8
  data: PrevalenceOverTimeData;
9
9
  granularity: TemporalGranularity;
10
+ pageSize: boolean | number;
10
11
  }
11
12
 
12
- const PrevalenceOverTimeTable = ({ data, granularity }: PrevalenceOverTimeTableProps) => {
13
+ const PrevalenceOverTimeTable = ({ data, granularity, pageSize }: PrevalenceOverTimeTableProps) => {
13
14
  const getSplitColumns = (data: PrevalenceOverTimeData) => {
14
15
  return data.map((dataset) => ({
15
16
  name: dataset.displayName,
@@ -40,7 +41,7 @@ const PrevalenceOverTimeTable = ({ data, granularity }: PrevalenceOverTimeTableP
40
41
  return Object.values(dataByHeader).map((row) => Object.values(row));
41
42
  };
42
43
 
43
- return <Table data={getData(data, granularity)} columns={getColumns(data)} pagination={false} />;
44
+ return <Table data={getData(data, granularity)} columns={getColumns(data)} pageSize={pageSize} />;
44
45
  };
45
46
 
46
47
  export default PrevalenceOverTimeTable;
@@ -1,8 +1,8 @@
1
- import denominator from './__mockData__/denominator.json';
2
- import denominatorOneVariant from './__mockData__/denominatorOneVariant.json';
3
- import numeratorEG from './__mockData__/numeratorEG.json';
4
- import numeratorJN1 from './__mockData__/numeratorJN1.json';
5
- import numeratorOneVariant from './__mockData__/numeratorOneVariant.json';
1
+ import denominatorFilter from './__mockData__/denominatorFilter.json';
2
+ import denominatorOneDataset from './__mockData__/denominatorFilterOneDataset.json';
3
+ import numeratorFilterEG from './__mockData__/numeratorFilterEG.json';
4
+ import numeratorFilterJN1 from './__mockData__/numeratorFilterJN1.json';
5
+ import numeratorOneDataset from './__mockData__/numeratorFilterOneDataset.json';
6
6
  import { PrevalenceOverTime, type PrevalenceOverTimeProps } from './prevalence-over-time';
7
7
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
8
8
  import { LapisUrlContext } from '../LapisUrlContext';
@@ -32,6 +32,8 @@ export default {
32
32
  width: { control: 'text' },
33
33
  height: { control: 'text' },
34
34
  headline: { control: 'text' },
35
+ pageSize: { control: 'object' },
36
+ yAxisMaxConfig: { control: 'object' },
35
37
  },
36
38
  };
37
39
 
@@ -39,8 +41,8 @@ const Template = {
39
41
  render: (args: PrevalenceOverTimeProps) => (
40
42
  <LapisUrlContext.Provider value={LAPIS_URL}>
41
43
  <PrevalenceOverTime
42
- numerator={args.numerator}
43
- denominator={args.denominator}
44
+ numeratorFilter={args.numeratorFilter}
45
+ denominatorFilter={args.denominatorFilter}
44
46
  granularity={args.granularity}
45
47
  smoothingWindow={args.smoothingWindow}
46
48
  views={args.views}
@@ -49,6 +51,8 @@ const Template = {
49
51
  height={args.height}
50
52
  headline={args.headline}
51
53
  lapisDateField={args.lapisDateField}
54
+ pageSize={args.pageSize}
55
+ yAxisMaxConfig={args.yAxisMaxConfig}
52
56
  />
53
57
  </LapisUrlContext.Provider>
54
58
  ),
@@ -57,11 +61,11 @@ const Template = {
57
61
  export const TwoVariants = {
58
62
  ...Template,
59
63
  args: {
60
- numerator: [
64
+ numeratorFilter: [
61
65
  { displayName: 'EG', lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' } },
62
66
  { displayName: 'JN.1', lapisFilter: { country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' } },
63
67
  ],
64
- denominator: { country: 'USA', dateFrom: '2023-01-01' },
68
+ denominatorFilter: { country: 'USA', dateFrom: '2023-01-01' },
65
69
  granularity: 'month',
66
70
  smoothingWindow: 0,
67
71
  views: ['bar', 'line', 'bubble', 'table'],
@@ -70,6 +74,11 @@ export const TwoVariants = {
70
74
  height: '700px',
71
75
  headline: 'Prevalence over time',
72
76
  lapisDateField: 'date',
77
+ pageSize: 10,
78
+ yAxisMaxConfig: {
79
+ linear: 1,
80
+ logarithmic: 1,
81
+ },
73
82
  },
74
83
  parameters: {
75
84
  fetchMock: {
@@ -87,7 +96,7 @@ export const TwoVariants = {
87
96
  },
88
97
  response: {
89
98
  status: 200,
90
- body: numeratorEG,
99
+ body: numeratorFilterEG,
91
100
  },
92
101
  },
93
102
  {
@@ -103,7 +112,7 @@ export const TwoVariants = {
103
112
  },
104
113
  response: {
105
114
  status: 200,
106
- body: numeratorJN1,
115
+ body: numeratorFilterJN1,
107
116
  },
108
117
  },
109
118
  {
@@ -118,7 +127,7 @@ export const TwoVariants = {
118
127
  },
119
128
  response: {
120
129
  status: 200,
121
- body: denominator,
130
+ body: denominatorFilter,
122
131
  },
123
132
  },
124
133
  ],
@@ -129,11 +138,11 @@ export const TwoVariants = {
129
138
  export const OneVariant = {
130
139
  ...Template,
131
140
  args: {
132
- numerator: {
141
+ numeratorFilter: {
133
142
  displayName: 'EG',
134
143
  lapisFilter: { country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
135
144
  },
136
- denominator: { country: 'USA', dateFrom: '2023-10-01' },
145
+ denominatorFilter: { country: 'USA', dateFrom: '2023-10-01' },
137
146
  granularity: 'day',
138
147
  smoothingWindow: 7,
139
148
  views: ['bar', 'line', 'bubble', 'table'],
@@ -142,6 +151,11 @@ export const OneVariant = {
142
151
  height: '700px',
143
152
  headline: 'Prevalence over time',
144
153
  lapisDateField: 'date',
154
+ pageSize: 10,
155
+ yAxisMaxConfig: {
156
+ linear: 1,
157
+ logarithmic: 1,
158
+ },
145
159
  },
146
160
  parameters: {
147
161
  fetchMock: {
@@ -159,7 +173,7 @@ export const OneVariant = {
159
173
  },
160
174
  response: {
161
175
  status: 200,
162
- body: numeratorOneVariant,
176
+ body: numeratorOneDataset,
163
177
  },
164
178
  },
165
179
  {
@@ -174,7 +188,7 @@ export const OneVariant = {
174
188
  },
175
189
  response: {
176
190
  status: 200,
177
- body: denominatorOneVariant,
191
+ body: denominatorOneDataset,
178
192
  },
179
193
  },
180
194
  ],