{"action":"created","comment":{"url":"https://api.github.com/repos/pyecharts/pyecharts/pulls/comments/187783944","pull_request_review_id":119637547,"id":187783944,"diff_hunk":"@@ -242,27 +242,71 @@ map.render()\n 打印全部 options 属性。自 v0.3.3 起。已废弃，应当使用 `print_echarts_options` 。\n \n \n-## 多图表\n+## 多图表 Page\n \n-`pyecharts.custom.page.Page` 用于在同一页面显示多个图表，也拥有上述的属性和方法。\n+> 在 v0.5.4 变更，重写内部实现，新增图表命名名称。\n \n-同时 `Page` 类继承自 `list` ，因此也支持长度计算(len)、迭代(iter)、索引(index)、切片(slice)、添加(append)、扩展(extend)等操作。\n+### 基本使用\n+\n+由于无论是 Jinja2 模板还是 Django 模板，均不提倡使用 `{{ charts.1 }}` 形式访问列表中的某一个元素。因此在 v0.5.4 对 Page 进行重构，新增图表命名名称。\n+\n+在创建一个 `Page` 实例 page ，后，使用 `add_chart` 添加一个图表对象，可以使用 name 为之起一个引用名称。\n \n-例子：按顺序打印 page 中每个图表的 echarts 选项字典。\n \n ```python\n+\n+from pyecharts import Page, Line, Bar\n+\n page = Page()\n line = Line('Demo Line')\n # ... Add data to line\n-page.add(line)\n-kline = KLine('Demo kline')\n-# ... Add data to kline\n-page.append(kline)\n-\n-for chart in page:\n-    chart.show_config()\n+page.add_chart(line, name='line')\n+bar = Bar('Demo kline')\n+# ... Add data to bar\n+page.add_chart(bar)\n ```\n \n+图表访问方式\n+\n+| 项目 | Python 代码 | 模板代码 |\n+| ------ | ------ | ------ |\n+| line 实例 | `print(page['line'])` | `{{ page.line }}` |\n+| bar 实例 | `print(page['c1'])` | `{{ page.c1 }}` |\n+\n+### 方法列表\n+\n+在创建一个 page 实例后，可以通过各种方法将现有的图表实例添加到该实例中。\n+\n+> Page 不再具有 list 的全部特性，因此 切片(slice)、添加(append)、扩展(extend) 等方法不再支持。\n+\n+**`__init__(page_title, **kwargs)`**\n+\n+构造函数，使用 `{<name>:<chart>}` 创建实例。根据 [PEP 468](https://www.python.org/dev/peps/pep-0468/)，仅在 Python 3.6+ 同时保证其顺序。\n+\n+**`add_chart(chart, name=None)`**\n+\n+v0.5.4 新增，可链式使用。添加一个图表对象，如果如果没有指定  `name` 参数，默认使用类似 `'c0'` ，`'c1'` 等字符串命名。\n+\n+**`add(achart_or_charts)`**\n+\n+可链式使用。添加一个或多个图表对象，该函数使用默认的名称。\n+\n+**`cls.from_charts(*args)`**","path":"docs/zh-cn/api.md","position":64,"original_position":64,"commit_id":"1e2a454379c7a1fa42d61d053df8d56a42fe3d45","original_commit_id":"1e2a454379c7a1fa42d61d053df8d56a42fe3d45","user":{"login":"chfw","id":4280312,"avatar_url":"https://avatars0.githubusercontent.com/u/4280312?v=4","gravatar_id":"","url":"https://api.github.com/users/chfw","html_url":"https://github.com/chfw","followers_url":"https://api.github.com/users/chfw/followers","following_url":"https://api.github.com/users/chfw/following{/other_user}","gists_url":"https://api.github.com/users/chfw/gists{/gist_id}","starred_url":"https://api.github.com/users/chfw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chfw/subscriptions","organizations_url":"https://api.github.com/users/chfw/orgs","repos_url":"https://api.github.com/users/chfw/repos","events_url":"https://api.github.com/users/chfw/events{/privacy}","received_events_url":"https://api.github.com/users/chfw/received_events","type":"User","site_admin":false},"body":"*args -> *charts","created_at":"2018-05-12T21:47:20Z","updated_at":"2018-05-12T21:47:21Z","html_url":"https://github.com/pyecharts/pyecharts/pull/551#discussion_r187783944","pull_request_url":"https://api.github.com/repos/pyecharts/pyecharts/pulls/551","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pyecharts/pyecharts/pulls/comments/187783944"},"html":{"href":"https://github.com/pyecharts/pyecharts/pull/551#discussion_r187783944"},"pull_request":{"href":"https://api.github.com/repos/pyecharts/pyecharts/pulls/551"}}},"pull_request":{"url":"https://api.github.com/repos/pyecharts/pyecharts/pulls/551","id":187475404,"html_url":"https://github.com/pyecharts/pyecharts/pull/551","diff_url":"https://github.com/pyecharts/pyecharts/pull/551.diff","patch_url":"https://github.com/pyecharts/pyecharts/pull/551.patch","issue_url":"https://api.github.com/repos/pyecharts/pyecharts/issues/551","number":551,"state":"open","locked":false,"title":"Page named charts","user":{"login":"kinegratii","id":9875406,"avatar_url":"https://avatars0.githubusercontent.com/u/9875406?v=4","gravatar_id":"","url":"https://api.github.com/users/kinegratii","html_url":"https://github.com/kinegratii","followers_url":"https://api.github.com/users/kinegratii/followers","following_url":"https://api.github.com/users/kinegratii/following{/other_user}","gists_url":"https://api.github.com/users/kinegratii/gists{/gist_id}","starred_url":"https://api.github.com/users/kinegratii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinegratii/subscriptions","organizations_url":"https://api.github.com/users/kinegratii/orgs","repos_url":"https://api.github.com/users/kinegratii/repos","events_url":"https://api.github.com/users/kinegratii/events{/privacy}","received_events_url":"https://api.github.com/users/kinegratii/received_events","type":"User","site_admin":false},"body":"由于无论是 Jinja2 模板还是 Django 模板，均不提倡使用 `{{ charts.1 }}` 形式访问列表中的某一个元素。因此在 v0.5.4 对 Page 进行重构，新增图表命名名称。\r\n\r\n在创建一个 `Page` 实例 page ，后，使用 `add_chart` 添加一个图表对象，可以使用 name 为之起一个引用名称。\r\n\r\n\r\n```python\r\n\r\nfrom pyecharts import Page,Line, Bar\r\n\r\npage = Page()\r\nline = Line('Demo Line')\r\n# ... Add data to line\r\npage.add_chart(line, name='line')\r\nbar = Bar('Demo kline')\r\n# ... Add data to bar\r\npage.add_chart(bar)\r\n```\r\n\r\n图表访问方式\r\n\r\n| 项目 | Python 代码 | 模板代码 |\r\n| ------ | ------ | ------ |\r\n| line 实例 | `print(page['line'])` | `{{ page.line }}` |\r\n| bar 实例 | `print(page['c1'])` | `{{ page.c1 }}` |\r\n","created_at":"2018-05-11T14:11:20Z","updated_at":"2018-05-12T21:47:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9faa541788339c5c030ff729f37ed96800cf0416","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pyecharts/pyecharts/pulls/551/commits","review_comments_url":"https://api.github.com/repos/pyecharts/pyecharts/pulls/551/comments","review_comment_url":"https://api.github.com/repos/pyecharts/pyecharts/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pyecharts/pyecharts/issues/551/comments","statuses_url":"https://api.github.com/repos/pyecharts/pyecharts/statuses/1e2a454379c7a1fa42d61d053df8d56a42fe3d45","head":{"label":"pyecharts:page-named-charts","ref":"page-named-charts","sha":"1e2a454379c7a1fa42d61d053df8d56a42fe3d45","user":{"login":"pyecharts","id":34701774,"avatar_url":"https://avatars3.githubusercontent.com/u/34701774?v=4","gravatar_id":"","url":"https://api.github.com/users/pyecharts","html_url":"https://github.com/pyecharts","followers_url":"https://api.github.com/users/pyecharts/followers","following_url":"https://api.github.com/users/pyecharts/following{/other_user}","gists_url":"https://api.github.com/users/pyecharts/gists{/gist_id}","starred_url":"https://api.github.com/users/pyecharts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyecharts/subscriptions","organizations_url":"https://api.github.com/users/pyecharts/orgs","repos_url":"https://api.github.com/users/pyecharts/repos","events_url":"https://api.github.com/users/pyecharts/events{/privacy}","received_events_url":"https://api.github.com/users/pyecharts/received_events","type":"Organization","site_admin":false},"repo":{"id":95067884,"name":"pyecharts","full_name":"pyecharts/pyecharts","owner":{"login":"pyecharts","id":34701774,"avatar_url":"https://avatars3.githubusercontent.com/u/34701774?v=4","gravatar_id":"","url":"https://api.github.com/users/pyecharts","html_url":"https://github.com/pyecharts","followers_url":"https://api.github.com/users/pyecharts/followers","following_url":"https://api.github.com/users/pyecharts/following{/other_user}","gists_url":"https://api.github.com/users/pyecharts/gists{/gist_id}","starred_url":"https://api.github.com/users/pyecharts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyecharts/subscriptions","organizations_url":"https://api.github.com/users/pyecharts/orgs","repos_url":"https://api.github.com/users/pyecharts/repos","events_url":"https://api.github.com/users/pyecharts/events{/privacy}","received_events_url":"https://api.github.com/users/pyecharts/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pyecharts/pyecharts","description":"🎨 Python Echarts Plotting Library","fork":false,"url":"https://api.github.com/repos/pyecharts/pyecharts","forks_url":"https://api.github.com/repos/pyecharts/pyecharts/forks","keys_url":"https://api.github.com/repos/pyecharts/pyecharts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyecharts/pyecharts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyecharts/pyecharts/teams","hooks_url":"https://api.github.com/repos/pyecharts/pyecharts/hooks","issue_events_url":"https://api.github.com/repos/pyecharts/pyecharts/issues/events{/number}","events_url":"https://api.github.com/repos/pyecharts/pyecharts/events","assignees_url":"https://api.github.com/repos/pyecharts/pyecharts/assignees{/user}","branches_url":"https://api.github.com/repos/pyecharts/pyecharts/branches{/branch}","tags_url":"https://api.github.com/repos/pyecharts/pyecharts/tags","blobs_url":"https://api.github.com/repos/pyecharts/pyecharts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyecharts/pyecharts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyecharts/pyecharts/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyecharts/pyecharts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyecharts/pyecharts/statuses/{sha}","languages_url":"https://api.github.com/repos/pyecharts/pyecharts/languages","stargazers_url":"https://api.github.com/repos/pyecharts/pyecharts/stargazers","contributors_url":"https://api.github.com/repos/pyecharts/pyecharts/contributors","subscribers_url":"https://api.github.com/repos/pyecharts/pyecharts/subscribers","subscription_url":"https://api.github.com/repos/pyecharts/pyecharts/subscription","commits_url":"https://api.github.com/repos/pyecharts/pyecharts/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyecharts/pyecharts/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyecharts/pyecharts/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyecharts/pyecharts/issues/comments{/number}","contents_url":"https://api.github.com/repos/pyecharts/pyecharts/contents/{+path}","compare_url":"https://api.github.com/repos/pyecharts/pyecharts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyecharts/pyecharts/merges","archive_url":"https://api.github.com/repos/pyecharts/pyecharts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyecharts/pyecharts/downloads","issues_url":"https://api.github.com/repos/pyecharts/pyecharts/issues{/number}","pulls_url":"https://api.github.com/repos/pyecharts/pyecharts/pulls{/number}","milestones_url":"https://api.github.com/repos/pyecharts/pyecharts/milestones{/number}","notifications_url":"https://api.github.com/repos/pyecharts/pyecharts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyecharts/pyecharts/labels{/name}","releases_url":"https://api.github.com/repos/pyecharts/pyecharts/releases{/id}","deployments_url":"https://api.github.com/repos/pyecharts/pyecharts/deployments","created_at":"2017-06-22T02:50:25Z","updated_at":"2018-05-12T17:49:38Z","pushed_at":"2018-05-12T11:47:54Z","git_url":"git://github.com/pyecharts/pyecharts.git","ssh_url":"git@github.com:pyecharts/pyecharts.git","clone_url":"https://github.com/pyecharts/pyecharts.git","svn_url":"https://github.com/pyecharts/pyecharts","homepage":"http://pyecharts.org","size":96114,"stargazers_count":2889,"watchers_count":2889,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":656,"mirror_url":null,"archived":false,"open_issues_count":54,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":656,"open_issues":54,"watchers":2889,"default_branch":"master"}},"base":{"label":"pyecharts:dev","ref":"dev","sha":"d517dd8d48b980176b663bc8bb07b5e20883a1bb","user":{"login":"pyecharts","id":34701774,"avatar_url":"https://avatars3.githubusercontent.com/u/34701774?v=4","gravatar_id":"","url":"https://api.github.com/users/pyecharts","html_url":"https://github.com/pyecharts","followers_url":"https://api.github.com/users/pyecharts/followers","following_url":"https://api.github.com/users/pyecharts/following{/other_user}","gists_url":"https://api.github.com/users/pyecharts/gists{/gist_id}","starred_url":"https://api.github.com/users/pyecharts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyecharts/subscriptions","organizations_url":"https://api.github.com/users/pyecharts/orgs","repos_url":"https://api.github.com/users/pyecharts/repos","events_url":"https://api.github.com/users/pyecharts/events{/privacy}","received_events_url":"https://api.github.com/users/pyecharts/received_events","type":"Organization","site_admin":false},"repo":{"id":95067884,"name":"pyecharts","full_name":"pyecharts/pyecharts","owner":{"login":"pyecharts","id":34701774,"avatar_url":"https://avatars3.githubusercontent.com/u/34701774?v=4","gravatar_id":"","url":"https://api.github.com/users/pyecharts","html_url":"https://github.com/pyecharts","followers_url":"https://api.github.com/users/pyecharts/followers","following_url":"https://api.github.com/users/pyecharts/following{/other_user}","gists_url":"https://api.github.com/users/pyecharts/gists{/gist_id}","starred_url":"https://api.github.com/users/pyecharts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyecharts/subscriptions","organizations_url":"https://api.github.com/users/pyecharts/orgs","repos_url":"https://api.github.com/users/pyecharts/repos","events_url":"https://api.github.com/users/pyecharts/events{/privacy}","received_events_url":"https://api.github.com/users/pyecharts/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pyecharts/pyecharts","description":"🎨 Python Echarts Plotting Library","fork":false,"url":"https://api.github.com/repos/pyecharts/pyecharts","forks_url":"https://api.github.com/repos/pyecharts/pyecharts/forks","keys_url":"https://api.github.com/repos/pyecharts/pyecharts/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyecharts/pyecharts/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyecharts/pyecharts/teams","hooks_url":"https://api.github.com/repos/pyecharts/pyecharts/hooks","issue_events_url":"https://api.github.com/repos/pyecharts/pyecharts/issues/events{/number}","events_url":"https://api.github.com/repos/pyecharts/pyecharts/events","assignees_url":"https://api.github.com/repos/pyecharts/pyecharts/assignees{/user}","branches_url":"https://api.github.com/repos/pyecharts/pyecharts/branches{/branch}","tags_url":"https://api.github.com/repos/pyecharts/pyecharts/tags","blobs_url":"https://api.github.com/repos/pyecharts/pyecharts/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyecharts/pyecharts/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyecharts/pyecharts/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyecharts/pyecharts/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyecharts/pyecharts/statuses/{sha}","languages_url":"https://api.github.com/repos/pyecharts/pyecharts/languages","stargazers_url":"https://api.github.com/repos/pyecharts/pyecharts/stargazers","contributors_url":"https://api.github.com/repos/pyecharts/pyecharts/contributors","subscribers_url":"https://api.github.com/repos/pyecharts/pyecharts/subscribers","subscription_url":"https://api.github.com/repos/pyecharts/pyecharts/subscription","commits_url":"https://api.github.com/repos/pyecharts/pyecharts/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyecharts/pyecharts/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyecharts/pyecharts/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyecharts/pyecharts/issues/comments{/number}","contents_url":"https://api.github.com/repos/pyecharts/pyecharts/contents/{+path}","compare_url":"https://api.github.com/repos/pyecharts/pyecharts/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyecharts/pyecharts/merges","archive_url":"https://api.github.com/repos/pyecharts/pyecharts/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyecharts/pyecharts/downloads","issues_url":"https://api.github.com/repos/pyecharts/pyecharts/issues{/number}","pulls_url":"https://api.github.com/repos/pyecharts/pyecharts/pulls{/number}","milestones_url":"https://api.github.com/repos/pyecharts/pyecharts/milestones{/number}","notifications_url":"https://api.github.com/repos/pyecharts/pyecharts/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyecharts/pyecharts/labels{/name}","releases_url":"https://api.github.com/repos/pyecharts/pyecharts/releases{/id}","deployments_url":"https://api.github.com/repos/pyecharts/pyecharts/deployments","created_at":"2017-06-22T02:50:25Z","updated_at":"2018-05-12T17:49:38Z","pushed_at":"2018-05-12T11:47:54Z","git_url":"git://github.com/pyecharts/pyecharts.git","ssh_url":"git@github.com:pyecharts/pyecharts.git","clone_url":"https://github.com/pyecharts/pyecharts.git","svn_url":"https://github.com/pyecharts/pyecharts","homepage":"http://pyecharts.org","size":96114,"stargazers_count":2889,"watchers_count":2889,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":656,"mirror_url":null,"archived":false,"open_issues_count":54,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":656,"open_issues":54,"watchers":2889,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pyecharts/pyecharts/pulls/551"},"html":{"href":"https://github.com/pyecharts/pyecharts/pull/551"},"issue":{"href":"https://api.github.com/repos/pyecharts/pyecharts/issues/551"},"comments":{"href":"https://api.github.com/repos/pyecharts/pyecharts/issues/551/comments"},"review_comments":{"href":"https://api.github.com/repos/pyecharts/pyecharts/pulls/551/comments"},"review_comment":{"href":"https://api.github.com/repos/pyecharts/pyecharts/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pyecharts/pyecharts/pulls/551/commits"},"statuses":{"href":"https://api.github.com/repos/pyecharts/pyecharts/statuses/1e2a454379c7a1fa42d61d053df8d56a42fe3d45"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"chfw"}}