@genspectrum/dashboard-components 0.15.0 → 0.16.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.
- package/custom-elements.json +255 -57
- package/dist/components.d.ts +49 -32
- package/dist/components.js +361 -212
- package/dist/components.js.map +1 -1
- package/dist/style.css +9 -0
- package/dist/util.d.ts +43 -43
- package/package.json +1 -1
- package/src/preact/ReferenceGenomeContext.ts +16 -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/info.tsx +1 -0
- 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/getFilteredMutationsOverTime.spec.ts +70 -14
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +30 -7
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +56 -55
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +26 -39
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +22 -7
- 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/PreactLitAdapter.tsx +2 -5
- package/src/web-components/ResizeContainer.mdx +4 -1
- package/src/web-components/gs-app.ts +2 -4
- 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 +24 -1
- package/src/web-components/visualization/gs-mutations-over-time.tsx +30 -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 +5817 -5706
- 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
|
@@ -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
|
};
|