diff --git a/plugins/genshin/gcsim/renderer.py b/plugins/genshin/gcsim/renderer.py index 5d105e1..75bc54f 100644 --- a/plugins/genshin/gcsim/renderer.py +++ b/plugins/genshin/gcsim/renderer.py @@ -64,12 +64,69 @@ class GCSimResultRenderer: ] result["extra"]["damage"] = { "xAxis": [i * 0.5 for i in range(len(result["statistics"]["damage_buckets"]["buckets"]))], - "data": { - "mean": [bucket["mean"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], - "min": [bucket["min"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], - "max": [bucket["max"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], - "sd": [bucket["sd"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], - }, + "series": [ + { + "data": [bucket["mean"] for bucket in result["statistics"]["damage_buckets"]["buckets"]], + "type": "line", + "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 diff --git a/resources/genshin/gcsim/result.jinja2 b/resources/genshin/gcsim/result.jinja2 index f2d71fe..9f9b9c1 100644 --- a/resources/genshin/gcsim/result.jinja2 +++ b/resources/genshin/gcsim/result.jinja2 @@ -101,58 +101,7 @@ color: 'white' }, }, - 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', - }, - ], + series: data["damage"]["series"], animation: false }); @@ -160,4 +109,4 @@ - \ No newline at end of file +