class pyecharts.charts.Geo

    1. class Geo(
    2. # 初始化配置项,参考 `global_options.InitOpts`
    3. init_opts: opts.InitOpts = opts.InitOpts()
    4. # 是否忽略不存在的坐标,默认值为 False,即不忽略
    5. is_ignore_nonexistent_coord: bool = False
    6. )

    func pyecharts.charts.Geo.add_schema

    1. def add_schema(
    2. # 地图类型,具体参考 pyecharts.datasets.map_filenames.json 文件
    3. maptype: str = "china",
    4. # 是否开启鼠标缩放和平移漫游。
    5. is_roam: bool = True,
    6. # 当前视角的缩放比例。默认为 1
    7. zoom: Optional[Numeric] = None,
    8. # 当前视角的中心点,用经纬度表示。例如:center: [115.97, 29.71]
    9. center: Optional[Sequence] = None,
    10. # # 标签配置项,参考 `series_options.LabelOpts`
    11. label_opts: Union[opts.LabelOpts, dict, None] = None,
    12. # 地图区域的多边形 图形样式。
    13. itemstyle_opts: Union[opts.ItemStyleOpts, dict, None] =None,
    14. # 高亮状态下的多边形样式
    15. emphasis_itemstyle_opts: Union[opts.ItemStyleOpts, dict,None] = None,
    16. # 高亮状态下的标签样式。
    17. emphasis_label_opts: Union[opts.LabelOpts, dict, None] =None,
    18. ):

    func pyecharts.charts.Geo.add

    1. def add(
    2. # 系列名称,用于 tooltip 的显示,legend 的图例筛选。
    3. series_name: str,
    4. # 数据项 (坐标点名称,坐标点值)
    5. data_pair: Sequence,
    6. # Geo 图类型,有 scatter, effectScatter, heatmap, lines 4 种,建议使用
    7. # from pyecharts.globals import GeoType
    8. # GeoType.GeoType.EFFECT_SCATTER,GeoType.HEATMAP,GeoType.LINES
    9. type_: str = "scatter",
    10. # 是否选中图例
    11. is_selected: bool = True,
    12. # 标记图形形状
    13. symbol: Optional[str] = None,
    14. # 标记的大小
    15. symbol_size: Numeric = 12,
    16. # 每个点的大小,在地理坐标系(coordinateSystem: 'geo')上有效。
    17. blur_size: types.Numeric = 20,
    18. # 每个点模糊的大小,在地理坐标系(coordinateSystem: 'geo')上有效。
    19. point_size: types.Numeric = 20,
    20. # 系列 label 颜色
    21. color: Optional[str] = None,
    22. # 是否是多段线,在画 lines 图情况下
    23. is_polyline: bool = False,
    24. # 是否启用大规模线图的优化,在数据图形特别多的时候(>=5k)可以开启
    25. is_large: bool = False,
    26. # 特效尾迹的长度。取从 0 到 1 的值,数值越大尾迹越长。默认值 0.2
    27. trail_length: Numeric = 0.2,
    28. # 开启绘制优化的阈值。
    29. large_threshold: Numeric = 2000,
    30. # 配置该系列每一帧渲染的图形数
    31. progressive: types.Numeric = 400,
    32. # 启用渐进式渲染的图形数量阈值,在单个系列的图形数量超过该阈值时启用渐进式渲染。
    33. progressive_threshold: types.Numeric = 3000,
    34. # 标签配置项,参考 `series_options.LabelOpts`
    35. label_opts: Union[opts.LabelOpts, dict] = opts.LabelOpts(),
    36. # 涟漪特效配置项,参考 `series_options.EffectOpts`
    37. effect_opts: Union[opts.EffectOpts, dict] = opts.EffectOpts(),
    38. # 线样式配置项,参考 `series_options.LineStyleOpts`
    39. linestyle_opts: Union[opts.LineStyleOpts, dict] = opts.LineStyleOpts(),
    40. # 提示框组件配置项,参考 `series_options.TooltipOpts`
    41. tooltip_opts: Union[opts.TooltipOpts, dict, None] = None,
    42. # 图元样式配置项,参考 `series_options.ItemStyleOpts`
    43. itemstyle_opts: Union[opts.ItemStyleOpts, dict, None] = None,
    44. # 这个配置相对非常复杂(参照地址: https://www.echartsjs.com/zh/option.html#series-custom.renderItem)
    45. render_item: types.JsCode = None,
    46. # 这个配置相对非常复杂(参照地址: https://www.echartsjs.com/zh/option.html#series-custom.encode)
    47. encode: types.Union[types.JsCode, dict] = None,
    48. )

    func pyecharts.charts.Geo.add_coordinate
    新增一个坐标点

    1. def add_coordinate(
    2. # 坐标地点名称
    3. name: str,
    4. # 经度
    5. longitude: Numeric,
    6. # 纬度
    7. latitude: Numeric,
    8. )

    func pyecharts.charts.Geo.add_coordinate_json
    以 JOSN 文件格式新增多个坐标点

    1. def add_coordinate_json(
    2. # json 文件格式的坐标数据
    3. # 格式如下
    4. # {
    5. # "阿城": [126.58, 45.32],
    6. # "阿克苏": [80.19, 41.09]
    7. # }
    8. ],
    9. json_file: str
    10. )

    func pyecharts.charts.Geo.get_coordinate
    查询指定地点的坐标

    def get_coordinate(
        # 地点名称
        name: str
    ) -> Sequence
    

    Geo 图的坐标引用自 pyecharts.datasets.COORDINATESCOORDINATES 是一个支持模糊匹配的字典类。可设置匹配的阈值。

    from pyecharts.datasets import COORDINATES
    # cutoff 为匹配阈值,阈值越高相似性越高,1 为完全相同。默认为 0.6
    COORDINATES.cutoff = 0.75