Skip to content

Commit

Permalink
Fix: 修复 notebook 不能正常显示的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiandongx committed Mar 24, 2019
1 parent dd281c9 commit 46aa05a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include pyecharts/datasets/*.json
include pyecharts/templates/*.html
include pyecharts/render/templates/*
include README.md
include changelog.md
4 changes: 2 additions & 2 deletions pyecharts/commons/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def filter_js_func(fn: str) -> str:
def produce_require_dict(js_dependencies, js_host) -> dict:
confs, libraries = [], []
for name in js_dependencies.items:
confs.append("'{}':'{}/{}'".format(name, js_host, FILENAMES[name]))
libraries = ["'{}'".format(name)]
confs.append("'{}':'{}{}'".format(name, js_host, FILENAMES[name]))
libraries.append("'{}'".format(name))
return dict(config_items=confs, libraries=libraries)


Expand Down
11 changes: 8 additions & 3 deletions pyecharts/render/templates/notebook.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% import 'macro' as macro %}
<script>
require.config({
paths: {
Expand All @@ -14,8 +13,14 @@

<script>
require([{{ libraries | join(', ') }}], function(echarts) {
{% for chart in charts %}
{{ macro.render_chart_content(chart) }}
{% for c in charts %}
var chart_{{ c.chart_id }} = echarts.init(
document.getElementById('{{ c.chart_id }}'), '{{ c.theme }}', {renderer: '{{ c.renderer }}'});
{% for js in c.js_functions.items %}
{{ js }}
{% endfor %}
var option_{{ c.chart_id }} = {{ c.options }};
chart_{{ c.chart_id }}.setOption(option_{{ c.chart_id }});
{% endfor %}
});
</script>

0 comments on commit 46aa05a

Please sign in to comment.