Skip to content

Commit 12b4b7f

Browse files
- ADD: Added categorical trait timeline chart.
- FIX: Fixed media filename format bits not being stored. - CHG: Updated timeline example trial by adding a categorical data timeseries trait. -
1 parent 95ae21f commit 12b4b7f

16 files changed

Lines changed: 44 additions & 20 deletions

public/data/timeline.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/components/chart/PlotTraitCompletionChart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
},
164164
shapes: [] as any[],
165165
annotations: [] as any[],
166-
legend: { orientation: 'h', font: { color: store.storeIsDarkMode ? 'white' : 'black' } },
166+
legend: { orientation: 'h', y: 1.1, font: { color: store.storeIsDarkMode ? 'white' : 'black' } },
167167
}
168168
169169
if (compProps.trial.events && compProps.trial.events.length > 0) {

src/components/chart/TraitDatapointCountChart.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import { getTrialDataCached } from '@/plugins/datastore'
2323
import type { DownloadBlob } from '@/plugins/file'
2424
import { getId } from '@/plugins/id'
25-
import type { CellPlus, TraitPlus, TrialPlus } from '@/plugins/types/client'
25+
import type { CellPlus, TrialPlus } from '@/plugins/types/client'
2626
import { toLocalDateString } from '@/plugins/util'
2727
import { mdiChartBellCurveCumulative } from '@mdi/js'
2828
import emitter from 'tiny-emitter/instance'
@@ -154,7 +154,7 @@
154154
},
155155
shapes: [] as any[],
156156
annotations: [] as any[],
157-
legend: { orientation: 'h', font: { color: store.storeIsDarkMode ? 'white' : 'black' } },
157+
legend: { orientation: 'h', y: 1.1, font: { color: store.storeIsDarkMode ? 'white' : 'black' } },
158158
}
159159
160160
if (compProps.trial.events && compProps.trial.events.length > 0) {

src/components/chart/TraitTimelineChart.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import { coreStore } from '@/stores/app'
3636
import { useI18n } from 'vue-i18n'
3737
import type { UserSelection } from '@/components/util/HighlightSelect.vue'
38-
import { CellCategory } from '@/plugins/types/gridscore'
38+
import { CellCategory, TraitDataType } from '@/plugins/types/gridscore'
3939
4040
// Only register the chart types we're actually using to reduce the final bundle size
4141
Plotly.register([
@@ -98,6 +98,7 @@
9898
})
9999
100100
const sortedDates = [...allDates].sort((a, b) => a - b)
101+
const isCategorical = compProps.trait.dataType === TraitDataType.categorical
101102
102103
let selectedItems: string[] = []
103104
const datapoints: { [index: string]: (number | null)[] } = {}
@@ -158,7 +159,7 @@
158159
const timeIndex = sortedDates.indexOf(time)
159160
160161
const existingValues = m.values.filter(v => v !== undefined && v !== null)
161-
const avg = existingValues.length > 0 ? existingValues.reduce((acc, val) => acc + (+val), 0) / existingValues.length : 0
162+
const avg = existingValues.length > 0 ? existingValues.reduce((acc: number, val) => acc + (+val), 0) / existingValues.length : 0
162163
163164
// Update statistics
164165
if (avg !== undefined) {
@@ -248,6 +249,9 @@
248249
title: { text: compProps.trait.name, font: { color: store.storeIsDarkMode ? 'white' : 'black' } },
249250
tickfont: { color: store.storeIsDarkMode ? 'white' : 'black' },
250251
fixedrange: !interactive.value,
252+
tickmode: isCategorical ? 'array' : undefined,
253+
tickvals: isCategorical ? compProps.trait.restrictions?.categories?.map((c, i) => i) : undefined,
254+
ticktext: isCategorical ? compProps.trait.restrictions?.categories : undefined,
251255
},
252256
shapes: [] as any[],
253257
annotations: [] as any[],

src/components/inputs/CellAutocomplete.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
clearable
1515
:readonly="abortController !== undefined"
1616
:multiple="multiple"
17-
:chips="multiple"
1817
:min-width="minWidth"
1918
:max-width="maxWidth"
2019
autocomplete="off"
@@ -32,6 +31,13 @@
3231
<v-btn :icon="mdiNfcVariant" v-tooltip:top="$t('tooltipScanRFID')" @click="scanNfc" :color="abortController !== undefined ? 'info' : undefined" />
3332
</template>
3433

34+
<template #selection="{ item, index }" v-if="multiple">
35+
<v-chip size="small" v-if="index < 5" :text="item.title" />
36+
37+
<!-- @vue-ignore -->
38+
<span v-if="index === 5" class="text-grey text-caption align-self-center">{{ $t('formDetailsItemSelectOther', (searchMatch || []).length - 5) }}</span>
39+
</template>
40+
3541
<template #item="{ props, item }">
3642
<v-list-item
3743
v-bind="props"

src/components/inputs/GermplasmAutocomplete.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
clearable
1313
:readonly="abortController !== undefined"
1414
:multiple="multiple"
15-
:chips="multiple"
1615
:min-width="minWidth"
1716
:max-width="maxWidth"
1817
autocomplete="off"
@@ -30,6 +29,12 @@
3029
<v-btn :icon="mdiNfcVariant" v-tooltip:top="$t('tooltipScanRFID')" @click="scanNfc" :color="abortController !== undefined ? 'info' : undefined" />
3130
</template>
3231

32+
<template #selection="{ item, index }" v-if="multiple">
33+
<v-chip size="small" v-if="index < 5" :text="item.title" />
34+
35+
<span v-if="index === 5" class="text-grey text-caption align-self-center">{{ $t('formDetailsItemSelectOther', (searchMatch || []).length - 5) }}</span>
36+
</template>
37+
3338
<template #item="{ props, item }">
3439
<v-list-item
3540
v-bind="props"

src/components/modals/ServerMessageModal.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
if (newValue.length > 0) {
131131
dialog.value = true
132132
133+
emitter.emit('plausible-event', { key: 'server-messages-shown', props: { date: newValue[newValue.length - 1]?.date } })
134+
133135
store.setServerMessagesCheckedOn(new Date().toISOString().split('T')[0])
134136
}
135137
})

src/components/modals/UpdateTrialDataModal.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,14 @@
175175
}
176176
timestamp = timestamp.toISOString()
177177
178-
const values: (string | undefined)[] = []
178+
const values: (string | number | undefined)[] = []
179179
const parts = trait.setSize === 1 ? [row.Value] : (row.Value || '').split(',').map(v => v.trim())
180180
181181
for (const part of parts) {
182182
if (part !== undefined && part !== null && part !== '') {
183183
if (trait.dataType === TraitDataType.categorical && trait.restrictions && trait.restrictions.categories) {
184184
const index = trait.restrictions.categories.indexOf(part)
185-
values.push(`${index}`)
185+
values.push(index)
186186
} else {
187187
values.push(part)
188188
}

src/components/trait/TraitSelect.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
item-value="id"
99
item-title="name"
1010
:multiple="multiple"
11-
:chips="multiple"
1211
clearable
1312
:label="$t(label)"
1413
:hint="$t(hint)"
@@ -19,10 +18,12 @@
1918
<template #prepend><v-icon :color="item.raw.color" :icon="store.storeCanvasShape === CanvasShape.SQUARE ? mdiSquare : mdiCircle" /></template>
2019
</v-list-item>
2120
</template>
22-
<template #selection="{ item }">
23-
<v-list-item slim :title="item.raw.name">
24-
<template #prepend><v-icon :color="item.raw.color" :icon="store.storeCanvasShape === CanvasShape.SQUARE ? mdiSquare : mdiCircle" /></template>
25-
</v-list-item>
21+
22+
<template #selection="{ item, index }" v-if="multiple">
23+
<v-chip size="small" v-if="index < 5" :text="item.title" />
24+
25+
<!-- @vue-ignore -->
26+
<span v-if="index === 5" class="text-grey text-caption align-self-center">{{ $t('formDetailsItemSelectOther', (selectedTraits || []).length - 5) }}</span>
2627
</template>
2728
</v-select>
2829
</template>

src/components/trial/TrialCreation.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@
316316
name: t.name,
317317
description: t.description,
318318
group: t.group,
319+
mediaFilenameFormat: t.mediaFilenameFormat,
319320
markers: t.layout.markers,
320321
corners: t.layout.corners,
321322
traits: t.traits,

0 commit comments

Comments
 (0)