Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

主题河流图不支持修改x轴字体大小 #2176

Closed
zhijuyingfeng opened this issue Apr 21, 2023 · 3 comments
Closed

主题河流图不支持修改x轴字体大小 #2176

zhijuyingfeng opened this issue Apr 21, 2023 · 3 comments
Assignees

Comments

@zhijuyingfeng
Copy link

zhijuyingfeng commented Apr 21, 2023

问题
主题河流图不支持修改x轴字体大小。运行官网提供的河流图Demo,并尝试通过set_global_opts修改x轴字体,发现无法生效,x轴字体大小未发生改变。

The ThemeRiver doesn't support customizing config of x axis. Run the ThemeRiver demo offered by offical site, then try to change font of the label of x axis, but it doesn't work. The font size of x axis label remains unchanged.

运行环境(系统环境及 pyecharts 版本)
OS: Linux fedora 6.2.10-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 6 23:30:41 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Python: 3.11.2
Pyecharts: 2.0.3

代码及截图

(
    ThemeRiver()
    .add(
        series_name=x_data,
        data=y_data,
        singleaxis_opts=opts.SingleAxisOpts(
            pos_top="50", pos_bottom="50", type_="time"
        ),
    )
    .set_global_opts(
        tooltip_opts=opts.TooltipOpts(trigger="axis", axis_pointer_type="line"),
        xaxis_opts=opts.AxisOpts(
            axislabel_opts=opts.LabelOpts(
                font_size=34
            )
        )
    )
    .render("theme_river.html")
)

可能原因

# chart.py

    def set_global_opts(
        self,
        ...
        xaxis_opts: types.Axis = None,
        yaxis_opts: types.Axis = None,
        ...
    ):
        ...

        if xaxis_opts and self.options.get("xAxis", None):
            if isinstance(xaxis_opts, opts.AxisOpts):
                xaxis_opts = xaxis_opts.opts

            # 此处self.options["xAxis"]为None
            self.options["xAxis"][0].update(xaxis_opts)

        if yaxis_opts and self.options.get("yAxis", None):
            if isinstance(yaxis_opts, opts.AxisOpts):
                yaxis_opts = yaxis_opts.opts
            self.options["yAxis"][0].update(yaxis_opts)

        return self
@sunhailin-Leo
Copy link
Member

@zhijuyingfeng

  • 具体指的是哪一块?截图说明一下

@zhijuyingfeng
Copy link
Author

@zhijuyingfeng

  • 具体指的是哪一块?截图说明一下

image

@sunhailin-Leo
Copy link
Member

sunhailin-Leo commented Apr 25, 2023

@zhijuyingfeng

  • ThemeRiver 得通过 SingleAxisOpts 去修改,而不是 xaxis_opts.
  • 现在 SingleAxisOpts 这块没有相关的配置,下个版本会加上哈~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants