Skip to content

Commit

Permalink
Sorted filters and added title option to table columns
Browse files Browse the repository at this point in the history
  • Loading branch information
airenzp authored and xzhou82 committed Oct 15, 2024
1 parent b5e56ef commit 704b525
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions client/dom/table.ts
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ export type Column = {
//It is only allowed for cells with a value or a color field
nowrap?: boolean // set white-space=nowrap on all <td> of this column so strings do not wrap
align?: string // left, center, right. If missing it is aligned to the left by default
title?: string //tooltip describing column content
}

export type Button = {
@@ -184,6 +185,7 @@ export function renderTable({
for (const c of columns) {
const th = theadRow.append('th').text(c.label).attr('class', 'sjpp_table_item sjpp_table_header')
if (c.width) th.style('width', c.width)
if (c.title) th.attr('title', c.title)
}

const tbody = table.append('tbody')
15 changes: 13 additions & 2 deletions client/plots/profilePlot.js
Original file line number Diff line number Diff line change
@@ -126,7 +126,8 @@ export class profilePlot {
}

getList(tw) {
const values = Object.values(tw.term.values)
let values = Object.values(tw.term.values)
values.sort((v1, v2) => v1.label.localeCompare(v2.label))
const data = this.filtersData.lst.filter(sample =>
this.samplesPerFilter[tw.term.id].includes(parseInt(sample.sample))
)
@@ -345,6 +346,11 @@ export class profilePlot {
this.sites = this.data.lst.map(s => {
return { label: this.data.refs.bySampleId[s.sample].label, value: s.sample }
})
this.sites.sort((a, b) => {
if (a.label < b.label) return -1
if (a.label > b.label) return 1
return 0
})
this.sites.unshift({ label: '', value: '' })
inputs.push({
label: 'Site',
@@ -381,7 +387,12 @@ export class profilePlot {
this.sites = result.lst.map(s => {
return { label: result.refs.bySampleId[s.sample].label, value: s.sample }
})
if (!this.settings.site) this.settings.site = result.lst[0].sample
this.sites.sort((a, b) => {
if (a.label < b.label) return -1
if (a.label > b.label) return 1
return 0
})
if (!this.settings.site) this.settings.site = this.sites[0].value
this.sampleData = result.samples[Number(this.settings.site)]
}
inputs.unshift({
5 changes: 4 additions & 1 deletion client/plots/profileRadar.js
Original file line number Diff line number Diff line change
@@ -62,7 +62,10 @@ class profileRadar extends profilePlot {
{ label: 'Module' },
{ label: config.term1.abbrev },
{ label: config.term2.abbrev },
{ label: 'Diff' }
{
label: 'Diff',
title: `Difference between ${config.term1.abbrev} and ${config.term2.abbrev}. If bigger than 20, shown in blue if positive and in red if negative.`
}
]

// Create a polar grid.

0 comments on commit 704b525

Please sign in to comment.