Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some_update #24

Merged
merged 2 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified public/data/proteinTable.json.gz
Binary file not shown.
100 changes: 60 additions & 40 deletions src/components/AeShow/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const tagsTotal = [
"heart",
"stomach",
//"skin",
//"blood plasma",
"blood plasma",
"brain",
"kidney",
"liver",
Expand All @@ -94,7 +94,38 @@ const tagsTotal = [
"colon",
"esophagus",
"placenta",
]
]
//
const boxTooltips = {
trigger: 'item',
axisPointer: {
type: 'shadow'
},
textStyle: {},
formatter: function (param) {
return [
"<div style='margin-bottom:5px;width:100%;border-radius:3px;text-align:center;family'><p>" +
param.data[0] +
' </p></div>',
'<hr size=1 style="margin: 3px 0">',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Max:</span>" +
parseFloat(param.data[5]).toFixed(2) +
'<br/>',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Q3:</span>" +
parseFloat(param.data[4]).toFixed(2) +
'<br/>',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Median:</span>" +
parseFloat(param.data[3]).toFixed(2) +
'<br/>',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Q1:</span>" +
parseFloat(param.data[2]).toFixed(2) +
'<br/>',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Min:</span>" +
parseFloat(param.data[1]).toFixed(2) +
'<br/>'
].join('')
}
}
protein.value = Array.isArray(router.currentRoute.value.query.protein) ? router.currentRoute.value.query.protein : [router.currentRoute.value.query.protein]
routerName.value = router.currentRoute.value.name
// get proteins
Expand Down Expand Up @@ -224,36 +255,7 @@ const options = {
],
dataset: [
],
tooltip: {
trigger: 'item',
axisPointer: {
type: 'shadow'
},
textStyle: {},
formatter: function (param) {
return [
"<div style='margin-bottom:5px;width:100%;border-radius:3px;text-align:center;family'><p>" +
param.data[0] +
' </p></div>',
'<hr size=1 style="margin: 3px 0">',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Max:</span>" +
parseFloat(param.data[5]).toFixed(2) +
'<br/>',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Q3:</span>" +
parseFloat(param.data[4]).toFixed(2) +
'<br/>',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Median:</span>" +
parseFloat(param.data[3]).toFixed(2) +
'<br/>',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Q1:</span>" +
parseFloat(param.data[2]).toFixed(2) +
'<br/>',
"<span style='text-align:left;color:#8f9a7a;margin-right:15px;'>Min:</span>" +
parseFloat(param.data[1]).toFixed(2) +
'<br/>'
].join('')
}
},
tooltip: {},
// color: tagsColor,
legend: {
show: true,
Expand Down Expand Up @@ -318,8 +320,7 @@ const init = () => {
text: dataHistory.value[0].title,
left: 'center'
})
//console.log(neatData,tags)
let data = countSingleValue(neatData,2)
let { samples,data } = countSingleValue(neatData,2)
if (showBar.value) {
options.series.push(
{
Expand All @@ -331,7 +332,14 @@ const init = () => {
color0: '#FA0000',
borderColor: '#030609',
borderColor0: '#030609',
},
label: {
show: true,
position: 'right',
formatter: function () {
return `samples: ${samples.shift()}`
}
}
}
)
options.tooltip = {
Expand Down Expand Up @@ -365,12 +373,13 @@ const init = () => {
color0: '#FA0000',
borderColor: '#030609',
borderColor0: '#030609',
},
})
}
})
options.tooltip = boxTooltips
}
} else {
if (routerName.value === 'tissues') {
sortTags.value = sortTags.value.length ===0 ? tagsTotal : sortTags.value
sortTags.value = sortTags.value.length ===0 ? initData(dataHistory.value[0]).tags : sortTags.value
} else {
sortTags.value = sortTags.value.length ===0 ? initData(dataHistory.value[0]).tags : sortTags.value
}
Expand All @@ -393,7 +402,7 @@ const init = () => {
})
datas.push(data)
})
let data = countSingleValue(datas, 3)
let { samples,data } = countSingleValue(datas, 3)
if (showBar.value) {
datas = data
options.dataset = []
Expand All @@ -410,7 +419,14 @@ const init = () => {
color0: '#FA0000',
borderColor: '#030609',
borderColor0: '#030609',
},
label: {
show: true,
position: 'right',
formatter: function () {
return `samples: ${samples[index].shift()}`
}
}
})
options.legend.data.push({
name: proteinTags.value[index],
Expand Down Expand Up @@ -467,6 +483,7 @@ const init = () => {
}
})
})
options.tooltip = boxTooltips
}
}

Expand Down Expand Up @@ -505,8 +522,9 @@ const countSingleValue = (data, dimension) => {
}
return { singleNum, data }
*/
let samples = data.map((arr) => arr.length)
data = data.map((arr) => arr.length > 0 ? Number((arr.reduce((a, b) => a + b) / arr.length).toFixed(2)) : 0)
return data
return { samples,data }
} else {
/*
let singleNum = data[0].filter((arr) => arr.length == 1).length
Expand All @@ -515,10 +533,12 @@ const countSingleValue = (data, dimension) => {
}
return { singleNum, data }
*/
let samples = data.map((res) => res.map((arr) => arr.length))
data = data.map((res) => res.map((arr) => arr.length > 0 ? Number((arr.reduce((a, b) => a + b) / arr.length).toFixed(2)) : 0))
return data
return { samples,data }
}
}

//
const changeShow = () => {
init()
Expand Down
Loading