Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pyecharts/pyecharts
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiandongx committed Jul 13, 2019
2 parents 0293565 + 5c2087b commit 9718d17
Show file tree
Hide file tree
Showing 110 changed files with 2,382 additions and 619 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

custom: https://pyecharts.org/#/zh-cn/donate
81 changes: 81 additions & 0 deletions example/bar_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pyecharts import options as opts
from pyecharts.charts import Bar, Page
from pyecharts.commons.utils import JsCode
from pyecharts.globals import ThemeType

C = Collector()

Expand All @@ -18,6 +19,71 @@ def bar_base() -> Bar:
return c


@C.funcs
def bar_base_with_animation() -> Bar:
c = (
Bar(
init_opts=opts.InitOpts(
animation_opts=opts.AnimationOpts(
animation_delay=1000, animation_easing="elasticOut"
)
)
)
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values())
.set_global_opts(
title_opts=opts.TitleOpts(title="Bar-动画配置基本示例", subtitle="我是副标题")
)
)
return c


@C.funcs
def bar_base_with_custom_background_image() -> Bar:
c = (
Bar(
init_opts=opts.InitOpts(
bg_color={
"type": "pattern",
"image": JsCode("img"),
"repeat": "no-repeat",
}
)
)
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values())
.set_global_opts(
title_opts=opts.TitleOpts(
title="Bar-背景图基本示例",
subtitle="我是副标题",
title_textstyle_opts=opts.TextStyleOpts(color="white"),
)
)
)
c.add_js_funcs(
"""
var img = new Image(); img.src = 'https://s2.ax1x.com/2019/07/08/ZsS0fK.jpg';
"""
)
return c


@C.funcs
def bar_base_dict_config() -> Bar:
c = (
Bar({"theme": ThemeType.MACARONS})
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values())
.set_global_opts(
title_opts={"text": "Bar-通过 dict 进行配置", "subtext": "我也是通过 dict 进行配置的"}
)
)
return c


@C.funcs
def bar_is_selected() -> Bar:
c = (
Expand Down Expand Up @@ -398,4 +464,19 @@ def bar_graphic_component() -> Bar:
return c


@C.funcs
def bar_with_brush() -> Bar:
c = (
Bar()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values())
.add_yaxis("商家B", Faker.values())
.set_global_opts(
title_opts=opts.TitleOpts(title="Bar-Brush示例", subtitle="我是副标题"),
brush_opts=opts.BrushOpts(),
)
)
return c


Page().add(*[fn() for fn, _ in C.charts]).render()
238 changes: 238 additions & 0 deletions example/commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,241 @@ class Collector:
@staticmethod
def funcs(fn):
Collector.charts.append((fn, fn.__name__))


POPULATION = [
["Country (or dependency)", "Population\n(2019)"],
["China", 1420062022],
["India", 1368737513],
["United States", 329093110],
["Indonesia", 269536482],
["Brazil", 212392717],
["Pakistan", 204596442],
["Nigeria", 200962417],
["Bangladesh", 168065920],
["Russia", 143895551],
["Mexico", 132328035],
["Japan", 126854745],
["Ethiopia", 110135635],
["Philippines", 108106310],
["Egypt", 101168745],
["Vietnam", 97429061],
["DR Congo", 86727573],
["Turkey", 82961805],
["Iran", 82820766],
["Germany", 82438639],
["Thailand", 69306160],
["United Kingdom", 66959016],
["France", 65480710],
["Tanzania", 60913557],
["Italy", 59216525],
["South Africa", 58065097],
["Myanmar", 54336138],
["Kenya", 52214791],
["South Korea", 51339238],
["Colombia", 49849818],
["Spain", 46441049],
["Uganda", 45711874],
["Argentina", 45101781],
["Ukraine", 43795220],
["Algeria", 42679018],
["Sudan", 42514094],
["Iraq", 40412299],
["Poland", 38028278],
["Canada", 37279811],
["Afghanistan", 37209007],
["Morocco", 36635156],
["Saudi Arabia", 34140662],
["Peru", 32933835],
["Uzbekistan", 32807368],
["Venezuela", 32779868],
["Malaysia", 32454455],
["Angola", 31787566],
["Mozambique", 31408823],
["Ghana", 30096970],
["Nepal", 29942018],
["Yemen", 29579986],
["Madagascar", 26969642],
["North Korea", 25727408],
["Côte d'Ivoire", 25531083],
["Cameroon", 25312993],
["Australia", 25088636],
["Taiwan", 23758247],
["Niger", 23176691],
["Sri Lanka", 21018859],
["Burkina Faso", 20321560],
["Malawi", 19718743],
["Mali", 19689140],
["Romania", 19483360],
["Kazakhstan", 18592970],
["Syria", 18499181],
["Chile", 18336653],
["Zambia", 18137369],
["Guatemala", 17577842],
["Zimbabwe", 17297495],
["Netherlands", 17132908],
["Ecuador", 17100444],
["Senegal", 16743859],
["Cambodia", 16482646],
["Chad", 15814345],
["Somalia", 15636171],
["Guinea", 13398180],
["South Sudan", 13263184],
["Rwanda", 12794412],
["Benin", 11801595],
["Tunisia", 11783168],
["Burundi", 11575964],
["Belgium", 11562784],
["Cuba", 11492046],
["Bolivia", 11379861],
["Haiti", 11242856],
["Greece", 11124603],
["Dominican Republic", 10996774],
["Czechia", 10630589],
["Portugal", 10254666],
["Jordan", 10069794],
["Sweden", 10053135],
["Azerbaijan", 10014575],
["United Arab Emirates", 9682088],
["Hungary", 9655361],
["Honduras", 9568688],
["Belarus", 9433874],
["Tajikistan", 9292000],
["Austria", 8766201],
["Serbia", 8733407],
["Switzerland", 8608259],
["Papua New Guinea", 8586525],
["Israel", 8583916],
["Togo", 8186384],
["Sierra Leone", 7883123],
["Hong Kong", 7490776],
["Laos", 7064242],
["Bulgaria", 6988739],
["Paraguay", 6981981],
["Libya", 6569864],
["El Salvador", 6445405],
["Nicaragua", 6351157],
["Kyrgyzstan", 6218616],
["Lebanon", 6065922],
["Turkmenistan", 5942561],
["Singapore", 5868104],
["Denmark", 5775224],
["Finland", 5561389],
["Congo", 5542197],
["Slovakia", 5450987],
["Norway", 5400916],
["Eritrea", 5309659],
["State of Palestine", 5186790],
["Oman", 5001875],
["Costa Rica", 4999384],
["Liberia", 4977720],
["Ireland", 4847139],
["Central African Republic", 4825711],
["New Zealand", 4792409],
["Mauritania", 4661149],
["Kuwait", 4248974],
["Panama", 4226197],
["Croatia", 4140148],
["Moldova", 4029750],
["Georgia", 3904204],
["Puerto Rico", 3654978],
["Bosnia and Herzegovina", 3501774],
["Uruguay", 3482156],
["Mongolia", 3166244],
["Albania", 2938428],
["Armenia", 2936706],
["Jamaica", 2906339],
["Lithuania", 2864459],
["Qatar", 2743901],
["Namibia", 2641996],
["Botswana", 2374636],
["Lesotho", 2292682],
["Gambia", 2228075],
["Gabon", 2109099],
["North Macedonia", 2086720],
["Slovenia", 2081900],
["Guinea-Bissau", 1953723],
["Latvia", 1911108],
["Bahrain", 1637896],
["Swaziland", 1415414],
["Trinidad and Tobago", 1375443],
["Equatorial Guinea", 1360104],
["Timor-Leste", 1352360],
["Estonia", 1303798],
["Mauritius", 1271368],
["Cyprus", 1198427],
["Djibouti", 985690],
["Fiji", 918757],
["Réunion", 889918],
["Comoros", 850910],
["Bhutan", 826229],
["Guyana", 786508],
["Macao", 642090],
["Solomon Islands", 635254],
["Montenegro", 629355],
["Luxembourg", 596992],
["Western Sahara", 582478],
["Suriname", 573085],
["Cabo Verde", 560349],
["Micronesia", 536579],
["Maldives", 451738],
["Guadeloupe", 448798],
["Brunei", 439336],
["Malta", 433245],
["Bahamas", 403095],
["Belize", 390231],
["Martinique", 385320],
["Iceland", 340566],
["French Guiana", 296847],
["French Polynesia", 288506],
["Vanuatu", 288017],
["Barbados", 287010],
["New Caledonia", 283376],
["Mayotte", 266380],
["Sao Tome & Principe", 213379],
["Samoa", 198909],
["Saint Lucia", 180454],
["Guam", 167245],
["Channel Islands", 166828],
["Curaçao", 162547],
["Kiribati", 120428],
["St. Vincent & Grenadines", 110488],
["Tonga", 110041],
["Grenada", 108825],
["Aruba", 106053],
["U.S. Virgin Islands", 104909],
["Antigua and Barbuda", 104084],
["Seychelles", 95702],
["Isle of Man", 85369],
["Andorra", 77072],
["Dominica", 74679],
["Cayman Islands", 63129],
["Bermuda", 60833],
["Greenland", 56673],
["Saint Kitts & Nevis", 56345],
["American Samoa", 55727],
["Northern Mariana Islands", 55246],
["Marshall Islands", 53211],
["Faeroe Islands", 49692],
["Sint Maarten", 40939],
["Monaco", 39102],
["Liechtenstein", 38404],
["Turks and Caicos", 36461],
["Gibraltar", 34879],
["San Marino", 33683],
["British Virgin Islands", 32206],
["Caribbean Netherlands", 25971],
["Palau", 22206],
["Cook Islands", 17462],
["Anguilla", 15174],
["Wallis & Futuna", 11617],
["Tuvalu", 11393],
["Nauru", 11260],
["Saint Pierre & Miquelon", 6375],
["Montserrat", 5220],
["Saint Helena", 4096],
["Falkland Islands", 2921],
["Niue", 1628],
["Tokelau", 1340],
["Holy See", 799],
]
12 changes: 12 additions & 0 deletions example/echarts_china_counties_js_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pyecharts import options as opts
from pyecharts.charts import Geo
from pyecharts.datasets import register_url

register_url("https://echarts-maps.github.io/echarts-china-counties-js/")

g = (
Geo()
.add_schema(maptype="海淀区")
.set_global_opts(title_opts=opts.TitleOpts(title="海淀区"))
)
g.render()
12 changes: 12 additions & 0 deletions example/echarts_countries_js_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pyecharts import options as opts
from pyecharts.charts import Geo
from pyecharts.datasets import register_url

register_url("https://echarts-maps.github.io/echarts-countries-js/")

g = (
Geo()
.add_schema(maptype="瑞士")
.set_global_opts(title_opts=opts.TitleOpts(title="瑞士"))
)
g.render()
Loading

0 comments on commit 9718d17

Please sign in to comment.