欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 新闻 > 会展 > python从入门到精通:数据可视化-图形开发

python从入门到精通:数据可视化-图形开发

2024/12/29 3:20:10 来源:https://blog.csdn.net/2401_83283514/article/details/141570753  浏览:    关键词:python从入门到精通:数据可视化-图形开发

1、json数据格式

• Json是一种轻量级的数据交互格式,可以按照Json指定的格式去组织和封装数据

• Json本质上是一种带有特殊格式的字符串

主要功能:json就是一种在各个编程语言中流通的数据格式,负责不同编程语言中的数据传递和交互,类似于:

• 国际通用语言-英语

• 中国不同名族的通用语言-中文(普通话) 

• 各种编程语言存储数据的容器不尽相同,在python中有字典dict这样的数据类型,而其它语言可能没有对应的字典。为了让不同的语言都能够相互通用的互相传递数据,Json就是一种非常良好的数据中转格式。如下图,以python和C语言相互传数据为例:

• json格式的数据要求很严格:

# json的数据格式可以是:

{"name":"admin","age":18}

# 也可以是:

[{"name":"admin","age":18},{"name":"root","age":16},{"name":"张三":"age":20}] 

• python与json数据的相互转换:

# json数据与python数据的相互转换:
import json
# 准备符合json格式要求的python数据
data = [{"name":"老王","age":36},{"name":"小白","age":18}]
# 通过json.dumps(data)将python数据转化为json数据
data = json.dumps(data, ensure_ascii=False)
print(data)
print(type(data))
# 通过json.loads(data)将json数据转化为python数据
data = json.loads(data)
print(data)
print(type(data))

2、pyecharts模块

• Echarts是由百度公司开源的数据可视化,凭借良好的交互性,精巧的图标设计,得到众多开发者认可。而python是门富有表达力的的语言,很适合用于数据处理,当数据分析遇上数据可视化时pyecharts就诞生了。

• 通过使用pip命令快速安装pyecharts模块

官方画廊网站:官方网址

3、pyecharts入门

• 基础折线图:

# 导包,导入Line功能构建折线图对象
from pyecharts.charts import Line
# 得到折线图对象
line = Line()
# 添加x轴数据
line.add_xaxis(["中国","美国","英国"])
line.add_yaxis("GDP",[30,20,10])
# 生成图表
line.render()

 • pyecharts模块中有很多配置选项,常用到两个类别的选项:

1、全局配置选项

2、系列配置选项

• 全局配置选项可以通过set_global_opts方法来进行配置,相应的选项和选线那个的功能:

 set_global_opts方法:

from pyecharts.charts import Line
from pyecharts.options import TitleOpts, LegendOpts, ToolboxOpts, VisualMapOptsline = Line()
line.add_xaxis(["小铭", "小红"])  # 添加x轴上信息
line.add_yaxis("资金", [10, 20])  # 添加y轴上信息
# 设置全局配置项
line.set_global_opts(title_opts=TitleOpts(title="测试", pos_left="center", pos_bottom="1%"),  # 标题配置项legend_opts=LegendOpts(is_show=True),  # 图例配置项toolbox_opts=ToolboxOpts(is_show=True),  # 提示框配置项visualmap_opts=VisualMapOpts(is_show=True)  # 视觉映射配置项
)
line.render()  # 得到一个html文件

4、数据处理

jsonp_1629344292311_69436({"status":0,"msg":"success","data":[{"name":"美国","trend":{"updateDate":["2.22","2.23","2.24","2.25","2.26","2.27","2.28","2.29","3.1","3.2","3.3","3.4","3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17","3.18","3.19","3.20","3.21","3.22","3.23","3.24","3.25","3.26","3.27","3.28","3.29","3.30","3.31","4.1","4.2","4.3","4.4","4.5","4.6","4.7","4.8","4.9","4.10","4.11","4.12","4.13","4.14","4.15","4.16","4.17","4.18","4.19","4.20","4.21","4.22","4.23","4.24","4.25","4.26","4.27","4.28","4.29","4.30","5.1","5.2","5.3","5.4","5.5","5.6","5.7","5.8","5.9","5.10","5.11","5.12","5.13","5.14","5.15","5.16","5.17","5.18","5.19","5.20","5.21","5.22","5.23","5.24","5.25","5.26","5.27","5.28","5.29","5.30","5.31","6.1","6.2","6.3","6.4","6.5","6.6","6.7","6.8","6.9","6.10","6.11","6.12","6.13","6.14","6.15","6.16","6.17","6.18","6.19","6.20","6.21","6.22","6.23","6.24","6.25","6.26","6.27","6.28","6.29","6.30","7.1","7.2","7.3","7.4","7.5","7.6","7.7","7.8","7.9","7.10","7.11","7.12","7.13","7.14","7.15","7.16","7.17","7.18","7.19","7.20","7.21","7.22","7.23","7.24","7.25","7.26","7.27","7.28","7.29","7.30","7.31","8.1","8.2","8.3","8.4","8.5","8.6","8.7","8.8","8.9","8.10","8.11","8.12","8.13","8.14","8.15","8.16","8.17","8.18","8.19","8.20","8.21","8.22","8.23","8.24","8.25","8.26","8.27","8.28","8.29","8.30","8.31","9.1","9.2","9.3","9.4","9.5","9.6","9.7","9.8","9.9","9.10","9.11","9.12","9.13","9.14","9.15","9.16","9.17","9.18","9.19","9.20","9.21","9.22","9.23","9.24","9.25","9.26","9.27","9.28","9.29","9.30","10.1","10.2","10.3","10.4","10.5","10.6","10.7","10.8","10.9","10.10","10.11","10.12","10.13","10.14","10.15","10.16","10.17","10.18","10.19","10.20","10.21","10.22","10.23","10.24","10.25","10.26","10.27","10.28","10.29","10.30","10.31","11.1","11.2","11.3","11.4","11.5","11.6","11.7","11.8","11.9","11.10","11.11","11.12","11.13","11.14","11.15","11.16","11.17","11.18","11.19","11.20","11.21","11.22","11.23","11.24","11.25","11.26","11.27","11.28","11.29","11.30","12.1","12.2","12.3","12.4","12.5","12.6","12.7","12.8","12.9","12.10","12.11","12.12","12.13","12.14","12.15","12.16","12.17","12.18","12.19","12.20","12.21","12.22","12.23","12.24","12.25","12.26","12.27","12.28","12.29","12.30","12.31","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","1.10","1.11","1.12","1.13","1.14","1.15","1.16","1.17","1.18","1.19","1.20","1.21","1.22","1.23","1.24","1.25","1.26","1.27","1.28","1.29","1.30","1.31","2.1","2.2","2.3","2.4","2.5","2.6","2.7","2.8","2.9","2.10","2.11","2.12","2.13","2.14","2.15","2.16","2.17","2.18","2.19","2.20","2.21","2.22","2.23","2.24","2.25","2.26","2.27","2.28","3.1","3.2","3.3","3.4","3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17","3.18","3.19","3.20","3.21","3.22","3.23","3.24","3.25","3.26","3.27","3.28","3.29","3.30","3.31","4.1","4.2","4.3","4.4","4.5","4.6","4.7","4.8","4.9","4.10","4.11","4.12","4.13","4.14","4.15","4.16","4.17","4.18","4.19","4.20","4.21","4.22","4.23","4.24","4.25","4.26","4.27","4.28","4.29","4.30","5.1","5.2","5.3","5.4","5.5","5.6","5.7","5.8","5.9","5.10","5.11","5.12","5.13","5.14","5.15","5.16","5.17","5.18","5.19","5.20","5.21","5.22","5.23","5.24","5.25","5.26","5.27","5.28","5.29","5.30","5.31","6.1","6.2","6.3","6.4","6.5","6.6","6.7","6.8","6.9","6.10","6.11","6.12","6.13","6.14","6.15","6.16","6.17","6.18","6.19","6.20","6.21","6.22","6.23","6.24","6.25","6.26","6.27","6.28","6.29","6.30","7.1","7.2","7.3","7.4","7.5","7.6","7.7","7.8","7.9","7.10","7.11","7.12","7.13","7.14","7.15","7.16","7.17","7.18","7.19","7.20","7.21","7.22","7.23","7.24","7.25","7.26","7.27","7.28","7.29","7.30","7.31","8.1","8.2","8.3","8.4","8.5","8.6","8.7","8.8","8.9","8.10","8.11","8.12","8.13","8.14","8.15","8.16","8.17","8.18"],"list":[{"name":"确诊","data":[34,34,34,53,57,60,60,64,69,89,106,125,161,233,345,445,572,717,1010,1322,1264,1678,3499,4629,5894,9345,14250,19624,22043,32717,46332,53268,65285,83507,101657,121117,139675,161367,184183,206207,236339,270473,312076,334125,363349,394182,425828,463433,498674,530384,559245,586941,610632,641397,674829,710021,738697,762496,789383,825306,844992,877497,916348,955488,985060,1004942,1029878,1056646,1092656,1125305,1156744,1185167,1209702,1234592,1256639,1289028,1318686,1342723,1365308,1381665,1406519,1427587,1453381,1480975,1503684,1526134,1532861,1555133,1573778,1597130,1627409,1650677,1672527,1689727,1711569,1730595,1750377,1772643,1797949,1822117,1842243,1862879,1887708,1907840,1928026,1973883,1995854,2012001,2030323,2052816,2072274,2094368,2123102,2150245,2166685,2188198,2215580,2242914,2275218,2303692,2342597,2363825,2396101,2426500,2474962,2511784,2571448,2615417,2649774,2695685,2744570,2797737,2855961,2909123,2948587,2996027,3055548,3116430,3174924,3242086,3311844,3381274,3436152,3490706,3565476,3642907,3719446,3790373,3854368,3901026,3979579,4046552,4118684,4197515,4273303,4333464,4384069,4451396,4515787,4570103,4655611,4729242,4778177,4821556,4873925,4925454,4988431,5041384,5108144,5164221,5212499,5263777,5321984,5365527,5427637,5478009,5539841,5573475,5614889,5663371,5710773,5757944,5809339,5848860,5886045,5923582,5967010,6013451,6059951,6103820,6141778,6177207,6214690,6260881,6302203,6341126,6400670,6434850,6466100,6490632,6521356,6559509,6594419,6645500,6684292,6718969,6753195,6797153,6838556,6880182,6932328,6972440,7011038,7053783,7106699,7148986,7196972,7251328,7294643,7325115,7365427,7413600,7457857,7507524,7564910,7607545,7644713,7687269,7730931,7787879,7842831,7909037,7957615,8000852,8049854,8106263,8165007,8230184,8306024,8351444,8393773,8468223,8528732,8595023,8675199,8769097,8839609,8898410,8976435,9053778,9136784,9226558,9336073,9414641,9487088,9574004,9702484,9806960,9937271,10071095,10191335,10297867,10433356,10579938,10725002,10888324,11078662,11235666,11381956,11545530,11699233,11896039,12094052,12293770,12463498,12598889,12786174,12978833,13150740,13466984,13612512,13750608,13920038,13933653,14131866,14333241,14568192,14784825,14995863,15169648,15383380,15609610,15845642,16073829,16308192,16563650,16752408,16958845,17159794,17414880,17654984,17899267,18086215,18285335,18494265,18691742,18937716,19117212,19217816,19573847,19781624,19803605,19990823,20237964,20462501,20619032,20918061,21118056,21365185,21610422,21869885,22166149,22492589,22714728,22935771,23155164,23386010,23632112,23870669,24110448,24315314,24488739,24632518,24818518,25023343,25211649,25397214,25579523,25713893,25870814,26030906,26192314,26359244,26518148,26663198,26771042,26916617,27036145,27162000,27278671,27412193,27527512,27616951,27704111,27806679,27906565,28010156,28111899,28203185,28262656,28320708,28386112,28455519,28529053,28606256,28708395,28769345,28833194,28903679,28981169,29059531,29139466,29203913,29259111,29317873,29375702,29458725,29529369,29599380,29656182,29698316,29746358,29802437,29864187,29929048,29994880,30046127,30084925,30141986,30235739,30301478,30365645,30430839,30485146,30525546,30584133,30642156,30712693,30780446,30858924,30924489,30971471,31038713,31105552,31171824,31254320,31319713,31385250,31425966,31505372,31564041,31648458,31729532,31805293,31872934,31924090,32004871,32081119,32159704,32229561,32311824,32367532,32410664,32482069,32545506,32608235,32674864,32738575,32791704,32826166,32877124,32929328,32989068,33045026,33111880,33147944,33182584,33235845,33279375,33326362,33372079,33423238,33456075,33479348,33519192,33552055,33589578,33628266,33669344,33697379,33718260,33747850,33776970,33804454,33835634,33862888,33882787,33898195,33924707,33949445,33974288,33999993,34022949,34036447,34043227,34114420,34137548,34154767,34176367,34192759,34204478,34211228,34228382,34243135,34266374,34276819,34306726,34316178,34321723,34335515,34353097,34366709,34378217,34393372,34402047,34406337,34420165,34435231,34449692,34465568,34482925,34490231,34495082,34512206,34527963,34541123,34561470,34580470,34588360,34592415,34600300,34622850,34647863,34677466,34711770,34726259,34733644,34766952,34808130,34849074,34888864,34930095,34953937,34964151,35019526,35082335,35147918,35149096,35212393,35251453,35287269,35288544,35355430,35491609,35588314,35689184,35745024,35771553,35900045,36056093,36189636,36305074,36449535,36519801,36543924,36780842,36896358,37067806,37210382,37365716,37435835,37468530,37739987,37909829]},{"name":"治愈","data":[0,0,3,0,0,0,0,0,0,0,3,3,8,8,10,10,10,10,10,15,41,56,56,56,56,106,121,147,147,178,178,178,378,680,869,961,2661,5595,6043,8434,8861,9445,14997,16848,19313,21571,23292,25139,27744,29444,32091,36948,38562,48105,57256,60510,68269,69956,72015,82973,83910,85021,93275,116167,118735,137591,140138,145320,151774,160173,161782,178219,184354,199151,205268,215580,222008,232869,240853,260188,280509,307755,316244,321348,337563,344805,347225,359137,361419,371077,383099,403315,447211,451749,467962,480321,490262,499768,519736,536234,600150,615719,646614,689282,712437,738998,752848,761736,773696,788969,808556,817337,842329,854659,870080,891068,903176,919108,931355,956316,974746,980836,1003322,1020499,1040711,1052529,1069342,1081793,1093951,1122678,1143923,1168436,1191892,1237767,1260695,1291315,1326669,1355898,1393363,1426645,1461374,1501866,1518254,1551021,1601508,1646933,1681060,1751902,1775491,1802550,1851157,1889285,1943698,1982124,2035976,2061879,2090298,2139817,2190356,2246212,2286492,2331327,2363229,2381407,2449120,2483903,2541859,2579191,2618203,2639927,2667649,2717642,2758382,2813845,2844525,2876080,2904440,2924268,2974788,3012244,3063412,3097040,3127665,3148165,3168960,3219333,3257748,3315120,3350304,3376815,3409063,3425925,3458244,3498209,3548122,3575866,3637002,3707191,3726119,3759134,3797941,3856749,3882295,3919169,3950648,3981346,4029477,4069609,4120577,4156472,4192963,4223996,4251943,4301523,4360093,4400872,4440485,4483950,4524760,4571265,4611282,4651017,4711997,4750176,4779402,4828654,4862023,4906808,4950141,4997380,5026952,5066257,5092941,5138374,5197125,5238565,5290510,5329151,5402456,5438389,5463410,5513584,5549360,5612505,5662998,5704352,5742963,5781451,5842665,5885393,5940558,5986309,6030186,6066893,6109683,6173165,6237659,6294444,6342279,6392425,6442590,6484054,6554526,6603478,6651545,6729527,6790898,6891461,6939835,7023230,7090336,7171883,7248771,7320373,7405265,7453661,7553556,7641913,7809461,7945585,8041239,8107270,8223391,8230001,8345995,8468702,8570636,8663942,8790495,8859465,8994191,9095080,9235316,9340223,9511911,9645924,9727555,9879331,10015012,10176485,10296261,10399339,10546751,10623101,10807172,10949574,11104857,11219489,11260932,11495875,11696727,11701029,11848630,12004898,12129680,12179238,12364189,12438638,12740254,12867806,13027453,13149021,13262863,13395752,13485260,13686114,13822268,13989184,14116779,14232377,14345507,14429670,14554257,14789811,14971903,15102060,15222909,15332896,15410579,15621586,15769146,15946080,16073346,16205134,16331248,16404678,16632859,16754190,16910071,17034751,17155139,17270463,17355083,17531152,17643640,17829681,17932117,18042270,18153841,18225135,18360050,18482067,18598301,18705426,18803870,18899383,18973605,19123743,19213237,19351989,19437119,19534420,19632572,19694344,19817630,19906113,20003419,20094343,20183964,20273917,20337124,20449894,20549683,20640748,20791322,22031315,22108944,22169286,22286801,22359523,22448224,22524157,22610516,22683821,22754337,22849905,23040302,23133605,23196688,23275549,23348808,23412337,23512386,23587883,23674274,23755003,23826158,23894933,23946970,24061534,24122758,24207348,24273615,24352334,24423693,24483025,24564313,24627180,24697102,24771510,24836442,24912339,24963753,25043528,25106084,25177498,25237089,25296330,25339994,25379860,25477692,25522166,25585578,25642151,25713185,25777927,25823932,25912151,25967231,26035399,26105941,26325307,26405895,26440056,26508144,26558229,26620848,26667224,26713260,27098665,27137693,27202318,27253889,27299310,27358685,27399429,27471314,27502275,27564594,27606705,27662791,27701879,27767062,27819783,27840884,27864919,27942476,27986542,28026136,28055012,28103496,28122741,28179158,28221041,28254425,28278647,28346340,28381635,28400648,28438183,28579129,28616860,28641443,28675967,28695025,28711321,28768408,28817445,28846409,28871917,28897490,28913044,28927336,28963939,29007495,29026760,29052212,29072893,29087424,29096816,29111901,29145393,29168406,29203311,29222972,29234930,29244103,29274450,29304606,29324310,29342095,29358531,29369181,29376745,29407667,29435550,29458707,29478193,29497875,29507123,29511917,29548607,29571650,29604525,29626891,29652042,29666117,29673543,29720758,29756608,29787468,29805593,29834481,29851804,29859073,29923320,29966351,30050065,30097898,30130093,30144609,30153948,30227303,30290005]},{"name":"死亡","data":[0,0,0,0,0,0,0,0,1,2,6,9,11,14,17,19,22,26,31,38,36,41,62,90,97,150,205,260,278,409,552,696,926,1201,1581,2010,2436,2956,3606,4542,5648,6889,8496,9458,10755,12716,14604,16504,18509,20513,22036,23640,25856,28394,34475,37158,39011,40478,42303,45343,47430,49729,51742,54120,55357,56527,58640,61180,63765,65540,67228,68495,69476,72054,74121,76791,78498,79926,80717,81552,83262,85029,86770,88309,89454,90931,91092,92198,93707,95118,96683,97800,98792,99381,99987,100825,102293,103452,104634,105680,106302,107135,108291,109271,110331,111599,112187,112596,113267,114379,115291,116138,116952,117587,117902,118487,119269,120079,120844,121520,122067,122292,122764,123521,124422,126911,127803,128233,128503,129031,130345,130984,131666,132174,132374,132664,133268,134163,135189,136024,136949,137577,137863,138459,139447,140460,141432,142400,143012,143321,144220,145271,146500,147676,148848,149541,149945,151478,152729,153887,155746,157184,158039,158457,159386,160502,161895,162975,164377,165235,165766,166707,168253,169225,170734,171568,172762,173187,173804,175429,176628,177652,179489,180295,180720,181479,182817,183931,185160,186179,186883,187248,187839,188975,190300,191221,192308,192887,193283,193648,194381,195590,196412,197629,198189,198643,199216,200667,201631,202306,203274,203881,204165,204801,205864,206895,207794,208625,209238,209502,209922,211098,211988,212912,213684,214341,214697,215221,216064,217081,217857,218855,219341,219797,220281,221147,222092,222973,223885,224389,224824,225451,226360,227516,228577,229551,230126,230556,231308,232305,233340,234405,235453,236154,236564,237068,238746,239894,241126,242339,243316,243807,244589,246034,247537,248686,250105,251285,251965,252792,254329,256609,258655,260479,261885,262757,263899,266285,268439,271038,272253,273077,274332,274743,277396,280210,283300,285786,287894,288984,291016,293739,297173,300272,302904,305144,306529,308335,311316,314991,318413,321025,323466,324915,327171,330921,334415,337081,338324,341138,343182,343593,346955,351127,354381,356450,358745,360151,362538,366252,370151,374624,378559,381557,383461,385534,390126,394308,398370,401980,405351,407256,408687,411657,416435,420719,424275,427713,429560,431818,436130,440257,444127,447558,450478,452332,454323,458341,462236,467109,470824,473586,475017,476553,479897,483487,487171,492663,496099,497177,498258,500159,502586,505474,507795,509916,511320,513051,515333,518803,520980,523142,524690,525795,527553,529307,531682,533680,535765,537214,537854,538711,540574,542230,543756,545555,546661,547300,548091,549484,550761,552564,554158,554899,555339,556070,556969,558497,559897,561199,562083,562582,563271,564336,565308,566733,567697,568524,568834,569425,570306,573016,573988,574893,575610,575853,576489,577273,578223,579053,580041,580823,581086,581665,582599,583427,584310,585115,585909,586177,586650,587441,588412,589222,590153,590733,591088,591610,592511,593244,594059,594981,595612,595845,596265,596989,597845,598574,599317,599937,600174,600548,601398,602009,602656,603446,603896,604113,604478,605278,606257,607732,608968,609442,609551,609777,610489,611037,611667,612265,612209,612378,612759,613084,613542,614054,614755,614972,615061,615247,615770,616174,616461,616924,617109,617174,617514,617893,618321,618694,619162,619347,619433,619619,619992,620267,620648,621172,621257,621295,621371,621563,621926,622219,622715,622825,622848,623044,623450,623867,624240,624612,624715,624746,624998,625403,625852,626187,626664,626713,626769,627048,627370,628131,628513,629072,629315,629387,629913,630532,631355,631899,632647,632995,633120,633799,634688,635257,636345,637170,637439,637567,638830,640181]},{"name":"新增确诊","data":[23,0,0,19,4,3,0,4,5,12,17,19,36,72,112,100,127,145,293,312,277,414,255,860,826,2769,5892,5374,5374,6670,10497,10054,12017,14886,19253,20400,18500,21692,21371,22741,25508,28048,32467,22768,26676,27178,25493,28506,30108,26272,24751,23570,23691,27511,26826,22566,28962,23704,24747,23577,26248,27457,38958,30256,24409,19882,24936,26768,36010,30282,25714,19299,21580,21757,19006,25936,26063,20938,17999,14027,20685,18951,23033,23382,19399,18361,6727,22272,18645,23352,30279,23268,21850,17200,21842,19026,19782,22266,25306,24168,20126,20636,24829,20132,20186,45857,21971,16147,18322,22493,19458,22094,28734,27143,16440,21513,27382,27334,32304,28474,38905,21228,32276,30399,48462,36822,59664,43969,34357,45911,48885,53167,58224,53162,39464,47440,59521,60882,58494,67162,69758,69430,54878,54554,74770,77431,76539,70927,63995,46658,78553,66973,72132,78831,75788,60161,50605,67327,64391,54316,85508,73631,48935,43379,52369,51529,62977,52953,66760,56077,48278,51278,58207,43543,62110,50372,61832,33634,41414,48482,47402,47171,51395,39521,37185,37537,43428,46441,46500,43869,37958,35429,37483,46191,41322,38923,59544,34180,31250,24532,30724,38153,34910,51081,38792,34677,34226,43958,41403,41626,52146,40112,38598,42745,52916,42287,47986,54356,43315,30472,40312,48173,44257,49667,57386,42635,37168,42556,43662,56948,54952,66206,48578,43237,49002,56409,58744,65177,75840,45420,42329,74450,60509,66291,80176,93898,70512,58801,78025,77343,83006,89774,109515,78568,72447,86916,128480,104476,130311,133824,120240,106532,135489,146582,145064,163322,190338,157004,146290,163574,153703,196806,198013,199718,169728,135391,187285,192659,171907,46567,145528,138096,138370,13615,198213,201375,234951,216633,211038,173785,213732,226230,236032,228187,234363,255458,188758,206437,200949,255086,240104,244283,186948,199120,208930,197477,245974,179496,100604,356031,207777,21981,187218,247141,224537,156531,299029,199995,247129,245237,259463,296264,326440,222139,221043,219393,230846,246102,238557,239779,204866,173425,143779,186000,204825,188306,185565,182309,134370,156921,160092,161408,166930,158904,145050,107844,145575,119528,125855,116671,133522,115319,89439,87160,102568,99886,103591,101743,91286,59471,58052,65404,69407,73534,77203,102139,60950,63849,70485,77490,78362,79935,64447,55198,58762,57829,83023,70644,70011,56802,42134,48042,56079,61750,64861,65832,51247,38798,57061,93753,65739,64167,65194,54307,40400,58587,58023,70537,67753,78478,65565,46982,67242,66839,66272,82496,65393,65537,40716,79406,58669,84417,81074,75761,67641,51156,80781,76248,78585,69857,82263,55708,43132,71405,63437,62729,66629,63711,53129,34462,50958,52204,59740,55958,66854,36064,34640,53261,43530,46987,45717,51159,32837,23273,39844,32863,37523,38688,41078,28035,20881,29590,29120,27484,31180,27254,19899,15408,26512,24738,24843,25705,22956,13498,6780,71193,23128,17219,21600,16392,11719,6750,17154,14753,23239,10445,29907,9452,5545,13792,17582,13612,11508,15155,8675,4290,13828,15066,14461,15876,17357,7306,4851,17124,15757,13160,20347,19000,7890,4055,7885,22550,25013,29603,34304,14489,7385,33308,41178,40944,39790,41231,23842,10214,55375,62809,65583,69382,63297,39060,35816,1275,66886,136179,96705,100870,55840,26529,128492,156048,133543,115438,144461,70266,24123,236918,115516,171448,142576,155334,70119,32695,271457,169842]}]}}]});

jsonp_1629350871167_29498({"status":0,"msg":"success","data":[{"name":"日本","trend":{"updateDate":["2.21","2.22","2.23","2.24","2.25","2.26","2.27","2.28","2.29","3.1","3.2","3.3","3.4","3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17","3.18","3.19","3.20","3.21","3.22","3.23","3.24","3.25","3.26","3.27","3.28","3.29","3.30","3.31","4.1","4.2","4.3","4.4","4.5","4.6","4.7","4.8","4.9","4.10","4.11","4.12","4.13","4.14","4.15","4.16","4.17","4.18","4.19","4.20","4.21","4.22","4.23","4.24","4.25","4.26","4.27","4.28","4.29","4.30","5.1","5.2","5.3","5.4","5.5","5.6","5.7","5.8","5.9","5.10","5.11","5.12","5.13","5.14","5.15","5.16","5.17","5.18","5.19","5.20","5.21","5.22","5.23","5.24","5.25","5.26","5.27","5.28","5.29","5.30","5.31","6.1","6.2","6.3","6.4","6.5","6.6","6.7","6.8","6.9","6.10","6.11","6.12","6.13","6.14","6.15","6.16","6.17","6.18","6.19","6.20","6.21","6.22","6.23","6.24","6.25","6.26","6.27","6.28","6.29","6.30","7.1","7.2","7.3","7.4","7.5","7.6","7.7","7.8","7.9","7.10","7.11","7.12","7.13","7.14","7.15","7.16","7.17","7.18","7.19","7.20","7.21","7.22","7.23","7.24","7.25","7.26","7.27","7.28","7.29","7.30","7.31","8.1","8.2","8.3","8.4","8.5","8.6","8.7","8.8","8.9","8.10","8.11","8.12","8.13","8.14","8.15","8.16","8.17","8.18","8.19","8.20","8.21","8.22","8.23","8.24","8.25","8.26","8.27","8.28","8.29","8.30","8.31","9.1","9.2","9.3","9.4","9.5","9.6","9.7","9.8","9.9","9.10","9.11","9.12","9.13","9.14","9.15","9.16","9.17","9.18","9.19","9.20","9.21","9.22","9.23","9.24","9.25","9.26","9.27","9.28","9.29","9.30","10.1","10.2","10.3","10.4","10.5","10.6","10.7","10.8","10.9","10.10","10.11","10.12","10.13","10.14","10.15","10.16","10.17","10.18","10.19","10.20","10.21","10.22","10.23","10.24","10.25","10.26","10.27","10.28","10.29","10.30","10.31","11.1","11.2","11.3","11.4","11.5","11.6","11.7","11.8","11.9","11.10","11.11","11.12","11.13","11.14","11.15","11.16","11.17","11.18","11.19","11.20","11.21","11.22","11.23","11.24","11.25","11.26","11.27","11.28","11.29","11.30","12.1","12.2","12.3","12.4","12.5","12.6","12.7","12.8","12.9","12.10","12.11","12.12","12.13","12.14","12.15","12.16","12.17","12.18","12.19","12.20","12.21","12.22","12.23","12.24","12.25","12.26","12.27","12.28","12.29","12.30","12.31","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","1.10","1.11","1.12","1.13","1.14","1.15","1.16","1.17","1.18","1.19","1.20","1.21","1.22","1.23","1.24","1.25","1.26","1.27","1.28","1.29","1.30","1.31","2.1","2.2","2.3","2.4","2.5","2.6","2.7","2.8","2.9","2.10","2.11","2.12","2.13","2.14","2.15","2.16","2.17","2.18","2.19","2.20","2.21","2.22","2.23","2.24","2.25","2.26","2.27","2.28","3.1","3.2","3.3","3.4","3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17","3.18","3.19","3.20","3.21","3.22","3.23","3.24","3.25","3.26","3.27","3.28","3.29","3.30","3.31","4.1","4.2","4.3","4.4","4.5","4.6","4.7","4.8","4.9","4.10","4.11","4.12","4.13","4.14","4.15","4.16","4.17","4.18","4.19","4.20","4.21","4.22","4.23","4.24","4.25","4.26","4.27","4.28","4.29","4.30","5.1","5.2","5.3","5.4","5.5","5.6","5.7","5.8","5.9","5.10","5.11","5.12","5.13","5.14","5.15","5.16","5.17","5.18","5.19","5.20","5.21","5.22","5.23","5.24","5.25","5.26","5.27","5.28","5.29","5.30","5.31","6.1","6.2","6.3","6.4","6.5","6.6","6.7","6.8","6.9","6.10","6.11","6.12","6.13","6.14","6.15","6.16","6.17","6.18","6.19","6.20","6.21","6.22","6.23","6.24","6.25","6.26","6.27","6.28","6.29","6.30","7.1","7.2","7.3","7.4","7.5","7.6","7.7","7.8","7.9","7.10","7.11","7.12","7.13","7.14","7.15","7.16","7.17","7.18","7.19","7.20","7.21","7.22","7.23","7.24","7.25","7.26","7.27","7.28","7.29","7.30","7.31","8.1","8.2","8.3","8.4","8.5","8.6","8.7","8.8","8.9","8.10","8.11","8.12","8.13","8.14","8.15","8.16","8.17","8.18"],"list":[{"name":"确诊","data":[93,105,132,144,156,164,186,210,230,239,254,268,284,317,348,407,454,522,582,640,690,726,787,818,835,880,923,962,1016,1054,1101,1140,1212,1313,1401,1525,1724,1894,1999,2233,2524,2793,3142,3506,3865,4092,4472,4979,5553,6188,6926,7423,7693,8191,8723,9297,9849,10434,10810,11157,11581,12023,12480,12868,13238,13441,13614,13895,14119,14305,14571,14877,15079,15253,15374,15477,15575,15663,15777,15847,15968,16049,16120,16203,16253,16310,16337,16367,16394,16433,16518,16543,16569,16611,16632,16662,16696,16759,16833,16877,16912,16949,17000,17031,17078,17118,17164,17202,17223,17268,17306,17347,17404,17454,17529,17601,17645,17689,17759,17816,17881,17937,17982,18034,18130,18212,18317,18409,18522,18631,18769,18895,19090,19329,19602,19822,19998,20209,20413,20767,21179,21581,21991,22252,22583,23008,23645,24235,24916,25425,25844,26476,27270,28200,28984,29782,30656,31249,32244,33474,34809,36366,37925,39255,40212,41455,42804,44286,45889,47464,48817,49746,50444,51425,52602,53961,55193,56214,56854,57761,58848,60033,61066,62046,62790,63283,64000,64897,65763,66638,67488,68088,68516,69151,69743,70405,70994,71585,72037,72321,72833,73337,74026,74688,75334,75774,76039,76571,77121,77650,78182,78782,79260,79571,79902,80116,80592,81169,81806,82285,82583,83115,83689,84335,84874,85451,85851,86135,86635,87145,87762,88374,89054,89491,89769,90269,90818,91526,92167,92787,93219,93533,94015,94634,95248,95995,96720,97218,97617,98262,98995,99804,100577,101453,102068,102548,103413,104036,105082,106221,107557,108503,109280,110616,112164,113808,115518,117261,118702,119652,121336,123544,125932,128348,130941,133117,134635,135846,137786,140288,142818,145502,147568,149002,151018,153456,155964,158411,160917,162942,164462,166618,169431,172416,175207,178242,180630,182305,184732,187718,190935,193757,196746,199248,201048,203717,206984,210723,214553,218430,223766,223771,227375,231223,235751,238999,242052,245212,248531,253432,259438,267004,274883,282662,288751,293637,298168,304040,310627,317772,324785,330544,335465,340780,346309,351976,357021,361733,365723,368485,372332,376300,380427,383958,387303,389975,391763,394087,396716,399289,401661,403938,405562,406775,408345,410231,411921,413219,414582,415945,417746,419050,420497,422035,423336,424568,425600,426375,427457,428376,429453,430509,431722,432720,433417,434304,435547,436717,437862,438916,439981,440580,441706,443018,444297,445606,446923,447912,448606,449739,451272,452771,454232,455747,456865,457686,459176,461101,463015,465040,467112,468896,470233,472325,475168,477774,480532,483305,485775,487346,489986,493448,496890,500422,504113,506895,508994,512703,517013,521586,526117,530903,534996,537898,542248,547544,553037,558145,563748,568353,571672,576626,582411,588308,593002,598988,604885,609353,613552,617622,621981,628034,635281,641761,646698,652935,659986,666851,673109,679530,684790,688464,693686,699504,705221,710471,715510,719556,722226,726117,730646,734784,738488,742080,744956,746745,749386,752419,755244,757839,760490,762511,763785,765668,767906,769949,771878,773821,773821,776139,777557,779262,780814,782432,783950,785257,786125,787536,789313,790983,792690,794321,795603,796603,797981,799801,801553,803324,805205,806690,807719,809385,811575,813821,816097,818553,820584,822088,824473,827667,831080,834511,838397,841499,843827,847585,852528,857921,862143,865717,870737,875427,883054,892628,903324,914065,926405,936581,944970,956986,971192,986451,1002093,1017842,1032249,1044320,1054890,1070698,1089548,1109912,1130059,1147889,1162736,1182686,1206597]},{"name":"治愈","data":[23,24,24,26,27,32,40,41,42,42,43,46,48,48,69,76,80,101,102,118,123,135,144,144,144,144,215,215,215,215,215,285,301,310,359,372,372,372,424,424,472,505,514,514,575,575,622,632,685,714,714,762,799,853,901,918,1012,1069,1069,1239,1356,1424,2408,2536,2536,2536,2905,3187,3187,3466,3981,3981,3981,4496,4587,4918,5146,5906,8127,8293,8531,8920,9868,10338,10809,11153,11415,11564,11884,12286,12672,13005,13244,13244,13612,13810,13973,14147,14254,14406,14459,14502,14650,14771,14869,14972,14972,14972,15148,15213,15298,15383,15493,15580,15643,15686,15701,15850,15930,16008,16077,16108,16133,16212,16263,16320,16392,16452,16506,16557,16631,16731,16772,16866,16959,17050,17124,17197,17331,17466,17652,17849,18003,18103,18282,18545,18814,19096,19366,19576,19757,20155,20651,21035,21328,21567,21762,22116,22811,23507,24179,24929,25506,25906,26487,27197,28028,28877,30153,31307,32312,33058,33975,34888,36134,37479,38945,40080,41196,42284,43835,45266,46467,47622,48550,49340,50431,51688,52823,53995,55341,56164,56802,57823,58428,59524,60417,61445,62076,62536,63282,64100,64835,65590,66280,66899,67242,67831,68532,69253,69899,70495,71030,71404,71648,71981,72538,73490,74151,74607,74990,75459,76025,76590,77219,77807,78315,78609,79071,79676,80227,80733,81356,81824,82113,82621,83158,83837,84451,85030,85485,85941,86513,87107,87666,88245,88787,89282,89709,90148,90807,91322,91890,92475,92960,93383,93855,94295,95113,95756,96461,97197,97654,98274,99108,100005,101018,101989,102837,103674,104637,105697,106954,108423,109892,111163,112269,113340,114725,116378,118135,120259,121891,123445,125470,127304,129241,131176,133443,135277,136903,138994,140622,143006,145014,147524,149286,150947,153519,155547,158287,160786,163308,165333,167513,169342,172115,174879,177793,180188,184662,184662,186946,189466,191451,193714,196420,198486,200676,203421,207039,210451,213737,217369,220536,222963,225396,229073,233665,238467,243973,248488,252787,257719,264987,273187,279214,285522,290542,295426,301540,308164,314434,320248,325592,330465,334125,339377,344137,349332,354473,358872,362231,365238,368813,372535,375454,378024,380569,382886,385097,387740,391208,393494,395492,397293,398921,400250,401809,403381,405257,406584,408020,409319,410604,412115,413334,414774,416024,417292,418261,419229,420260,421421,422542,423619,424685,425663,426686,427582,428783,429898,430927,432128,433149,434274,435361,436463,437702,438879,440200,441237,442369,443640,445024,446416,447715,449091,450624,452155,454055,455382,457050,458840,460993,463725,465916,468770,471007,473570,475574,478378,480793,483052,486076,488944,491661,494882,498242,501609,504738,508388,512069,515560,519047,523227,527233,531069,534836,538946,542569,546042,551293,555401,559553,564128,568558,573913,579446,584770,590044,595177,602356,609086,615324,621608,628522,634103,639887,645157,650111,655222,659732,666942,671772,675877,680621,685365,690623,695010,699741,703525,706644,710216,713807,717882,721260,724804,724804,730446,733316,736941,740213,742848,746431,748631,750430,752427,754334,756293,758173,760243,761912,763364,764913,766616,768328,770008,771784,773480,775042,776646,778492,780011,781613,783429,784992,786581,788131,789905,791751,793643,795388,797208,799062,801337,803681,806202,808413,810884,814024,816875,820138,823901,827372,831087,834967,839246,842780,847873,852607,858461,864775,873519,881608,889912,899124,909741,920862,930799,943260,955251,968380,982640,997295]},{"name":"死亡","data":[1,1,1,1,1,1,3,4,5,5,6,6,6,6,6,6,6,9,12,15,19,21,22,24,28,29,32,33,35,36,41,42,43,45,47,52,55,56,59,66,71,73,78,83,93,97,98,105,108,120,132,138,146,162,179,190,207,224,238,265,283,299,328,345,360,372,394,413,435,455,481,517,536,556,566,577,590,607,624,633,657,678,697,713,729,748,756,768,773,784,799,814,825,839,851,860,869,882,889,894,897,898,901,905,910,914,916,916,919,920,922,922,925,927,927,929,934,935,937,954,954,955,956,965,969,971,971,972,972,972,972,976,977,977,977,977,978,979,982,982,982,983,983,984,984,984,985,985,986,986,988,989,989,992,994,996,998,998,1002,1004,1007,1010,1013,1013,1017,1022,1028,1035,1040,1042,1047,1053,1058,1066,1073,1085,1093,1103,1119,1135,1149,1159,1175,1181,1190,1203,1217,1228,1241,1251,1285,1286,1298,1313,1327,1334,1352,1361,1366,1380,1397,1412,1416,1428,1441,1447,1455,1468,1481,1490,1499,1503,1507,1513,1519,1525,1537,1544,1547,1550,1561,1568,1574,1583,1594,1600,1600,1604,1611,1616,1619,1625,1628,1630,1634,1638,1646,1650,1665,1671,1675,1677,1680,1687,1698,1710,1714,1720,1728,1733,1738,1748,1756,1770,1776,1788,1795,1799,1806,1812,1817,1824,1836,1851,1863,1871,1885,1888,1895,1903,1920,1933,1953,1965,1981,1988,1996,2015,2036,2065,2096,2110,2126,2152,2193,2225,2252,2306,2319,2359,2398,2445,2478,2513,2554,2575,2601,2649,2702,2755,2791,2840,2878,2917,2965,3012,3069,3122,3186,3234,3325,3325,3383,3442,3492,3541,3572,3621,3680,3756,3821,3886,3963,4021,4067,4115,4179,4276,4340,4420,4476,4525,4583,4687,4779,4873,4981,5064,5120,5194,5298,5388,5501,5597,5688,5753,5833,5952,6072,6176,6282,6376,6428,6511,6605,6726,6804,6866,6932,6970,7042,7144,7223,7299,7365,7443,7493,7549,7603,7672,7746,7826,7867,7897,7948,8013,8076,8143,8198,8238,8263,8308,8366,8419,8461,8522,8573,8594,8632,8689,8725,8764,8798,8817,8836,8869,8923,8944,8971,9004,9035,9065,9082,9127,9176,9194,9216,9223,9236,9255,9277,9313,9338,9365,9391,9409,9433,9477,9511,9546,9592,9631,9649,9679,9718,9773,9815,9872,9926,9977,10012,10075,10125,10204,10243,10325,10387,10436,10487,10547,10612,10760,10845,10906,10981,11095,11199,11302,11383,11476,11524,11640,11862,11957,12065,12173,12261,12322,12407,12512,12627,12738,12840,12931,12980,13060,13161,13273,13385,13471,13527,13585,13660,13759,13855,13926,13990,14042,14042,14137,14204,14282,14331,14378,14406,14426,14461,14504,14563,14605,14636,14665,14675,14713,14743,14784,14808,14833,14842,14847,14867,14889,14903,14920,14940,14951,14957,14960,14978,14998,15020,15029,15046,15049,15062,15082,15102,15108,15116,15124,15128,15140,15152,15161,15175,15184,15193,15198,15209,15219,15233,15241,15261,15275,15284,15296,15315,15335,15359,15384,15401,15411,15439,15486,15515]},{"name":"新增确诊","data":[9,12,27,12,12,8,22,24,20,9,15,14,16,33,31,59,47,30,59,56,53,36,62,62,17,45,41,39,52,39,46,38,72,101,94,123,199,169,105,234,277,283,346,367,360,360,366,508,574,638,738,502,290,498,532,574,554,585,373,347,425,442,449,391,370,210,172,282,224,188,266,266,328,202,121,103,96,88,114,70,45,81,72,83,50,57,27,30,27,39,85,25,26,42,21,30,34,63,74,44,35,37,51,31,47,40,46,38,21,45,38,41,57,50,75,72,44,44,70,57,65,56,45,52,96,82,105,92,113,109,138,126,195,239,273,220,176,211,204,354,412,402,410,261,331,425,637,590,681,509,419,632,794,930,784,798,874,593,995,1230,1335,1557,1559,1330,957,1243,1349,1482,1603,1575,1353,929,698,981,1177,1359,1232,1021,640,907,1087,1185,1033,980,744,493,717,897,866,875,850,600,428,635,592,662,589,591,452,284,512,504,689,662,646,440,265,532,550,529,532,600,478,311,331,214,476,577,637,479,298,532,574,646,539,577,400,284,500,510,617,612,680,437,278,500,549,708,641,620,432,314,482,619,614,747,725,498,399,645,733,809,773,876,615,480,865,623,1046,1139,1336,946,777,1336,1548,1644,1710,1743,1441,950,1684,2208,2388,2416,2593,2176,1518,1211,1940,2502,2530,2684,2066,1434,2016,2438,2508,2447,2506,2025,1520,2156,2813,2985,2791,3035,2388,1675,2427,2986,3217,2822,2989,2502,1800,2669,3267,3739,3830,3877,5336,5,3604,3848,4528,3248,3053,3160,3319,4901,6006,7566,7879,7779,6089,4886,4531,5872,6587,7145,7013,5759,4921,5315,5529,5667,5045,4712,3990,2762,3847,3968,4127,3531,3345,2672,1788,2324,2629,2573,2372,2277,1624,1213,1570,1886,1690,1298,1363,1363,1801,1304,1447,1538,1301,1232,1032,775,1082,919,1077,1056,1213,998,697,887,1243,1170,1145,1054,1065,599,1126,1312,1279,1309,1317,989,694,1133,1533,1499,1461,1515,1118,821,1490,1925,1914,2025,2072,1784,1337,2092,2843,2606,2758,2773,2470,1571,2640,3462,3442,3532,3691,2782,2099,3709,4310,4573,4531,4786,4093,2902,4350,5296,5493,5108,5603,4605,3319,4954,5785,5897,4694,5986,5897,4468,4199,4070,4359,6053,7247,6480,4937,6237,7051,6865,6258,6421,5260,3674,5222,5818,5717,5250,5039,4046,2670,3891,4529,4138,3704,3592,2876,1789,2641,3033,2825,2595,2651,2021,1274,1883,2238,2043,1929,1943,0,2318,1418,1705,1552,1618,1518,1307,868,1411,1777,1670,1707,1631,1282,1000,1378,1820,1752,1771,1881,1485,1029,1666,2190,2246,2276,2456,2031,1504,2385,3194,3413,3431,3886,3102,2328,3758,4943,5393,4222,3574,5020,4690,7627,9574,10696,10741,12340,10176,8389,12016,14206,15259,15642,15749,14407,12071,10570,15808,18850,20364,20147,17830,14847,19950,23911]}]}}]}); 

jsonp_1629350745930_63180({"status":0,"msg":"success","data":[{"name":"印度","trend":{"updateDate":["4.7","4.8","4.9","4.10","4.11","4.12","4.13","4.14","4.15","4.16","4.17","4.18","4.19","4.20","4.21","4.22","4.23","4.24","4.25","4.26","4.27","4.28","4.29","4.30","5.1","5.2","5.3","5.4","5.5","5.6","5.7","5.8","5.9","5.10","5.11","5.12","5.13","5.14","5.15","5.16","5.17","5.18","5.19","5.20","5.21","5.22","5.23","5.24","5.25","5.26","5.27","5.28","5.29","5.30","5.31","6.1","6.2","6.3","6.4","6.5","6.6","6.7","6.8","6.9","6.10","6.11","6.12","6.13","6.14","6.15","6.16","6.17","6.18","6.19","6.20","6.21","6.22","6.23","6.24","6.25","6.26","6.27","6.28","6.29","6.30","7.1","7.2","7.3","7.4","7.5","7.6","7.7","7.8","7.9","7.10","7.11","7.12","7.13","7.14","7.15","7.16","7.17","7.18","7.19","7.20","7.21","7.22","7.23","7.24","7.25","7.26","7.27","7.28","7.29","7.30","7.31","8.1","8.2","8.3","8.4","8.5","8.6","8.7","8.8","8.9","8.10","8.11","8.12","8.13","8.14","8.15","8.16","8.17","8.18","8.19","8.20","8.21","8.22","8.23","8.24","8.25","8.26","8.27","8.28","8.29","8.30","8.31","9.1","9.2","9.3","9.4","9.5","9.6","9.7","9.8","9.9","9.10","9.11","9.12","9.13","9.14","9.15","9.16","9.17","9.18","9.19","9.20","9.21","9.22","9.23","9.24","9.25","9.26","9.27","9.28","9.29","9.30","10.1","10.2","10.3","10.4","10.5","10.6","10.7","10.8","10.9","10.10","10.11","10.12","10.13","10.14","10.15","10.16","10.17","10.18","10.19","10.20","10.21","10.22","10.23","10.24","10.25","10.26","10.27","10.28","10.29","10.30","10.31","11.1","11.2","11.3","11.4","11.5","11.6","11.7","11.8","11.9","11.10","11.11","11.12","11.13","11.14","11.15","11.16","11.17","11.18","11.19","11.20","11.21","11.22","11.23","11.24","11.25","11.26","11.27","11.28","11.29","11.30","12.1","12.2","12.3","12.4","12.5","12.6","12.7","12.8","12.9","12.10","12.11","12.12","12.13","12.14","12.15","12.16","12.17","12.18","12.19","12.20","12.21","12.22","12.23","12.24","12.25","12.26","12.27","12.28","12.29","12.30","12.31","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","1.10","1.11","1.12","1.13","1.14","1.15","1.16","1.17","1.18","1.19","1.20","1.21","1.22","1.23","1.24","1.25","1.26","1.27","1.28","1.29","1.30","1.31","2.1","2.2","2.3","2.4","2.5","2.6","2.7","2.8","2.9","2.10","2.11","2.12","2.13","2.14","2.15","2.16","2.17","2.18","2.19","2.20","2.21","2.22","2.23","2.24","2.25","2.26","2.27","2.28","3.1","3.2","3.3","3.4","3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12","3.13","3.14","3.15","3.16","3.17","3.18","3.19","3.20","3.21","3.22","3.23","3.24","3.25","3.26","3.27","3.28","3.29","3.30","3.31","4.1","4.2","4.3","4.4","4.5","4.6","4.7","4.8","4.9","4.10","4.11","4.12","4.13","4.14","4.15","4.16","4.17","4.18","4.19","4.20","4.21","4.22","4.23","4.24","4.25","4.26","4.27","4.28","4.29","4.30","5.1","5.2","5.3","5.4","5.5","5.6","5.7","5.8","5.9","5.10","5.11","5.12","5.13","5.14","5.15","5.16","5.17","5.18","5.19","5.20","5.21","5.22","5.23","5.24","5.25","5.26","5.27","5.28","5.29","5.30","5.31","6.1","6.2","6.3","6.4","6.5","6.6","6.7","6.8","6.9","6.10","6.11","6.12","6.13","6.14","6.15","6.16","6.17","6.18","6.19","6.20","6.21","6.22","6.23","6.24","6.25","6.26","6.27","6.28","6.29","6.30","7.1","7.2","7.3","7.4","7.5","7.6","7.7","7.8","7.9","7.10","7.11","7.12","7.13","7.14","7.15","7.16","7.17","7.18","7.19","7.20","7.21","7.22","7.23","7.24","7.25","7.26","7.27","7.28","7.29","7.30","7.31","8.1","8.2","8.3","8.4","8.5","8.6","8.7","8.8","8.9","8.10","8.11","8.12","8.13","8.14","8.15","8.16","8.17","8.18"],"list":[{"name":"确诊","data":[5480,5916,6725,7600,8446,9205,10453,11487,12322,13430,14352,15722,17615,18539,20080,21370,23039,24447,26283,27890,29451,31332,33062,34862,37257,39699,42505,46437,49400,52987,56351,59693,62808,67161,70768,74243,78055,81997,85784,90648,95698,100161,103292,107819,114478,124073,130506,137608,141228,150313,154820,163120,172359,180621,189765,194837,202860,214664,224215,233576,243733,254340,264143,273443,284754,297001,305951,317368,324482,336185,347821,359506,371734,385276,400724,421765,430708,449613,465553,481179,501864,527738,548154,562457,574926,593703,612486,633381,664488,687760,712920,739646,760761,790649,818647,847575,871499,898680,933450,959993,1001863,1036497,1055932,1106135,1127281,1171446,1220433,1263336,1323471,1383172,1424202,1466059,1529653,1579240,1601070,1690546,1749771,1780268,1830949,1901334,1958592,2021407,2057816,2129154,2199101,2244435,2322755,2372318,2431558,2506247,2530943,2634256,2684314,2732218,2814157,2873173,2925337,3038013,3079925,3149759,3211848,3286512,3377908,3454513,3477250,3583807,3649639,3715931,3810625,3904508,3993412,4092550,4160493,4236961,4313129,4417550,4494389,4606149,4688470,4788593,4878042,4963097,5060818,5141905,5228478,5323907,5417274,5517601,5580286,5669610,5765744,5843349,5915753,6041638,6087454,6156722,6245404,6323247,6438968,6509916,6573678,6650456,6724380,6764710,6841813,6946598,6997852,7063955,7160805,7205923,7275588,7349290,7416538,7475572,7536769,7574167,7644979,7701365,7727289,7781746,7829226,7873664,7918102,7974963,8006340,8070589,8094636,8178645,8208774,8250951,8305267,8352518,8380734,8439389,8478689,8531420,8576689,8601937,8659513,8690621,8751254,8790760,8837037,8867857,8886987,8925467,8974910,9021020,9065301,9129003,9170825,9193982,9245108,9291068,9308751,9393039,9432075,9463254,9484506,9523678,9556881,9593688,9625289,9667084,9689302,9714308,9756610,9780486,9814064,9844322,9881357,9902262,9925062,9933997,9966966,9987949,10015973,10047131,10067196,10094801,10111256,10141215,10157903,10178592,10208725,10224797,10237117,10260618,10282624,10293028,10310778,10337069,10345118,10369514,10388018,10405097,10426407,10448134,10460179,10473696,10485420,10497470,10525452,10540365,10556184,10566720,10572672,10582647,10606215,10619603,10634414,10645580,10661138,10672035,10689202,10690279,10702730,10720971,10740309,10750224,10764177,10768991,10788136,10799024,10805790,10816147,10831279,10846028,10848045,10859057,10878758,10880794,10894638,10910589,10919616,10931492,10942948,10956182,10969230,10989668,10997821,11008665,11028114,11043925,11056933,11077957,11094249,11102946,11121186,11136452,11152127,11171166,11190651,11204179,11228288,11241990,11260750,11266216,11287543,11327129,11353712,11382610,11404279,11410769,11473015,11509345,11551980,11590373,11607548,11682440,11726364,11780157,11794407,11860672,11965931,11990353,12089876,12110693,12203953,12229790,12319836,12476468,12508609,12625146,12732968,12847674,12978132,13164235,13261376,13444844,13564561,13714419,13960574,14268441,14465797,14732074,15040130,15239230,15609004,15924806,16257309,16519812,16869825,17116637,17519369,17867648,18368096,18754984,19157094,19549656,19919715,20275543,20658234,21070852,21485285,21886611,22295911,22662410,22991927,23340426,23702832,24046120,24372243,24683065,24964925,25227970,25495144,25771405,26030674,26285069,26528846,26751681,26947496,27156382,27367935,27547705,27719431,27893472,28046957,28173655,28306883,28440988,28572359,28693835,28808372,28909604,28996949,29088176,29182072,29273338,29358033,29424006,29507438,29570035,29632261,29699555,29761964,29822764,29881352,29934361,29973457,30027850,30082169,30133417,30182469,30232320,30278963,30316000,30361699,30410577,30453937,30501189,30544485,30584872,30618939,30662896,30708570,30743013,30794756,30836231,30873907,30904734,30944949,30986803,31025875,31063987,31105270,31141669,31153392,31209914,31219374,31289115,31297122,31341507,31396300,31417313,31470893,31490153,31528114,31579651,31619573,31693625,31708870,31732703,31809049,31815756,31884819,31902422,31944077,31981869,31998158,32052127,32077706,32117826,32190846,32205973,32249573,32279653,32295224]},{"name":"治愈","data":[468,506,620,774,969,1080,1181,1359,1432,1768,2041,2463,2854,3273,3975,4370,5012,5496,5939,6523,7137,7796,8437,9068,10007,10819,11775,12847,14142,15331,16776,17887,19301,20696,22549,24420,26400,27969,30234,34224,36795,38909,40458,43070,46002,50857,53947,54865,58727,63536,65944,69534,81606,84759,91016,93343,98113,103641,107419,112189,117404,122738,127991,131775,140033,146074,152395,159597,164803,172313,184243,190755,196894,208169,216730,235078,240289,254204,264542,277765,292626,308928,321178,329728,340225,353333,366027,383936,404351,417509,435441,454858,470144,483348,513503,532532,546379,566664,590219,609831,620194,651308,664461,693450,707523,737808,772488,800158,841424,883977,910298,936171,987174,1017204,1029069,1091018,1144277,1165442,1200303,1278084,1298528,1374420,1402076,1461772,1506413,1560800,1633356,1673885,1725834,1770682,1810079,1904612,1939454,2005215,2075836,2129764,2175492,2273973,2310922,2355823,2445975,2506724,2577990,2640121,2658419,2744887,2800671,2856147,2931005,3014685,3086545,3162305,3219750,3278999,3352316,3433604,3490908,3586216,3648534,3730949,3809549,3887371,3976413,4039986,4125742,4221471,4313402,4432630,4509924,4609704,4700625,4779658,4852313,4981099,5025815,5109584,5206044,5280204,5393737,5466344,5527934,5621193,5703607,5750403,5836826,5946371,6003244,6087588,6203130,6255622,6343270,6425716,6505179,6571659,6642698,6693491,6784742,6867988,6903365,6965699,7030903,7085242,7141966,7234749,7273649,7348147,7376961,7481951,7511472,7570044,7644926,7697460,7733477,7791363,7837061,7891991,7941094,7969954,8037467,8070817,8138948,8180967,8233765,8279822,8303358,8346331,8400113,8443553,8491462,8550931,8592303,8618445,8661421,8700681,8716566,8801161,8846313,8889585,8915158,8958524,8998066,9042308,9079888,9126233,9156423,9189704,9238188,9268492,9309031,9343056,9383735,9415086,9444229,9456552,9507421,9530530,9564162,9595711,9621683,9656883,9674090,9709469,9728747,9750670,9782669,9806767,9821119,9850394,9876557,9889946,9910982,9939466,9952548,9986904,10009404,10026751,10048922,10072016,10084011,10100053,10114980,10130451,10157879,10173747,10192158,10204340,10211342,10228753,10256410,10273553,10291077,10306666,10321966,10334850,10356476,10359305,10373649,10394352,10415080,10424619,10442137,10449858,10475872,10487650,10497654,10510807,10525343,10544069,10547201,10560593,10579622,10589230,10600905,10613072,10624838,10637743,10648633,10658469,10672253,10686299,10694193,10703460,10723130,10734328,10741483,10760379,10771400,10779954,10794590,10807877,10818721,10836798,10851094,10860512,10880059,10893442,10916916,10923264,10938146,10966735,10982516,11003784,11018816,11027543,11060390,11079697,11103681,11124465,11134333,11176854,11198515,11226705,11232919,11270831,11320418,11332289,11387270,11401824,11462934,11475836,11532137,11625318,11639575,11698657,11753169,11809277,11867486,11964985,12008162,12109473,12165126,12263113,12362012,12530565,12633314,12774046,12930733,13052362,13221039,13312271,13593113,13804309,14018818,14150962,14468946,14695983,14923460,15305026,15498680,15885993,16240047,16455477,16875349,17000610,17407470,17719749,18234220,18591134,18970018,19328365,19611259,19844129,20281508,20679456,21039370,21492926,21754130,22277260,22665206,23022025,23383307,23693992,23948435,24278735,24604894,24693493,25037378,25227740,25647332,25917521,25994295,26198172,26428307,26724010,26916989,27008777,27282022,27479472,27629621,27756262,27865723,27957446,28105369,28231022,28345261,28454938,28558214,28627998,28725030,28830037,28911454,28950726,29034224,29064502,29132853,29238048,29293497,29317068,29416815,29456404,29519131,29548302,29632032,29682688,29723553,29769484,29799534,29863463,29901927,29957090,30000214,30050975,30063720,30129597,30157396,30191151,30239521,30297377,30313050,30374508,30390687,30454757,30468079,30504747,30555315,30579106,30634202,30663147,30701612,30743972,30781263,30846509,30869454,30896354,30965030,30974748,31037245,31055861,31102724,31148536,31180968,31230332,31260050,31302345,31365316,31381493,31440221,31470067,31492285]},{"name":"死亡","data":[164,178,226,249,288,331,358,393,405,448,486,521,559,592,645,681,721,780,825,882,939,1008,1079,1154,1223,1323,1391,1566,1693,1785,1889,1985,2101,2212,2294,2415,2551,2649,2753,2871,3025,3144,3179,3317,3465,3707,3850,4004,4057,4334,4406,4653,4956,5144,5390,5577,5679,6028,6301,6440,6845,7117,7449,7558,7996,8473,8718,9109,9247,9590,10015,12029,12360,12677,13035,13502,13780,14162,14634,15042,15487,16088,16466,16797,17038,17521,17996,18320,18953,19568,20073,20618,21072,21586,22122,22659,23078,23569,24281,24865,25589,26267,26508,27428,27628,28488,29531,30122,31112,32082,32656,33129,34223,34948,35134,36497,37390,37690,38485,39787,40722,41627,42026,43144,44048,44855,46062,46717,47527,48888,49171,50845,51685,52280,53701,54438,55174,56792,57258,58317,59305,60267,61646,62669,62837,64062,64951,65725,66871,68059,69214,70519,71120,72033,73105,74367,75328,76744,77768,78931,80026,81168,82504,83433,84505,85731,86909,88231,89117,90282,91435,92587,93461,94971,95678,96468,97761,98822,100323,101211,101997,103005,104032,104651,105632,106925,107568,108412,109667,110118,110966,111726,112862,113578,114511,114902,115879,116585,117011,117474,118236,118621,119148,119823,120179,120899,121211,122099,122424,122848,123454,123955,124552,125263,125895,126370,126864,127170,127810,128204,128894,129357,129969,130391,130670,131130,131770,132310,132872,133589,134088,134383,134989,135533,135734,136733,137177,137659,137933,138467,138946,139473,139962,140481,140782,141078,141668,141977,142417,142841,143352,143667,143985,144144,144662,144914,145322,145669,146025,146414,146562,147029,147241,147521,147940,148190,148329,148660,148950,149095,149305,149603,149721,150028,150272,150470,150752,151000,151149,151265,151389,151578,151910,152068,152272,152369,152456,152593,152802,152947,153104,153316,153462,153525,153722,153751,153895,154047,154202,154358,154472,154547,154690,154782,154884,154966,155078,155158,155196,155286,155443,155489,155609,155734,155789,155883,155977,156090,156181,156325,156376,156457,156581,156713,156820,156947,157060,157125,157242,157360,157447,157562,157689,157750,157875,157949,158075,158123,158236,158418,158596,158750,158836,158902,159246,159387,159578,159728,159834,160181,160427,160642,160761,161049,161562,161730,162110,162237,162818,162993,163485,164610,164745,165293,165851,166426,167105,168203,168690,169651,170377,171205,172461,174171,175238,176745,178557,179795,181870,183088,186184,188630,191281,193055,196609,199388,202281,207215,209581,213997,218124,220571,225037,226720,231419,235189,242029,245057,249183,253470,256940,259479,264124,268521,273038,276947,279919,286063,290795,295047,298761,303355,305848,310416,314908,315869,320264,322982,328871,331607,332644,335489,338400,342280,346055,347259,350631,353246,355374,361010,364113,367577,371271,375185,377061,379601,382785,384275,385815,388096,389258,389661,391385,392123,393508,395715,396631,396972,398456,398913,399872,400434,401538,402359,403085,403700,404341,405425,406200,407537,408763,409267,409338,411928,412204,412720,413305,414113,414338,414657,418623,419471,419613,420196,420758,421117,421712,422175,422695,423403,423965,424777,425082,425388,426294,426434,427149,427565,428072,428577,428715,429564,429702,430285,431240,431558,432110,432421,432834]},{"name":"新增确诊","data":[533,565,809,875,846,759,1248,1034,835,1060,922,1370,1250,924,1541,1290,1669,1408,1836,1607,1561,1873,1738,1800,2394,2442,2806,3932,2963,3587,3364,3342,3113,4353,3607,3475,3763,3942,3787,4864,5050,4463,3131,4527,6659,9595,6433,7102,3620,9085,4507,8300,9239,8262,9144,5072,8023,11804,9551,9361,10157,10607,9803,9300,11311,12247,8950,11417,7114,11703,11636,11685,12228,13542,15448,21041,8943,18905,15940,15626,20685,25874,20416,14303,12469,18777,18783,20895,31107,23272,25160,26726,21115,29888,27998,28928,23924,27181,34770,26543,41870,34634,37407,50203,36810,44165,48987,42903,60135,59701,41030,41857,63594,49587,54966,57704,59225,52783,50681,70385,57258,62815,61455,71338,69947,45334,78320,49563,59240,74689,24696,103313,50058,47904,81939,59016,52164,112676,41912,69834,62089,74664,91396,76605,22737,106557,65832,66292,94694,93883,88904,99138,67943,76468,76168,104421,76839,111760,82321,100123,89449,85055,97721,81087,86573,95429,93367,100327,62685,89324,96134,77605,72404,125885,45816,69268,88682,77843,115721,70948,63762,76778,73924,40330,77103,104785,51254,66103,96850,45118,69665,73702,67248,59034,61197,37398,70812,56386,25924,54457,47480,44438,44438,56861,31377,64249,24047,84009,30129,42177,54316,47251,28216,58655,39300,52731,45269,25248,57576,31108,60633,39506,46277,30820,19130,38480,49443,46110,44281,63702,41822,23157,51126,45960,17683,84288,39036,42098,21252,39172,33203,36807,31601,41795,22218,25006,42302,23876,33578,30258,37035,20905,22800,8935,32969,20983,28024,31158,20065,27605,16455,29959,16688,20689,30133,16072,12320,23501,22006,10404,17750,26291,8049,24396,18504,17079,21310,21727,12045,13517,11724,12050,27982,14913,15819,10536,5952,9975,23568,13388,14811,11166,15558,10897,17167,1077,12451,18241,19338,9915,13953,4814,19145,10888,6766,10357,15132,14749,2017,11012,19701,2036,13844,15951,9027,11876,11456,13234,13048,20438,8153,10844,19449,15811,13008,21024,16292,8697,18240,15266,15675,19039,19485,13528,24109,13702,18760,5466,21327,39586,26583,28898,21669,6490,62246,36330,42635,38393,17175,74892,43924,53793,14250,66265,105259,24422,99523,20817,93260,25837,90046,156632,32141,116537,107822,114706,130458,186103,97141,183468,119717,149858,246155,307867,197356,266277,308056,199100,288956,315802,332503,326769,350013,246812,402732,348279,307219,386888,402110,392562,370059,355828,382691,412618,414433,401326,409300,366499,329517,348499,362406,343288,326123,310822,281860,263045,267174,276261,259269,254395,243777,222835,195815,208886,211553,179770,171726,174041,153485,126698,133228,134105,131371,121476,114537,101232,87345,91227,93896,91266,84695,65973,68400,62597,62226,67294,62409,60800,58588,53009,39096,54393,54319,51248,49052,49851,46643,37037,45699,48878,43360,47252,43296,40387,34067,43957,45674,34443,42648,41475,37676,30827,40215,67344,39072,38112,41283,36399,11723,56522,9460,69741,8007,44385,54793,21013,53580,19260,37961,51537,39922,74052,15245,23833,76346,6707,69063,17603,41655,37792,16289,53969,25579,40120,73020,15127,43600,30080,15571]}]}}]});

首先对开头和结尾进行处理,去除不符合json格式的数据。然后登陆网站:官网 选择json视图,把内容粘贴进去即可看到层级关系。

5、创建折线图

import json
from pyecharts.charts import Line
from pyecharts.options import TitleOpts,LegendOpts,ToolboxOpts,VisualMapOpts,TooltipOpts,LabelOpts
# 读取数据
f_us = open('美国.txt',"r",encoding="utf-8")
data_us = f_us.read()
f_jp = open('日本.txt',"r",encoding="utf-8")
data_jp = f_jp.read()
f_in = open('印度.txt',"r",encoding="utf-8")
data_in = f_in.read()
# 去掉不合json格式的开头
data_us=data_us.replace("jsonp_1629344292311_69436(","")
data_jp=data_jp.replace("jsonp_1629350871167_29498(","")
data_in=data_in.replace("jsonp_1629350745930_63180(","")
# 去掉不合json格式的结尾
data_us=data_us[:-2]
data_jp=data_jp[:-2]
data_in=data_in[:-2]
# 将json格式的数据转化为python字典
us_dict=json.loads(data_us)
jp_dict=json.loads(data_jp)
in_dict=json.loads(data_in)
# 获取trend key
us_dict=us_dict["data"][0]["trend"]
jp_dict=jp_dict["data"][0]["trend"]
in_dict=in_dict["data"][0]["trend"]
# 获取日期数据,用于x轴,取2020年
us_x_data = us_dict["updateDate"][:314]
jp_x_data = jp_dict["updateDate"][:314]
in_x_data = in_dict["updateDate"][:314]
# 获取确诊数据,用于y轴,到2020年
us_y_data = us_dict["list"][0]["data"][0:314]
jp_y_data = jp_dict["list"][0]["data"][0:314]
in_y_data = in_dict["list"][0]["data"][0:314]
# 生成图表
line = Line()
line.add_xaxis(us_x_data) # x轴上信息共用
line.add_yaxis("美国疫情确诊数", us_y_data,label_opts=LabelOpts(is_show=False))
line.add_yaxis("日本疫情确诊数", jp_y_data,label_opts=LabelOpts(is_show=False))
line.add_yaxis("印度疫情确诊数", in_y_data,label_opts=LabelOpts(is_show=False))
line.set_global_opts(title_opts=TitleOpts(title="美国、日本、印度疫情分析", pos_left="center", pos_bottom="1%"),  # 标题配置项legend_opts=LegendOpts(is_show=True),  # 图例配置项toolbox_opts=ToolboxOpts(is_show=True),  # 提示框配置项visualmap_opts=VisualMapOpts(is_show=True)  # 视觉映射配置项
)
line.render()
f_us.close()
f_jp.close()
f_in.close()

6、创建地图

# from pyecharts.charts import Map
# from pyecharts.options import VisualMapOpts
# map = Map()
# data=[
#     ("上海市",10),
#     ("台湾省",20),
#     ("河南省",100),
#     ("北京市",120)
# ]
# map.add("测试地图",data,"china")
# map.set_global_opts(
#     visualmap_opts=VisualMapOpts(
#         is_show=True,
#         is_piecewise=True,
#         pieces=[
#             {"min":1,"max":9,"label":"1-9人","color":"#CCFFFF"},
#             {"min":10,"max":99,"label":"10-99人","color":"#FFFF99"},
#             {"min":100,"max":499,"label":"100-499人","color":"FF9966"},
#             {"min":500,"max":999,"label":"500-999人","color":"FF9966"},
#             {"min":1000,"max":9999,"label":"1000-9999人","color":"FF9966"},
#             {"min":10000,"label":"10000人以上","color":"FF9966"},
#         ]
#     )
# )
# map.render("map2.html")

国内疫情构建:

import json
from pyecharts.charts import Map
from pyecharts.options import VisualMapOpts,TitleOpts
f = open("疫情.txt","r",encoding="utf-8")
data=f.read()
data_dict=json.loads(data)
province_data_list = data_dict["areaTree"][0]["children"]
data_list=[]
for province_data in province_data_list:province_name = province_data["name"]if province_name  in "北京上海重庆天津":province_name += "市"else:province_name += "省"province_confirm = province_data["total"]["confirm"]data_list.append((province_name,province_confirm))
map = Map()
map.add("各地疫情确诊人数",data_list,"china")
map.set_global_opts(title_opts = TitleOpts(title="全国疫情地图"),visualmap_opts=VisualMapOpts(is_show=True,is_piecewise=True,pieces=[{"min":1,"max":99,"label":"1-99人","color":"#CCFFFF"},{"min":100,"max":999,"label":"100-999人","color":"#FFFF99"},{"min":1000,"max":4999,"label":"1000-4999人","color":"FF9966"},{"min":5000,"max":9999,"label":"5000-9999人","color":"FF6666"},{"min":10000,"max":99999,"label":"10000-99999人","color":"FF3333"},{"min":100000,"label":"100000人以上","color":"990033"},])
)
map.render("全国疫情地图.html")
f.close()

7、创建柱状图

柱状图构建:

from pyecharts.charts import Bar
from pyecharts.options import *
# 构建柱状图对象
bar = Bar()
# 添加x轴
bar.add_xaxis(["中国","美国","英国"])
# 添加y轴
bar.add_yaxis("GDP",[30,20,10],label_opts=LabelOpts(position="right"
))
# 反转x轴与y轴
bar.reversal_axis()
# 绘图
bar.render("bar_json.html")

创建时间线:

· Timeline( )-时间线

柱状图描述的是分类数据,回答的是每一个分类中有多少这个问题。这是柱状图的主要特点,同时柱状图很难动态地描述一个趋势性的数据。这里pyecharts为我们提供了一种解决方案-时间线

如果说一个Bar、Line对象是一张图表的话,时间线就是创建一个一维x轴,轴上每一个点就是一个图表对象。

# 创建时间线
from pyecharts.charts import Bar,Timeline
from pyecharts.options import *
from pyecharts.globals import ThemeType
bar1 = Bar()
bar1.add_xaxis(["中国","美国","英国"])
bar1.add_yaxis("GDP",[30,20,10],label_opts=LabelOpts(position="right"))
bar1.reversal_axis()
bar2 = Bar()
bar2.add_xaxis(["中国","美国","英国"])
bar2.add_yaxis("GDP",[90,70,50],label_opts=LabelOpts(position="right"))
bar2.reversal_axis()# 创建时间线对象,并设置主题
timeline = Timeline({"theme":ThemeType.LIGHT})
# timeline对象添加bar柱状图
timeline.add(bar1,"2021年GDP")
timeline.add(bar2,"2022年GDP")
# 设置自动播报
timeline.add_schema(play_interval=1000, # 自动播报的时间间隔,单位为毫秒is_time_line=True,  # 是否在自动播报的时间,显示时间线is_auto_play=True,  # 是否自动播报is_loop_play=True,  # 是否循环自动播报
)
# 通过时间线绘图
timeline.render()

列表的sort方法: 

在数据容器中学习过sorted函数,可以对数据容器进行排序。在后面的数据处理中,我们需要对列表进行排序,并指定排序规则,sorted函数就无法完成了。这个时候就用到sort方法:

列表.sort(key=选择排序依据的函数,reverse=True|False)

· 参数key,是要求传入一个函数,表示将列表的每一个元素都传入函数中,返回排序的依据

· 参数reverse,是否反转排序结果,True表示降序,False表示升序

# sort方法:
my_list = [["a",33],["b",55],["c",11]]
def choose_sort_key(element):return element[1]
my_list.sort(key=choose_sort_key,reverse=True)
print(my_list)

案例:实现1960-2019年各国GDP动态柱状图的变化趋势

# 导包
from pyecharts.charts import Bar,Timeline
from pyecharts.options import *
from pyecharts.globals import ThemeType
# 读取文件
f=open("1960-2019全球GDP数据.csv","r",encoding="GB2312")
data_lines=f.readlines()
f.close()
# 删除第一行数据
data_lines.pop(0)
# 将数据转化为字典
data_dict={}
for line in data_lines:year=int(line.split(",")[0]) # 每一行的的年份country=line.split(",")[1] # 每一行的国家GDP=float(line.split(",")[2]) # 每一行的gdp,用float来表示其中的科学计数法# 判断字典中是否有指定的keytry:data_dict[year].append([country,GDP])except KeyError:data_dict[year]=[]data_dict[year].append([country,GDP])
# 创建时间线对象
timeline=Timeline({"theme":ThemeType.LIGHT})
# 排序年份:取出全部key
sorted_year_list=sorted(data_dict.keys())
for year in sorted_year_list:data_dict[year].sort(key=lambda x:x[1],reverse=True)# 取出本年份GDP排行前八的国家year_data=data_dict[year][0:8]x_data=[]y_data=[]for country_gdp in year_data:x_data.append(country_gdp[0]) # x轴添加国家y_data.append(country_gdp[1] / 100000000) # y轴添加gdp#构建柱状图对象bar=Bar()x_data.reverse()y_data.reverse()bar.add_xaxis(x_data)bar.add_yaxis("GDP(亿)",y_data,label_opts=LabelOpts(position="right"))# 反转x、y轴bar.reversal_axis()# 设置每一年图表的标题bar.set_global_opts(title_opts=TitleOpts(title=f"{year}年全球GDP总量排行情况"))timeline.add(bar,str(year))
# 设置时间线自动播报
timeline.add_schema(play_interval=1000,is_timeline_show=True,is_auto_play=True,is_loop_play=False
)
# 绘图
timeline.render("1960-2019年各国GDP总量排行.html")

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com