@genspectrum/dashboard-components 0.15.0 → 0.16.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.
- package/custom-elements.json +200 -56
- package/dist/components.d.ts +35 -35
- package/dist/components.js +311 -192
- package/dist/components.js.map +1 -1
- package/dist/style.css +9 -0
- package/dist/util.d.ts +46 -46
- package/package.json +1 -1
- package/src/preact/ReferenceGenomeContext.ts +14 -1
- package/src/preact/aggregatedData/aggregate-bar-chart.tsx +26 -5
- package/src/preact/aggregatedData/aggregate.stories.tsx +0 -1
- package/src/preact/aggregatedData/aggregate.tsx +5 -1
- package/src/preact/components/ReferenceGenomesAwaiter.tsx +1 -6
- package/src/preact/components/resize-container.tsx +1 -1
- package/src/preact/mutationComparison/mutation-comparison-venn.tsx +4 -2
- package/src/preact/mutationComparison/mutation-comparison.stories.tsx +0 -1
- package/src/preact/mutationComparison/mutation-comparison.tsx +5 -1
- package/src/preact/mutationFilter/mutation-filter.stories.tsx +17 -1
- package/src/preact/mutationFilter/mutation-filter.tsx +8 -0
- package/src/preact/mutations/mutations.stories.tsx +0 -1
- package/src/preact/mutations/mutations.tsx +1 -1
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +0 -2
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -1
- package/src/preact/numberSequencesOverTime/number-sequences-over-time-bar-chart.tsx +8 -3
- package/src/preact/numberSequencesOverTime/number-sequences-over-time-line-chart.tsx +8 -3
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +3 -1
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +18 -3
- package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +48 -35
- package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +83 -70
- package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +48 -37
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +0 -3
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +6 -1
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +31 -23
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +0 -1
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +5 -1
- package/src/preact/sequencesByLocation/__mockData__/worldAtlas.json +1 -0
- package/src/preact/{map → sequencesByLocation}/sequences-by-location-map.tsx +6 -3
- package/src/preact/{map → sequencesByLocation}/sequences-by-location-table.tsx +1 -1
- package/src/preact/{map → sequencesByLocation}/sequences-by-location.stories.tsx +58 -1
- package/src/preact/{map → sequencesByLocation}/sequences-by-location.tsx +10 -1
- package/src/preact/shared/aspectRatio/AspectRatio.tsx +13 -0
- package/src/preact/shared/charts/getMaintainAspectRatio.ts +3 -0
- package/src/preact/statistic/statistics.stories.tsx +0 -1
- package/src/preact/statistic/statistics.tsx +4 -4
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +0 -1
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.tsx +1 -1
- package/src/query/computeMapLocationData.spec.ts +1 -1
- package/src/query/computeMapLocationData.ts +1 -1
- package/src/query/querySequencesByLocationData.ts +1 -1
- package/src/utilEntrypoint.ts +1 -1
- package/src/web-components/ResizeContainer.mdx +4 -1
- package/src/web-components/visualization/gs-aggregate.stories.ts +13 -6
- package/src/web-components/visualization/gs-aggregate.tsx +1 -1
- package/src/web-components/visualization/gs-mutation-comparison.stories.ts +8 -1
- package/src/web-components/visualization/gs-mutation-comparison.tsx +1 -1
- package/src/web-components/visualization/gs-mutations-over-time.stories.ts +9 -1
- package/src/web-components/visualization/gs-mutations-over-time.tsx +1 -1
- package/src/web-components/visualization/gs-mutations.stories.ts +8 -1
- package/src/web-components/visualization/gs-mutations.tsx +1 -1
- package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +11 -1
- package/src/web-components/visualization/gs-number-sequences-over-time.tsx +1 -1
- package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +8 -2
- package/src/web-components/visualization/gs-prevalence-over-time.tsx +1 -1
- package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +8 -1
- package/src/web-components/visualization/gs-relative-growth-advantage.tsx +1 -1
- package/src/web-components/visualization/gs-sequences-by-location.stories.ts +13 -7
- package/src/web-components/visualization/gs-sequences-by-location.tsx +6 -3
- package/src/web-components/visualization/gs-statistics.stories.ts +0 -1
- package/src/web-components/visualization/gs-statistics.tsx +1 -1
- package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.stories.ts +9 -1
- package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +1 -1
- package/standalone-bundle/dashboard-components.js +4965 -4876
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/standalone-bundle/style.css +1 -1
- package/src/preact/map/__mockData__/worldAtlas.json +0 -497127
- /package/src/preact/{map → sequencesByLocation}/__mockData__/aggregatedGermany.json +0 -0
- /package/src/preact/{map → sequencesByLocation}/__mockData__/aggregatedWorld.json +0 -0
- /package/src/preact/{map → sequencesByLocation}/__mockData__/germanyMap.json +0 -0
- /package/src/preact/{map → sequencesByLocation}/__mockData__/howToGenerateWorldMap.md +0 -0
- /package/src/preact/{map → sequencesByLocation}/leafletStyleModifications.css +0 -0
- /package/src/preact/{map → sequencesByLocation}/loadMapSource.tsx +0 -0
|
@@ -21,6 +21,7 @@ import { ResizeContainer } from '../components/resize-container';
|
|
|
21
21
|
import { ScalingSelector } from '../components/scaling-selector';
|
|
22
22
|
import Tabs from '../components/tabs';
|
|
23
23
|
import { type ConfidenceIntervalMethod, confidenceIntervalMethodSchema } from '../shared/charts/confideceInterval';
|
|
24
|
+
import { getMaintainAspectRatio } from '../shared/charts/getMaintainAspectRatio';
|
|
24
25
|
import { axisMaxSchema } from '../shared/charts/getYAxisMax';
|
|
25
26
|
import { type ScaleType } from '../shared/charts/getYAxisScale';
|
|
26
27
|
import { useQuery } from '../useQuery';
|
|
@@ -35,7 +36,7 @@ export type PrevalenceOverTimeView = z.infer<typeof prevalenceOverTimeViewSchema
|
|
|
35
36
|
|
|
36
37
|
const prevalenceOverTimePropsSchema = z.object({
|
|
37
38
|
width: z.string(),
|
|
38
|
-
height: z.string(),
|
|
39
|
+
height: z.string().optional(),
|
|
39
40
|
numeratorFilters: z.array(namedLapisFilterSchema).min(1),
|
|
40
41
|
denominatorFilter: lapisFilterSchema,
|
|
41
42
|
granularity: temporalGranularitySchema,
|
|
@@ -117,6 +118,7 @@ const PrevalenceOverTimeTabs: FunctionComponent<PrevalenceOverTimeTabsProps> = (
|
|
|
117
118
|
}, [confidenceIntervalMethods]);
|
|
118
119
|
|
|
119
120
|
const yAxisMaxConfig = { linear: yAxisMaxLinear, logarithmic: yAxisMaxLogarithmic };
|
|
121
|
+
const maintainAspectRatio = getMaintainAspectRatio(componentProps.height);
|
|
120
122
|
|
|
121
123
|
const getTab = (view: PrevalenceOverTimeView) => {
|
|
122
124
|
switch (view) {
|
|
@@ -129,6 +131,7 @@ const PrevalenceOverTimeTabs: FunctionComponent<PrevalenceOverTimeTabsProps> = (
|
|
|
129
131
|
yAxisScaleType={yAxisScaleType}
|
|
130
132
|
confidenceIntervalMethod={confidenceIntervalMethod}
|
|
131
133
|
yAxisMaxConfig={yAxisMaxConfig}
|
|
134
|
+
maintainAspectRatio={maintainAspectRatio}
|
|
132
135
|
/>
|
|
133
136
|
),
|
|
134
137
|
};
|
|
@@ -141,6 +144,7 @@ const PrevalenceOverTimeTabs: FunctionComponent<PrevalenceOverTimeTabsProps> = (
|
|
|
141
144
|
yAxisScaleType={yAxisScaleType}
|
|
142
145
|
confidenceIntervalMethod={confidenceIntervalMethod}
|
|
143
146
|
yAxisMaxConfig={yAxisMaxConfig}
|
|
147
|
+
maintainAspectRatio={maintainAspectRatio}
|
|
144
148
|
/>
|
|
145
149
|
),
|
|
146
150
|
};
|
|
@@ -152,6 +156,7 @@ const PrevalenceOverTimeTabs: FunctionComponent<PrevalenceOverTimeTabsProps> = (
|
|
|
152
156
|
data={data}
|
|
153
157
|
yAxisScaleType={yAxisScaleType}
|
|
154
158
|
yAxisMaxConfig={yAxisMaxConfig}
|
|
159
|
+
maintainAspectRatio={maintainAspectRatio}
|
|
155
160
|
/>
|
|
156
161
|
),
|
|
157
162
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Chart, type ChartConfiguration, registerables, type TooltipItem } from 'chart.js';
|
|
2
|
+
import { useMemo } from 'preact/hooks';
|
|
2
3
|
|
|
3
4
|
import { type YearMonthDayClass } from '../../utils/temporalClass';
|
|
4
5
|
import GsChart from '../components/chart';
|
|
@@ -28,37 +29,44 @@ interface RelativeGrowthAdvantageChartProps {
|
|
|
28
29
|
data: RelativeGrowthAdvantageChartData;
|
|
29
30
|
yAxisScaleType: ScaleType;
|
|
30
31
|
yAxisMaxConfig: YAxisMaxConfig;
|
|
32
|
+
maintainAspectRatio: boolean;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
Chart.register(...registerables, LogitScale);
|
|
34
36
|
|
|
35
|
-
const RelativeGrowthAdvantageChart = ({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const RelativeGrowthAdvantageChart = ({
|
|
38
|
+
data,
|
|
39
|
+
yAxisScaleType,
|
|
40
|
+
yAxisMaxConfig,
|
|
41
|
+
maintainAspectRatio,
|
|
42
|
+
}: RelativeGrowthAdvantageChartProps) => {
|
|
43
|
+
const config = useMemo<ChartConfiguration>(() => {
|
|
44
|
+
const maxY =
|
|
45
|
+
yAxisScaleType !== 'logit'
|
|
46
|
+
? getYAxisMax(Math.max(...data.proportion), yAxisMaxConfig?.[yAxisScaleType])
|
|
47
|
+
: undefined;
|
|
40
48
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
options: {
|
|
48
|
-
maintainAspectRatio: false,
|
|
49
|
-
animation: false,
|
|
50
|
-
|
|
51
|
-
scales: {
|
|
52
|
-
y: { ...getYAxisScale(yAxisScaleType), max: maxY },
|
|
49
|
+
return {
|
|
50
|
+
type: 'line',
|
|
51
|
+
data: {
|
|
52
|
+
labels: data.t,
|
|
53
|
+
datasets: datasets(data),
|
|
53
54
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
options: {
|
|
56
|
+
maintainAspectRatio,
|
|
57
|
+
animation: false,
|
|
58
|
+
scales: {
|
|
59
|
+
y: { ...getYAxisScale(yAxisScaleType), max: maxY },
|
|
60
|
+
},
|
|
61
|
+
plugins: {
|
|
62
|
+
legend: {
|
|
63
|
+
display: false,
|
|
64
|
+
},
|
|
65
|
+
tooltip: tooltip(),
|
|
57
66
|
},
|
|
58
|
-
tooltip: tooltip(),
|
|
59
67
|
},
|
|
60
|
-
}
|
|
61
|
-
};
|
|
68
|
+
};
|
|
69
|
+
}, [data, yAxisScaleType, yAxisMaxConfig, maintainAspectRatio]);
|
|
62
70
|
|
|
63
71
|
return (
|
|
64
72
|
<div className='flex h-full flex-col'>
|
|
@@ -18,6 +18,7 @@ import { NoDataDisplay } from '../components/no-data-display';
|
|
|
18
18
|
import { ResizeContainer } from '../components/resize-container';
|
|
19
19
|
import { ScalingSelector } from '../components/scaling-selector';
|
|
20
20
|
import Tabs from '../components/tabs';
|
|
21
|
+
import { getMaintainAspectRatio } from '../shared/charts/getMaintainAspectRatio';
|
|
21
22
|
import { axisMaxSchema } from '../shared/charts/getYAxisMax';
|
|
22
23
|
import { type ScaleType } from '../shared/charts/getYAxisScale';
|
|
23
24
|
import { useQuery } from '../useQuery';
|
|
@@ -27,7 +28,7 @@ export type RelativeGrowthAdvantageView = z.infer<typeof relativeGrowthAdvantage
|
|
|
27
28
|
|
|
28
29
|
export const relativeGrowthAdvantagePropsSchema = z.object({
|
|
29
30
|
width: z.string(),
|
|
30
|
-
height: z.string(),
|
|
31
|
+
height: z.string().optional(),
|
|
31
32
|
numeratorFilter: lapisFilterSchema,
|
|
32
33
|
denominatorFilter: lapisFilterSchema,
|
|
33
34
|
generationTime: z.number(),
|
|
@@ -102,6 +103,8 @@ const RelativeGrowthAdvantageTabs: FunctionComponent<RelativeGrowthAdvantageTabs
|
|
|
102
103
|
setYAxisScaleType,
|
|
103
104
|
originalComponentProps,
|
|
104
105
|
}) => {
|
|
106
|
+
const maintainAspectRatio = getMaintainAspectRatio(originalComponentProps.height);
|
|
107
|
+
|
|
105
108
|
const getTab = (view: RelativeGrowthAdvantageView) => {
|
|
106
109
|
switch (view) {
|
|
107
110
|
case 'line':
|
|
@@ -119,6 +122,7 @@ const RelativeGrowthAdvantageTabs: FunctionComponent<RelativeGrowthAdvantageTabs
|
|
|
119
122
|
linear: originalComponentProps.yAxisMaxLinear,
|
|
120
123
|
logarithmic: originalComponentProps.yAxisMaxLogarithmic,
|
|
121
124
|
}}
|
|
125
|
+
maintainAspectRatio={maintainAspectRatio}
|
|
122
126
|
/>
|
|
123
127
|
),
|
|
124
128
|
};
|