python pyecharts-将dataView语言更改为英语

gpfsuwkq  于 2023-05-21  发布在  Python
关注(0)|答案(1)|浏览(243)

如何将pyecharts数据视图文本和按钮从中文更改为英文?header and the 2 red buttons are on Chinese language.
下面是我使用的代码:
line_chart_Traffic_Vol_DL =
String(). add_xaxis(df3.Date.tolist())。add_yaxis('Traffic_Vol_DL',df3 ['Traffic_Vol_DL']. tolist(),is_smooth = True,is_connect_nones = True,linestyle_opts = opts. LineStyleOpts(color ='blue',width = 1),markline_opts = opts. MarkLineOpts(data =[opts. MarkLineItem(type_='average ')]),markpoint_opts = opts。MarkPointOpts(data =[opts. MarkPointItem(type_='max',name ='Max '),opts. MarkPointItem(type_='min',name ='Min ')]),). set_series_opts(areastyle_opts = opts. AreaStyleOpts(opacity = 0.05,color ='#c6f'),label_opts = opts. LabelOpts(is_show = False))。set_global_opts(title_opts = opts. TitleOpts(title ='Traffic_Vol_DL',subtitle ='GB'),datazoom_opts =[opts. DataZoomOpts(),opts. DataZoomOpts(type_='inside')],tooltip_opts = opts. TooltipOpts(trigger ='axis'),legend_opts = opts. LegendOpts(is_show = False),toolbox_opts = opts。ToolboxOpts(is_show = True,feature =' restore':'title ':' Restore'},'saveAsImage':'title':'Save '},' dataView ':'title ':' data view'}}))#datazoom_opts = opts. DataZoomOpts(orient ="vertical"),#"dataZoom":{"yAxisIndex ":"none "},
将2个红色按钮和标题上的语言从中文更改为英文

kmbjn2e3

kmbjn2e31#

为了将语言从中文更改为英语,我做了以下操作,将set_global_opts更改为:

LineChart.set_global_opts(
        title_opts=opts.TitleOpts(title="Line Chart", subtitle="Subtitle"),
        toolbox_opts=opts.ToolboxOpts(
            feature=opts.ToolBoxFeatureOpts(
                save_as_image=opts.ToolBoxFeatureSaveAsImageOpts(title="Download as Image"),
                restore=opts.ToolBoxFeatureRestoreOpts(title="Restore"),
                data_view=opts.ToolBoxFeatureDataViewOpts(title="View Data", lang=["Data View", "Close", "Refresh"]),
                data_zoom=opts.ToolBoxFeatureDataZoomOpts(zoom_title="Zoom In",back_title="Zoom Out")
            
        )
    )
)

在指定的选项下,查找“标题”,当鼠标悬停在“标题”上时,您可以更改文本以匹配您想要的内容。PyeCharts GlobalOpts

相关问题