1. from ... import options as opts
    2. from ... import types
    3. from ...charts.chart import RectChart
    4. from ...globals import ChartType
    5. class Kline(RectChart):
    6. """
    7. <<< K-line >>>
    8. K-line shows the highest value, the lowest value,
    9. the starting value and the ending value of the data on the day,
    10. which is used to show the daily fluctuation of the data or
    11. the fluctuation of a certain period.
    12. """
    13. def __init__(self, init_opts: types.Init = opts.InitOpts()):
    14. super().__init__(init_opts=init_opts)
    15. self.set_global_opts(
    16. xaxis_opts=opts.AxisOpts(is_scale=True),
    17. yaxis_opts=opts.AxisOpts(is_scale=True),
    18. )
    19. def add_yaxis(
    20. self,
    21. series_name: str,
    22. y_axis: types.Sequence,
    23. *,
    24. is_selected: bool = True,
    25. xaxis_index: types.Optional[types.Numeric] = None,
    26. yaxis_index: types.Optional[types.Numeric] = None,
    27. markline_opts: types.MarkLine = None,
    28. markpoint_opts: types.MarkPoint = None,
    29. tooltip_opts: types.Tooltip = None,
    30. itemstyle_opts: types.ItemStyle = None,
    31. ):
    32. self._append_legend(series_name, is_selected)
    33. self.options.get("series").append(
    34. {
    35. "type": ChartType.KLINE,
    36. "name": series_name,
    37. "xAxisIndex": xaxis_index,
    38. "yAxisIndex": yaxis_index,
    39. "data": y_axis,
    40. "markPoint": markpoint_opts,
    41. "markLine": markline_opts,
    42. "tooltip": tooltip_opts,
    43. "itemStyle": itemstyle_opts,
    44. }
    45. )
    46. return self

    class pyecharts.charts.Kline(RectChart)

    1. class Kline(
    2. # 初始化配置项,参考 `global_options.InitOpts`
    3. init_opts: opts.InitOpts = opts.InitOpts()
    4. )

    func pyecharts.charts.Kline.add_yaxis

    1. def add_yaxis(
    2. # 系列名称,用于 tooltip 的显示,legend 的图例筛选。
    3. series_name: str,
    4. # 系列数据
    5. y_axis: Sequence,
    6. # 是否选中图例
    7. is_selected: bool = True,
    8. # 使用的 x 轴的 index,在单个图表实例中存在多个 x 轴的时候有用。
    9. xaxis_index: Optional[Numeric] = None,
    10. # 使用的 y 轴的 index,在单个图表实例中存在多个 y 轴的时候有用。
    11. yaxis_index: Optional[Numeric] = None,
    12. # 标记线配置项,参考 `series_options.MarkLineOpts`
    13. markline_opts: Union[opts.MarkLineOpts, dict, None] = None,
    14. # 标记点配置项,参考 `series_options.MarkPointOpts`
    15. markpoint_opts: Union[opts.MarkPointOpts, dict, None] = None,
    16. # 提示框组件配置项,参考 `series_options.TooltipOpts`
    17. tooltip_opts: Union[opts.TooltipOpts, dict, None] = None,
    18. # 图元样式配置项,参考 `series_options.ItemStyleOpts`
    19. itemstyle_opts: Union[opts.ItemStyleOpts, dict, None] = None,
    20. )



    _