🐛 Fix standard deviation is not showing correctly in dps line chart again

This commit is contained in:
Stēlla Caerulea 2023-12-05 17:57:30 +08:00 committed by 洛水居室
parent 768229ecdc
commit 970e59bb7a
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 65 additions and 59 deletions

View File

@ -64,12 +64,69 @@ class GCSimResultRenderer:
] ]
result["extra"]["damage"] = { result["extra"]["damage"] = {
"xAxis": [i * 0.5 for i in range(len(result["statistics"]["damage_buckets"]["buckets"]))], "xAxis": [i * 0.5 for i in range(len(result["statistics"]["damage_buckets"]["buckets"]))],
"data": { "series": [
"mean": [bucket["mean"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], {
"min": [bucket["min"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], "data": [bucket["mean"] for bucket in result["statistics"]["damage_buckets"]["buckets"]],
"max": [bucket["max"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], "type": "line",
"sd": [bucket["sd"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], "symbol": "none",
}, "color": "#66ccff",
"name": "平均伤害",
},
{
"data": [bucket["min"] for bucket in result["statistics"]["damage_buckets"]["buckets"]],
"type": "line",
"lineStyle": {
"opacity": 0,
},
"stack": "area",
"symbol": "none",
},
{
"data": [
max(0, bucket["mean"] - bucket["sd"])
for bucket in result["statistics"]["damage_buckets"]["buckets"]
],
"type": "line",
"lineStyle": {"opacity": 0},
"stack": "cofidence-band",
"symbol": "none",
},
{
"data": [
min(bucket["mean"], bucket["sd"]) + bucket["sd"]
for bucket in result["statistics"]["damage_buckets"]["buckets"]
],
"type": "line",
"lineStyle": {
"opacity": 0,
},
"areaStyle": {
"opacity": 0.5,
"color": "#4c9bd4",
},
"stack": "cofidence-band",
"symbol": "none",
"color": "#4c9bd4",
"name": "标准差",
},
{
"data": [
bucket["max"] - bucket["min"] for bucket in result["statistics"]["damage_buckets"]["buckets"]
],
"type": "line",
"lineStyle": {
"opacity": 0,
},
"areaStyle": {
"opacity": 0.25,
"color": "#a5cde9",
},
"stack": "area",
"symbol": "none",
"color": "#a5cde9",
"name": "极值",
},
],
} }
return result return result

View File

@ -101,58 +101,7 @@
color: 'white' color: 'white'
}, },
}, },
series: [ series: data["damage"]["series"],
{
data: data["damage"]["data"]["mean"],
type: "line",
lineStyle: {
},
showSymbol: false,
name: "平均伤害",
},
{
data: data["damage"]["data"]["min"],
type: "line",
lineStyle: {
opacity: 0.5,
},
showSymbol: false,
name: "最小伤害",
},
{
data: data["damage"]["data"]["max"],
type: "line",
lineStyle: {
opacity: 0.5,
},
showSymbol: false,
name: "最大伤害",
},
{
type: "line",
data: data["damage"]["data"]["mean"].map((mean, idx) => mean - data["damage"]["data"]["sd"][idx] < 0 ? mean + data["damage"]["data"]["sd"][idx] : 2 * data["damage"]["data"]["sd"][idx]),
stack: 'confidence-band',
stackStrategy: 'positive',
lineStyle: {
opacity: 0
},
symbol: 'none',
},
{
type: "line",
data: data["damage"]["data"]["mean"].map((mean, idx) => mean - data["damage"]["data"]["sd"][idx] < 0 ? 0 : mean - data["damage"]["data"]["sd"][idx]),
stack: 'confidence-band',
stackStrategy: 'positive',
lineStyle: {
opacity: 0
},
areaStyle: {
opacity: 0.18,
color: '#4c9bd4'
},
symbol: 'none',
},
],
animation: false animation: false
}); });
</script> </script>
@ -160,4 +109,4 @@
</body> </body>
</html> </html>