# -*- coding:utf-8 -*-
# 2022-1-14
# 作者:小蓝枣
# pyecharts地图
# 需要引用的库
from pyecharts import options as opts
from pyecharts.charts import Map
import random
# 设置奥特曼所存在的相关省份,并设置初始数量为0
ultraman = [
['四川', 0],
['台湾', 0],
['新疆', 0],
['江西', 0],
['河南', 0],
['辽宁', 0],
['西藏', 0]
]
# 设置怪兽存在的相关省份,并设置初始数量为0
monster = [
['广东', 0],
['北京', 0],
['上海', 0],
['江西', 0],
['湖南', 0],
['浙江', 0],
['江苏', 0]
]
def data_filling(array):
    ''' 
     作用:给数组数据填充随机数
    '''
    for i in array:
        # 随机生成1到1000的随机数
        i[1] = random.randint(1,1000)
        print(i)
data_filling(ultraman)
data_filling(monster)
def create_china_map():
    ''' 
     作用:生成中国地图
    '''
    (
        Map()
        .add(
            series_name="奥特曼", 
            data_pair=ultraman, 
            maptype="china", 
        )
        .add(
            series_name="怪兽", 
            data_pair=monster, 
            maptype="china", 
        )
        # 设置标题
        .set_global_opts(title_opts=opts.TitleOpts(title="中国地图"))
        # 生成