Comments (2)
- 检查顺序:
- 查看浏览器控制台有没有错误提示
- 给出截图或复现问题的代码
from pyecharts.
经测试,应该是使用双坐标轴导致的问题
用于双坐标轴绘制的函数在一般情况下使用正常,但在Gird中出现问题
函数如下:
def add_dual_line(self, line_series, label='', line_series2=None, label2='', index=0):
""" 输入series"""
if isinstance(line_series, pd.Series):
x_axis = [x for x in line_series.index]
else:
x_axis = range(len(line_series))
symbol = 'emptyCircle'
if 'ma' in label:
symbol = 'None'
line_series = [LineItem(value=x, symbol=symbol) for x in line_series]
line_opacity = 0.8
line = Line(init_opts=opts.InitOpts(f'{PAGE_WIDTH}px'))
line.add_xaxis(xaxis_data=x_axis)
line.extend_axis(yaxis=opts.AxisOpts(name=label, type_='value', position="left", ))
line.add_yaxis(
series_name=label,
y_axis=line_series,
# symbol=symbol,
# xaxis_index=index,
# yaxis_index=index,
# is_smooth=True,
# linestyle_opts=opts.LineStyleOpts(width=2, opacity=line_opacity),
label_opts=opts.LabelOpts(is_show=False),
)
line.set_global_opts(
title_opts=opts.TitleOpts(title=label, is_show=True),
xaxis_opts=opts.AxisOpts(
type_='category',
is_scale=True,
boundary_gap=False,
axisline_opts=opts.AxisLineOpts(is_on_zero=False),
axistick_opts=opts.AxisTickOpts(is_show=False),
splitline_opts=opts.SplitLineOpts(is_show=True),
axislabel_opts=opts.LabelOpts(is_show=True),
split_number=20,
min_="dataMin",
max_="dataMax",
),
yaxis_opts=opts.AxisOpts(
is_scale=True,
split_number=2,
position='left',
axisline_opts=opts.AxisLineOpts(is_show=False),
axistick_opts=opts.AxisTickOpts(is_show=False),
splitline_opts=opts.SplitLineOpts(is_show=True),
axislabel_opts=opts.LabelOpts(is_show=True),
),
tooltip_opts=opts.TooltipOpts(
trigger="axis",
axis_pointer_type="cross",
background_color="rgba(245, 245, 245, 0.8)",
border_width=1,
border_color="#ccc",
textstyle_opts=opts.TextStyleOpts(color="#000"),
),
legend_opts=opts.LegendOpts(is_show=True, orient='vertical', pos_left='right', pos_bottom='10%'), )
if line_series2 is not None:
line.extend_axis(yaxis=opts.AxisOpts(name=label2, type_='value', position="right", ))
line2 = Line(init_opts=opts.InitOpts(f'{PAGE_WIDTH}px'))
line2.add_xaxis(xaxis_data=x_axis)
line2.extend_axis(yaxis=opts.AxisOpts(name=label2, type_='value', position="right", ))
line2.add_yaxis(
series_name=label2,
y_axis=[x for x in line_series2],
xaxis_index=index + 1,
yaxis_index=index + 1,
is_smooth=True,
is_hover_animation=False,
is_connect_nones=True,
linestyle_opts=opts.LineStyleOpts(width=2, opacity=line_opacity),
label_opts=opts.LabelOpts(is_show=False),
)
line2.set_global_opts(
yaxis_opts=opts.AxisOpts(
is_scale=True,
split_number=2,
position='right',
axisline_opts=opts.AxisLineOpts(is_show=False),
axistick_opts=opts.AxisTickOpts(is_show=False),
splitline_opts=opts.SplitLineOpts(is_show=True),
axislabel_opts=opts.LabelOpts(is_show=True),
), )
# legend_opts=opts.LegendOpts(is_show=True, pos_left='right', pos_bottom='10%'), )
line.overlap(line2)
return line
不显示的浏览器报错如下:
echarts.min.js:45 Uncaught TypeError: Cannot read properties of undefined (reading 'type')
at Object.reset (echarts.min.js:45:352188)
at t.ty [as _reset] (echarts.min.js:45:174667)
at t._doReset (echarts.min.js:45:135579)
at t.perform (echarts.min.js:45:134592)
at echarts.min.js:45:172579
at echarts.min.js:35:8394
at Map.forEach ()
at t.each (echarts.min.js:35:8369)
at echarts.min.js:45:172420
at Array.forEach ()
from pyecharts.
Related Issues (20)
- 使用前后端分离功能时geo和map的地图总是无法正常显示 HOT 1
- Feature Request: Offline Support for Pyecharts HOT 1
- Feautre request: Time support to stacked bar plots? HOT 1
- pyecharts.map可视化时如何向提示框中添加多组数据? HOT 1
- 使用自己构建的主题时,仅颜色等属性生效,坐标轴、线型等均无法正常显示
- 使用自己构建的主题时,线型、平滑等样式无效 HOT 7
- How to set bubble marker on all bars in bar chart HOT 3
- script error when using 3D charts in Databricks notebook HOT 1
- 折线图在x轴有重复值的时候会导致折线错位 HOT 1
- 怎么让关系图连接线动起来 HOT 1
- Pyecharts not displaying in Jupyter Notebooks even though they do in Jupyter Lab HOT 3
- 能否直接通过一个option字典完成对图表的描述 HOT 1
- 无法修改地图的长宽比例 HOT 1
- Map或自定义多边形下钻 HOT 3
- 日历图设置name_map='cn'后,调用.render_notebook()仍然显示英文月份和星期 HOT 5
- class ParallelItem is missing from pyecharts.opts HOT 1
- geo生成的html显示纬度数据而非指定数据 HOT 4
- 桑基图中edge_label_opt属性设置文字位置失效 HOT 2
- 3d曲面图放在时间轴里无法显示 HOT 1
- pyecharts支持自定义图吗 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyecharts.