Giter Club home page Giter Club logo

pyecharts-gallery's Introduction

pyecharts-gallery



项目简介

  • 项目基于 pyecharts 2.0.3 版本进行展示
  • Apache ECharts (incubating) 官方实例

项目须知

  • 项目代码结构按照 pyecharts 支持的组件按大写字母顺序进行模块划分
  • 代码内有根据 2.0.3 版本的 pyecharts 所生成的可视化数据视图和官方的进行对比, 有列出能实现的功能以及未实现的功能
  • 以下图例多数会基于 Echarts 的官方实例,不过也有部分会基于 Echarts 的社区 Gallery 实现

pyecharts-gallery's People

Contributors

chenjiandongx avatar chfw avatar fnsflm avatar hansz00 avatar sunhailin-leo avatar villelaitila avatar wlbksy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyecharts-gallery's Issues

grid中添加了两个PIP饼图,饼图的标签不能显示完

image

osVersionPip = (
Pie()
.add(
"",
osVersion(),
radius=["55", "40%"],
center=["38%", "28%"],
label_opts=opts.LabelOpts(
position="outside",
#formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c} {per|{d}%} ",
formatter="{hr|}\n {b|{b}: }{c} {per|{d}%} ",
background_color="#eee",
border_color="#aaa",
border_width=1,
border_radius=5,
rich={
#"a": {"color": "#999", "lineHeight": 5, "align": "center"},
"abg": {
"backgroundColor": "#e3e3e3",
"width": "100%",
"align": "right",
"height": 22,
"borderRadius": [4, 4, 0, 0],
},
"hr": {
"borderColor": "#aaa",
"width": "100%",
"borderWidth": 1,
"height": 0,
},
"b": {"fontSize": 11, "lineHeight": 25},
"per": {
"color": "#eee",
"backgroundColor": "#334455",
"padding": [2, 4],
"borderRadius": 2,
},
},
),
)
#.set_global_opts(title_opts=opts.TitleOpts(title="操作系统版本信息"))
.set_global_opts(
#title_opts=opts.TitleOpts(title="Pie-Legend 滚动"),
legend_opts=opts.LegendOpts(type_="scroll", pos_left="85%",orient="vertical"),
)
#.render("./templates/osVersionPip.html")
)

osTypePip = (
Pie()
.add(
"",
osType(),
radius=["55", "40%"],
center=["38%", "80%"],
label_opts=opts.LabelOpts(
position="outside",
#formatter="{a|{a}}{abg|}\n{hr|}\n {b|{b}: }{c} {per|{d}%} ",
formatter="{hr|}\n {b|{b}: }{c} {per|{d}%} ",
background_color="#eee",
border_color="#aaa",
border_width=1,
border_radius=5,
rich={
#"a": {"color": "#999", "lineHeight": 5, "align": "center"},
"abg": {
"backgroundColor": "#e3e3e3",
"width": "100%",
"align": "right",
"height": 22,
"borderRadius": [4, 4, 0, 0],
},
"hr": {
"borderColor": "#aaa",
"width": "100%",
"borderWidth": 1,
"height": 0,
},
"b": {"fontSize": 11, "lineHeight": 25},
"per": {
"color": "#eee",
"backgroundColor": "#334455",
"padding": [2, 4],
"borderRadius": 2,
},
},
),
)
#.set_global_opts(title_opts=opts.TitleOpts(title="操作系统版本信息"))
.set_global_opts(
#title_opts=opts.TitleOpts(title="Pie-Legend 滚动"),
legend_opts=opts.LegendOpts(type_="scroll", pos_top="55%" ,pos_left="85%",orient="vertical",is_show=True),
)
#.render("./templates/osVersionPip.html")
)

grid = (
Grid()
.add(osTypePip,grid_opts=opts.GridOpts(pos_bottom="60%"))
.add(osVersionPip, grid_opts=opts.GridOpts(pos_top="60%"))
.render("./templates/grid_horizontal.html")
)

Translating run_all.py interface

It would help many to use English in the user interface. Usually people do expect English language as the default language when working with CLI applications and tools.

bar 横坐标设置用 range(n) 出 bug,用 [i for i in range(n)] 才行

我的正常程序是这样的,

import pyecharts.options as opts
from pyecharts.charts import Bar
m_, n_ = [m for m in range(0, 12 +1)], range(1, 4 +1)

bar = (
        Bar() # init_opts=opts.InitOpts(width="1600px", height="800px")
        .add_xaxis(xaxis_data=m_)
        .set_global_opts(
            # title_opts=opts.TitleOpts(title="柱状图动画延迟"),
            xaxis_opts=opts.AxisOpts(splitline_opts=opts.SplitLineOpts(is_show=False)),
            yaxis_opts=opts.AxisOpts(
                axistick_opts=opts.AxisTickOpts(is_show=True),
                splitline_opts=opts.SplitLineOpts(is_show=True),
            ),
        )
    )

for n in n_:
    bar.add_yaxis(
            series_name=f"n={n}", 
            yaxis_data=[np.abs(Bcomp_smn[coilsys][coil]['b1_bis'][s_ind,m,n]) for m in m_], 
            label_opts=opts.LabelOpts(is_show=False)
        )
bar.render_notebook()

image

但是如果我将横坐标的数组更换成了直接用 range 函数,m_ = range(0, 15 +1)

image

同时,如果我将 y 数据喂进去的是 numpy 数组而不是 list 类型,会出现空图。似乎 echarts 没法处理不是 list 型的数据?

【奇怪BUG】关系图中结点的大小的问题(symbol_size)

在设定关系图中结点的大小的时候,如果是手动设定的,做出来的图结点该多大就多大,但是如果是用循环的方式自动设定结点的大小就会导致所有的节点都一样大;如果用循环的方式设定节点里的value,会导致做出来的图节点上的值显示为"null"。这个bug要怎么解决

Grid - Grid_geo_bar

In this example, there is no problem with Render Geo data alone. Once combined with Grid, add Bar, Line, and Geo data, it becomes an immutable floating point number. Is this a bug?
这个示例,单独render geo数据没有问题,一旦结合grid,添加bar,line,geo的数据就变成不可更改的浮点数了,这是一个bug吧?

Why it's not work when change the Geo-maptype from 'china' to 'world'?

It‘s very stange that everything is OK when use the gallery of Geo-Line in 'china' mapttyep, but not work change the maptype to 'world'? I try the different country label like 'Unite States', 'US', '美国' and it's dosen't work.
Who can tell me how to make a world geo line map? Thanks a lot~

MarkLine,小数据无法准确显示

MakeLine生成的线,只能精准到0.01,0.005无法区别出来,比如如下的代码Line线设置的是0.025,但实际生成的Line是0.03

import pyecharts.options as opts
from pyecharts.charts import Line

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [0.01, 0.015, 0.025, 0.03, 0.045, 0.023, 0.035, 0.052, 0.043, 0.037]
spec = 0.025

line = (
Line()
.add_xaxis(xaxis_data=x)
.add_yaxis(
series_name="A",
y_axis=y,
is_smooth=True,
label_opts=opts.LabelOpts(is_show=False),
)
.set_series_opts(
markline_opts=opts.MarkLineOpts(
symbol="none",
label_opts=opts.LabelOpts(
is_show=False,
),
data=[opts.MarkLineItem(y=spec, name="SPEC")],
linestyle_opts=opts.LineStyleOpts(
type_="dotted",
color="rgb(208,2,27)",
)
),
)
)

line.render("Spec Line.html")

时间轴组件数量限制问题

用timeline组件的时候发现时间下标数量不稳定,四个五个六个七个都出现过,当然我赋值的数量远远大于这些值,在几百个的数量级,如何做才能全部生成?

双Y轴折线图,无法设置第二Y轴颜色??

源程序如下,可直接运行
import pyecharts
from pyecharts.charts import Line
from pyecharts import options as opts

x = list(range(0, 10))
y1 = [i * 2 + 1 for i in list(range(0, 10))]
#y2 = [i * 3 + 2 for i in list(range(0, 10))]
y3 = [(i+1)/10 * 3 for i in list(range(0, 10))]

line = (
Line()
.add_xaxis(x)
.add_yaxis("y1", y1
,color="green",is_symbol_show=True #第一轴设置为绿色
,label_opts=opts.LabelOpts(is_show=False)
)
.extend_axis(yaxis=opts.AxisOpts( name="y3"))
.set_global_opts(title_opts=opts.TitleOpts(title="双坐标轴Demo",pos_right="50%") # 设置标题
,legend_opts=opts.LegendOpts(pos_right="10%",pos_top="50%",orient="vertical") # 设置图例
,tooltip_opts =opts.TooltipOpts(trigger='axis',axis_pointer_type='cross')
# ,toolbox_opts =opts.ToolboxOpts(is_show=True,orient='horizontal')
,xaxis_opts =opts.AxisOpts(name="X")
,yaxis_opts =opts.AxisOpts(name="Y")
)
)
line1 = (Line()
.add_xaxis(x)
.add_yaxis("y3", y3
,color="blue",is_symbol_show=True #第二轴想设置为蓝色,但是图中是红色了,不知为何?
,label_opts=opts.LabelOpts(is_show=False)
, yaxis_index=1))
line.overlap(line1)
line.render_notebook()

截图不会放。
开发大大帮忙看看,github速度超慢,请邮件:[email protected]

tornado template使用

self. render(index.html,content=bar.dump_options())

{%raw content%}

显示不出来有什么办法吗?

The step line adopts pref method, while post method is also needed

The step line is usually adopted to show the value changing over time, and the value will keep the same until next point, so it's better to add an option to choose the step line generate option.
contras
shown in the pic:
The red line is currently in use: pref-step, value changed in advance;
The blue line, post-step, value change until new value comes.

How do I change x,y,z label name to customized name?

import random
from example.commons import Collector, Faker
from pyecharts import options as opts
from pyecharts.charts import Page, Scatter3D
C = Collector()
@C.funcs
def scatter3d_base() -> Scatter3D:
data = test2
c = (
Scatter3D()
.add("", data)
.set_global_opts(
title_opts=opts.TitleOpts("Scatter3D-基本示例"),
visualmap_opts=opts.VisualMapOpts(range_color=Faker.visual_color),
)
)
return c
Page().add(*[fn() for fn, _ in C.charts]).render()

图像的位置

https://pyecharts.org/#/zh-cn/global_options
这个图上有各个元素的设置,但好像唯独没有中间图形的设置,因为我的图例项目太多,跟图形有重叠,所以我设置图例配置项在整个图形的右边,不过依然有重叠,我想将中间的图形再向左一些,但却没有中间图形的配置项目,更没有pos_left了。请问怎么解决。

如何在K线图浮窗中显示涨跌幅?

目前的几种K线图仅支持显示开盘收盘最低最高等信息,那么如何显示本期相对于上期的涨跌幅呢?是否需要添加序列,但显得没有必要。如图所示:
image

table组件

table为啥没有dump_options_with_quotes()方法

建议示例中提供完整的代码

许多开源项目,示例代码是可以直接拷过来就能演示,这样也容易提升使用者的兴趣。

pyecharts 的示例代码,不知为什么运行不起来。

全局配置项 TooltipOpts 参数问题

以下是formatter 参数的配置方法的说明文档:

标签内容格式器,支持字符串模板和回调函数两种形式,字符串模板与回调函数返回的字符串均支持用 \n 换行。

# 字符串模板 模板变量有:
# {a}:系列名。
# {b}:数据名。
# {c}:数据值。
# {@xxx}:数据中名为 'xxx' 的维度的值,如 {@product} 表示名为 'product'` 的维度的值。
# {@[n]}:数据中维度 n 的值,如{@[3]}` 表示维度 3 的值,从 0 开始计数。
# 示例:formatter: '{b}: {@score}'

问题: {@xxx} {@[n]} 这两项不知道如何使用!求解答。

maptype="world_china_provinces"会导致geo地图无法渲染

Geo() .add_schema(maptype="world_china_provinces",layout_size=1000)
world_china_provinces启用这个地图类型会导致生成的网页被渲染成白屏。
测试了maptype="china","world’都能正常的展示。
我检查了网页的html代码,发现
`

<head>

  | <meta charset="UTF-8">
  | <title>Awesome-pyecharts</title>
  | <script type="text/javascript" src="https://assets.pyecharts.org/assets/echarts.min.js"&gt;&lt;/script>
  | <script type="text/javascript" src="https://assets.pyecharts.org/assets/maps/world_china_provinces.js"&gt;&lt;/script>
  |  
  | </head>

`
这里指向的"https://assets.pyecharts.org/assets/maps/world_china_provinces.js"字符集和https://assets.pyecharts.org/assets/maps/china.js 这个不同。

树图Tree的示例能否像echarts的官方示例一样展开第3层之后的节点?

问题描述
我在使用pyecharts绘制树图的过程中,发现pyecharts绘制出的树图默认只展开0, 1, 2这三层节点,后面更深层的节点是折叠起来的。我希望绘制出的树图初始就能展开所有层级的节点,不要隐藏。

在echarts中有2个参数可以实现这个功能,设置参数initialTreeDepth: -1或者expandAndCollapse: false都可以使各层节点全部展开(见截图)。但pyecharts似乎没有对应的参数。
BaiduShurufa_2019-8-29_20-7-56

示例
我运行了您给出的echarts官方示例树图的python代码
https://github.com/pyecharts/pyecharts-gallery/blob/master/Tree/radial_tree.py
也存在不能默认展开多层节点的问题,但您的代码注释中并未说明无法实现此功能。
image

echarts官方示例树图
https://echarts.baidu.com/examples/editor.html?c=tree-radial
截图中红框标注部分的参数并没有在您的python代码中体现。这里能否向您请教如何修改程序,使之与echarts相对应,可以通过参数控制默认的树图展开层数?
BaiduShurufa_2019-8-29_20-20-55

我想可能需要修改pyecharts这个module的一些程序才能解决,但我还没有找到修改的方法。

country label

how can I label every country using other language? for example Chinese.

怎么将横轴转变为数值型?

例如,在给出的散点图实例中,X轴 类型为条目,怎么改成数值型的?想要探究两个变量之间的关系。
add_xaxis() 只能添加条目类型的吗?

onclick点击事件的绑定

通常一个表格除了看,还可以点击进入下一级或详情页面
例如:

echarts.on('click', function (params) {
    location.href = `xxx/${categories[params.name]}`;
});

这种点击绑定事件通常在生成html时动态编译完成,但是在文档中没有找到

gantt

以后会不会新增甘特图。

数理统计

什么星座图 ,调和曲线图,什么的不考虑弄一下吗,这对搞数理统计的同志不友好啊

tree 只有三層

在測試時發現樹狀圖最多只能有三層,請問可以顯示更多層嗎???

Bar3D 坐标和 Bar 发生了奇怪的偏移,Strange shift between the bar and axis

import pyecharts.options as opts
from pyecharts.charts import Bar3D
coilsys, coil = 'HCFs', 'c'

s_ind = -20
m_, n_ = range(-11, 11 +1), range(-3, 3 +1)
data_ = [[m,n,np.abs(Bcomp_smn[coilsys][coil]['b1_bis'][s_ind,m,n])] for m in m_ for n in n_]
data_max=max([data[2] for data in data_])/3
bar = ( Bar3D() # init_opts=opts.InitOpts(width="1000px", height="500px")
            .add(
                series_name="",
                data=data_,
                xaxis3d_opts=opts.Axis3DOpts(type_="category", name='m', data=m_),
                yaxis3d_opts=opts.Axis3DOpts(type_="category", name='n', data=n_),
                zaxis3d_opts=opts.Axis3DOpts(type_="value"),
                grid3d_opts=opts.Grid3DOpts(width=len(m_)*6, height=40, depth=len(n_)*6),
            )
            .set_global_opts(
                visualmap_opts=opts.VisualMapOpts(max_=data_max)
            )
)
bar.render_notebook()

这一段代码可以产生这样的图,

image

但如果我将它打包成函数的话,就会产生下面奇怪的偏移,

from ergospy.visual import RMP
coilsys, coil = 'HCFs', 'c'
s_ind = -5
m_, n_ = range(0, 15 +1),[-3,-2,-1,0, 1,2,3]
bar3D = RMP.spectrum_bar3D(np.abs(Bcomp_smn[coilsys][coil]['b1_bis'][s_ind,:,:]), m_,n_, 1/2)
bar3D.render_notebook()

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.