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

用的官网第一个示例,结果网页打开是个空白页面 #503

Closed
rwfy2000 opened this issue Apr 25, 2018 · 17 comments
Closed

用的官网第一个示例,结果网页打开是个空白页面 #503

rwfy2000 opened this issue Apr 25, 2018 · 17 comments

Comments

@rwfy2000
Copy link

环境:python3.6 pyecharts0.4.1 win7 64位

11

打开render.html,是个空白页面,各种浏览器试过一样,大神帮下吧。

@chenjiandongx
Copy link
Member

pip uninstall pyecharts -> pip install pyecharts==0.4.1 -U 试试

@rwfy2000
Copy link
Author

@chenjiandongx 试了pip uninstall pyecharts -> pip install pyecharts==0.4.1 -U ,还是一样空白。

@rwfy2000
Copy link
Author

@chenjiandongx 打开ie浏览器打开render.html提示echarts未定义。
我的临时解决方法如下:
1、在echarts官网下载了echarts.js文件。
2、将echarts.js文件放在py文件同目录下。
3、render.html源码里引用echarts.js。
`


<script src="echarts.js"></script>
<script type="text/javascript">

var myChart_76714d7f61674454a1241b067fedbaa3 = echarts.init(document.getElementById('76714d7f61674454a1241b067fedbaa3'), null, {renderer: 'canvas'});`

但是我每次都要这样吗?好麻烦啊。

@chfw
Copy link
Member

chfw commented Apr 26, 2018

发来你的pip freeze 的输出.

一定是你的环境问题哦

@rwfy2000
Copy link
Author

@chfw
C:\Users\LLQ>pip freeze
absl-py==0.2.0
astor==0.6.2
backcall==0.1.0
beautifulsoup4==4.6.0
bleach==1.5.0
certifi==2018.1.18
chardet==3.0.4
colorama==0.3.9
decorator==4.3.0
entrypoints==0.2.3
future==0.16.0
gast==0.2.0
grpcio==1.11.0
html5lib==0.9999999
idna==2.6
ipykernel==4.8.2
ipython==6.3.1
ipython-genutils==0.2.0
ipywidgets==7.2.1
jedi==0.12.0
Jinja2==2.10
jsonschema==2.6.0
jupyter-client==5.2.3
jupyter-core==4.4.0
jupyter-echarts-pypkg==0.1.0
lml==0.0.2
lxml==4.2.1
Markdown==2.6.11
MarkupSafe==1.0
mistune==0.8.3
nbconvert==5.3.1
nbformat==4.4.0
notebook==5.4.1
numpy==1.14.2
pandocfilters==1.4.2
parso==0.2.0
pickleshare==0.7.4
Pillow==5.1.0
prompt-toolkit==1.0.15
protobuf==3.5.2.post1
pyasn1==0.4.2
pyecharts==0.4.1
pyecharts-jupyter-installer==0.0.3
Pygments==2.2.0
pymongo==3.6.1
python-dateutil==2.7.2
pywinpty==0.5.1
pyzmq==17.0.0
requests==2.18.4
rsa==3.4.2
Send2Trash==1.5.0
simplegeneric==0.8.1
six==1.11.0
tensorboard==1.7.0
tensorflow==1.7.0
termcolor==1.1.0
terminado==0.8.1
testpath==0.3.1
tornado==5.0.2
traitlets==4.3.2
urllib3==1.22
wcwidth==0.1.7
Werkzeug==0.14.1
widgetsnbextension==3.2.1

@chfw
Copy link
Member

chfw commented Apr 26, 2018

OK. In the same environment, please run your program and share you render.html here.

@rwfy2000
Copy link
Author

@chfw 不允许上传html文件,我重命名为txt了。
render.txt

@chfw
Copy link
Member

chfw commented Apr 26, 2018

import logging
import logging.config

logging.basicConfig(
    format='%(name)s:%(lineno)d - %(levelname)s - %(message)s',
    level=logging.DEBUG)

Please place above code before all of your sample code and then run it. Please show me the log file.

@rwfy2000
Copy link
Author

rwfy2000 commented Apr 27, 2018

@chfw 是这样吗?
33

控制台里的内容是这样:
C:\Python36\python.exe F:/code/pyecharts_1/pyechart_1.py
{
"title": [
{
"text": "\u6211\u7684\u7b2c\u4e00\u4e2a\u56fe\u8868",
"subtext": "\u8fd9\u91cc\u662f\u526f\u6807\u9898",
"left": "auto",
"top": "auto",
"textStyle": {
"color": "#000",
"fontSize": 18
},
"subtextStyle": {
"color": "#aaa",
"fontSize": 12
}
}
],
"toolbox": {
"show": true,
"orient": "vertical",
"left": "95%",
"top": "center",
"feature": {
"saveAsImage": {
"show": true,
"title": "\u4e0b\u8f7d\u56fe\u7247"
},
"restore": {
"show": true
},
"dataView": {
"show": true
}
}
},
"series_id": 8799860,
"tooltip": {
"trigger": "item",
"triggerOn": "mousemove|click",
"axisPointer": {
"type": "line"
},
"formatter": null,
"textStyle": {
"color": "#fff",
"fontSize": 14
},
"backgroundColor": "rgba(50,50,50,0.7)",
"borderColor": "#333",
"borderWidth": 0
},
"series": [
{
"type": "bar",
"name": "\u670d\u88c5",
"data": [
5,
20,
36,
10,
75,
90
],
"stack": "",
"barCategoryGap": "20%",
"label": {
"normal": {
"show": false,
"position": "top",
"textStyle": {
"color": "#000",
"fontSize": 12
},
"formatter": null
},
"emphasis": {
"show": true,
"position": null,
"textStyle": {
"color": "#fff",
"fontSize": 12
}
}
},
"markPoint": {
"data": []
},
"markLine": {
"data": []
},
"seriesId": 8799860
}
],
"legend": [
{
"data": [
"\u670d\u88c5"
],
"selectedMode": "multiple",
"show": true,
"left": "center",
"top": "top",
"orient": "horizontal",
"textStyle": {
"fontSize": 12,
"color": "#333"
}
}
],
"backgroundColor": "#fff",
"xAxis": [
{
"name": "",
"show": true,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisLabel": {
"interval": "auto",
"rotate": 0,
"margin": 8,
"textStyle": {
"fontSize": 12,
"color": "#000"
}
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"position": null,
"boundaryGap": true,
"min": null,
"max": null,
"data": [
"\u886c\u886b",
"\u7f8a\u6bdb\u886b",
"\u96ea\u7eba\u886b",
"\u88e4\u5b50",
"\u9ad8\u8ddf\u978b",
"\u889c\u5b50"
],
"type": "category"
}
],
"yAxis": [
{
"name": "",
"show": true,
"nameLocation": "middle",
"nameGap": 25,
"nameTextStyle": {
"fontSize": 14
},
"axisLabel": {
"formatter": "{value} ",
"rotate": 0,
"interval": "auto",
"margin": 8,
"textStyle": {
"fontSize": 12,
"color": "#000"
}
},
"axisTick": {
"alignWithLabel": false
},
"inverse": false,
"position": null,
"boundaryGap": true,
"min": null,
"max": null,
"splitLine": {
"show": true
},
"type": "value"
}
],
"color": [
"#c23531",
"#2f4554",
"#61a0a8",
"#d48265",
"#749f83",
"#ca8622",
"#bda29a",
"#6e7074",
"#546570",
"#c4ccd3",
"#f05b72",
"#ef5b9c",
"#f47920",
"#905a3d",
"#fab27b",
"#2a5caa",
"#444693",
"#726930",
"#b2d235",
"#6d8346",
"#ac6767",
"#1d953f",
"#6950a1",
"#918597",
"#f6f5ec"
]
}

Process finished with exit code 0

@chfw
Copy link
Member

chfw commented Apr 27, 2018

#coding=utf-8
from __future__ import unicode_literals
import logging
import logging.config

logging.basicConfig(
    format='%(name)s:%(lineno)d - %(levelname)s - %(message)s',
    level=logging.DEBUG)

from pyecharts import Bar

bar = Bar("我的第一个图表", "这里是副标题")
bar.add("服装", ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90])
bar.render()



@rwfy2000
Copy link
Author

@chfw ,按你的写法,提示如下:

C:\Python36\python.exe F:/code/pyecharts_1/pyechart_1.py
lml.plugin:328 - DEBUG - declare 'pyecharts_js_extension' plugin manager
lml.loader:54 - DEBUG - scanning for plugins...
lml.utils:51 - ERROR - failed to import jupyter_echarts_pypkg
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\lml\utils.py", line 43, in do_import
plugin_module = import(plugin_module_name)
ModuleNotFoundError: No module named 'jupyter_echarts_pypkg'
lml.loader:81 - DEBUG - jupyter_echarts_pypkg
lml.loader:82 - DEBUG - No module named 'jupyter_echarts_pypkg'
lml.loader:84 - DEBUG - scanning done

Process finished with exit code 0

@chfw
Copy link
Member

chfw commented Apr 27, 2018

ModuleNotFoundError: No module named 'jupyter_echarts_pypkg'

先卸载

pip uninstall jupyter-echarts-pypkg

再装,再试试。

pip install jupyter-echarts-pypkg

@rwfy2000
Copy link
Author

@chfw 卸载后,再安装,发现安装的版本是0.1.1,不是原来的0.1.0
44

@rwfy2000
Copy link
Author

@chfw 现在正常了,感谢不耐其烦的帮助!

@chfw
Copy link
Member

chfw commented Apr 27, 2018

In conclusion: jupyter-echarts-pypkg is not installed properly, although it appears to be so (pip freeze).

The following line produces empty output because no jupyter-echarts-pypkg found:

https://github.com/pyecharts/pyecharts/blob/master/pyecharts/templates/simple_chart.html#L6

@FrebEaton
Copy link

我运行官网的第一个例子,报这个错,应该怎么解决啊

Exception has occurred: FileNotFoundError
[Errno 2] No such file or directory: '/usr/local/lib/python3.6/dist-packages/jupyter_echarts_pypkg/resources/registry.json'

@FrebEaton
Copy link

重新安装 jupyter-echarts-pypkg库,终于解决了问题

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

4 participants