1. import itertools
    2. from ... import options as opts
    3. from ... import types
    4. from ...charts.chart import RectChart
    5. from ...globals import ChartType
    6. class Scatter(RectChart):
    7. """
    8. <<< Scatter >>>
    9. The scatter diagram on the rectangular coordinate system can be used to
    10. show the relationship between x and y of the data. If the data item has
    11. multiple dimensions, it can be represented by color, and the
    12. visualmap component can be used.
    13. """
    14. def add_yaxis(
    15. self,
    16. series_name: str,
    17. y_axis: types.Sequence,
    18. *,
    19. is_selected: bool = True,
    20. xaxis_index: types.Optional[types.Numeric] = None,
    21. yaxis_index: types.Optional[types.Numeric] = None,
    22. color: types.Optional[str] = None,
    23. symbol: types.Optional[str] = None,
    24. symbol_size: types.Union[types.Numeric, types.Sequence] = 10,
    25. label_opts: types.Label = opts.LabelOpts(position="right"),
    26. markpoint_opts: types.MarkPoint = None,
    27. markline_opts: types.MarkLine = None,
    28. tooltip_opts: types.Tooltip = None,
    29. itemstyle_opts: types.ItemStyle = None,
    30. ):
    31. self._append_color(color)
    32. self._append_legend(series_name, is_selected)
    33. if len(y_axis) > 0 and isinstance(y_axis[0], types.Sequence):
    34. data = [
    35. list(itertools.chain(list([x]), y))
    36. for x, y in zip(self._xaxis_data, y_axis)
    37. ]
    38. else:
    39. data = [list(z) for z in zip(self._xaxis_data, y_axis)]
    40. self.options.get("series").append(
    41. {
    42. "type": ChartType.SCATTER,
    43. "name": series_name,
    44. "xAxisIndex": xaxis_index,
    45. "yAxisIndex": yaxis_index,
    46. "symbol": symbol,
    47. "symbolSize": symbol_size,
    48. "data": data,
    49. "label": label_opts,
    50. "markPoint": markpoint_opts,
    51. "markLine": markline_opts,
    52. "tooltip": tooltip_opts,
    53. "itemStyle": itemstyle_opts,
    54. }
    55. )
    56. return self

    class pyecharts.charts.Scatter(RectChart)

    class Scatter(
        # 初始化配置项,参考 `global_options.InitOpts`
        init_opts: opts.InitOpts = opts.InitOpts()
    )
    

    func pyecharts.charts.Scatter.add_yaxis

    def add_yaxis(
        # 系列名称,用于 tooltip 的显示,legend 的图例筛选。
        series_name: str,
    
        # 系列数据
        y_axis: Sequence,
    
        # 是否选中图例
        is_selected: bool = True,
    
        # 使用的 x 轴的 index,在单个图表实例中存在多个 x 轴的时候有用。
        xaxis_index: Optional[Numeric] = None,
    
        # 使用的 y 轴的 index,在单个图表实例中存在多个 y 轴的时候有用。
        yaxis_index: Optional[Numeric] = None,
    
        # 系列 label 颜色
        color: Optional[str] = None,
    
        # 标记的图形。
        # ECharts 提供的标记类型包括 'circle', 'rect', 'roundRect', 'triangle', 
        # 'diamond', 'pin', 'arrow', 'none'
        # 可以通过 'image://url' 设置为图片,其中 URL 为图片的链接,或者 dataURI。
        symbol: Optional[str] = None,
    
        # 标记的大小,可以设置成诸如 10 这样单一的数字,也可以用数组分开表示宽和高,
        # 例如 [20, 10] 表示标记宽为 20,高为 10。
        symbol_size: Numeric = 10,
    
        # 标记的旋转角度。注意在 markLine 中当 symbol 为 'arrow' 时会忽略 symbolRotate 强制设置为切线的角度。
        symbol_rotate: types.Optional[types.Numeric] = None,
    
        # 标签配置项,参考 `series_options.LabelOpts`
        label_opts: Union[opts.LabelOpts, dict] = opts.LabelOpts(position="right"),
    
        # 标记点配置项,参考 `series_options.MarkPointOpts`
        markpoint_opts: Union[opts.MarkPointOpts, dict, None] = None,
    
        # 标记线配置项,参考 `series_options.MarkLineOpts`
        markline_opts: Union[opts.MarkLineOpts, dict, None] = None,
    
        # 提示框组件配置项,参考 `series_options.TooltipOpts`
        tooltip_opts: Union[opts.TooltipOpts, dict, None] = None,
    
        # 图元样式配置项,参考 `series_options.ItemStyleOpts`
        itemstyle_opts: Union[opts.ItemStyleOpts, dict, None] = None,
    
        # 可以定义 data 的哪个维度被编码成什么。
        encode: types.Union[types.JSFunc, dict, None] = None,
    )