forked from Canner/WrenAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwaterfall_chart_fix.json
More file actions
86 lines (86 loc) · 3.59 KB
/
Copy pathwaterfall_chart_fix.json
File metadata and controls
86 lines (86 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
"reasoning": "用户明确要求生成疗效评估瀑布图,瀑布图是最佳选择。瀑布图能清晰展示每个受试者肿瘤大小的百分比变化(PERCENT_CHANGE),并通过颜色区分不同总体反应(OVERALL_RESPONSE)。根据SQL查询结果,数据已按PERCENT_CHANGE升序排列,适合直接用于瀑布图。样本数据显示PERCENT_CHANGE范围从-79.6%到37.0%,OVERALL_RESPONSE包含PR(部分缓解)、SD(疾病稳定)和PD(疾病进展)三种类型,需要用不同颜色编码。",
"chart_type": "waterfall",
"title": "肿瘤大小变化百分比瀑布图(按疗效分类)",
"chart_schema": {
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "疗效评估瀑布图",
"data": {
"values": [
{"SUBJID": "WD-087", "PERCENT_CHANGE": -11.0, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-048", "PERCENT_CHANGE": 0.0, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-022", "PERCENT_CHANGE": 0.0, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-060", "PERCENT_CHANGE": 10.9, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-054", "PERCENT_CHANGE": -15.6, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-031", "PERCENT_CHANGE": -74.8, "OVERALL_RESPONSE": "PR"},
{"SUBJID": "WD-051", "PERCENT_CHANGE": -79.6, "OVERALL_RESPONSE": "PR"},
{"SUBJID": "WD-075", "PERCENT_CHANGE": 37.0, "OVERALL_RESPONSE": "PD"},
{"SUBJID": "WD-065", "PERCENT_CHANGE": 0.0, "OVERALL_RESPONSE": "PD"},
{"SUBJID": "WD-035", "PERCENT_CHANGE": -6.2, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-059", "PERCENT_CHANGE": 0.7, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-089", "PERCENT_CHANGE": 0.0, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-045", "PERCENT_CHANGE": 11.2, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-003", "PERCENT_CHANGE": 13.6, "OVERALL_RESPONSE": "SD"},
{"SUBJID": "WD-063", "PERCENT_CHANGE": 0.0, "OVERALL_RESPONSE": "PD"}
]
},
"transform": [
{
"window": [
{"op": "sum", "field": "PERCENT_CHANGE", "as": "cumulative_sum"}
],
"sort": [{"field": "PERCENT_CHANGE", "order": "ascending"}]
},
{
"calculate": "datum.cumulative_sum - datum.PERCENT_CHANGE",
"as": "previous_sum"
},
{
"calculate": "datum.PERCENT_CHANGE >= 0 ? datum.previous_sum : datum.cumulative_sum",
"as": "y_start"
},
{
"calculate": "datum.PERCENT_CHANGE >= 0 ? datum.cumulative_sum : datum.previous_sum",
"as": "y_end"
}
],
"mark": {
"type": "bar",
"cornerRadius": 2
},
"encoding": {
"x": {
"field": "SUBJID",
"type": "nominal",
"sort": {"field": "PERCENT_CHANGE", "order": "ascending"},
"axis": {"title": "受试者ID", "labelAngle": -45}
},
"y": {
"field": "y_start",
"type": "quantitative",
"axis": {"title": "肿瘤大小变化百分比 (%)"}
},
"y2": {
"field": "y_end"
},
"color": {
"field": "OVERALL_RESPONSE",
"type": "nominal",
"scale": {
"domain": ["PR", "SD", "PD"],
"range": ["#2ca02c", "#1f77b4", "#d62728"]
},
"legend": {"title": "总体反应"}
},
"tooltip": [
{"field": "SUBJID", "title": "受试者ID"},
{"field": "PERCENT_CHANGE", "title": "变化百分比", "format": ".1f"},
{"field": "OVERALL_RESPONSE", "title": "疗效评估"}
]
},
"config": {
"view": {"stroke": "transparent"},
"axis": {"grid": false}
}
}
}