Strategies
测试多图表展示Python版
发明者量化-小小梦 · python · Tools and Appendix · 2018-03-30 22:20:34
Context terms
Code summary Auto-extracted · not described by the author
Library / utility: 1 functions, 0 classes; no entry or exit calls detected.
Library / utility
Detected terms
None
Operation terms
None
Code comments
- No comments in English.
62 code lines · 1 functions · 0 classes · 0 parameters
Source code (62 lines)
import random
import time
def main():
cfgA = {
"title" : {"text" : "盘口图表"},
"xAxis" : {
"type" : "datetime"
},
"series" : [{
"name" : "买一",
"data" : [],
},{
"name" : "卖一",
"data" : [],
}]
}
cfgB = {
"title" : {"text" : "差价图"},
"xAxis" : {
"type" : "datetime"
},
"series" : [{
"name" : "差价",
"type" : "column",
"data" : [],
}]
}
cfgC = {
"__isStock" : False,
"title" : {
"text" : "饼图"
},
"series" : [{
"type" : "pie",
"name" : "one",
"data" : [
["A", 25],
["B", 25],
["C", 25],
["D", 25],
]
}]
}
chart = Chart([cfgA, cfgB, cfgC])
chart.reset()
chart.add(3, {
"name" : "ZZ",
"y" : random.random() * 100
})
chart.update([cfgA, cfgB, cfgC])
chart.add(0, [_N(time.time() * 1000, 0), 50])
chart.add(1, [_N(time.time() * 1000, 0), 80])
chart.add(2, [_N(time.time() * 1000, 0), 90])
chart.add(3, {
"name" : "ZZ",
"y" : random.random() * 100
}, -1)