Here are the examples of the python api pyecharts.Line taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
6 Examples
3
Source : uilt.py
with MIT License
from agamgn
with MIT License
from agamgn
def line_chart():
sale = db.session.query(func.count(extract('Day', sales.sales_addtime)),
extract('Day', sales.sales_addtime)).group_by(
extract('Day', sales.sales_addtime)
).all()
attr = [i for _,i in sale]
v1 = [j for j,_ in sale]
print(attr)
print(v1)
line = Line("日销售量")
line.add("", attr, v1, is_stack=True, is_smooth=True,is_fill=True)
return line
def pies():
3
Source : trendTrain.py
with MIT License
from CharlesPikachu
with MIT License
from CharlesPikachu
def DrawLine(title, infos):
line = Line(title)
attrs = [0]
values = [0]
i = 0
for info in infos:
attrs.append('Epoch%d' % i)
values.append(info)
i += 1
line.add("Test Acc", attrs, values, is_smooth=False, mark_point=["min", "average", "max"])
line.render('results.html')
if __name__ == '__main__':
3
Source : kmeans.py
with MIT License
from CharlesPikachu
with MIT License
from CharlesPikachu
def DrawDistance(distances):
line = Line('聚类距离走势图')
attrs = []
values = []
i = 1
for d in distances:
attrs.append(i)
values.append(d)
i += 1
line.add("距离", attrs, values, is_smooth=False, mark_point=["average", "max", 'min'])
line.render('kmeansLine.html')
# kmeans
def kmeans(whs, num_anchors):
3
Source : painter.py
with MIT License
from williamfzc
with MIT License
from williamfzc
def build_trend_line(cls, time_list: list, trend_list: list):
trend_line = Line('trend')
for each_attr in ['previous', 'first', 'last']:
each_list = [i[each_attr] for i in trend_list]
trend_line.add(
each_attr,
time_list,
each_list,
yaxis_min='dataMin',
is_more_utils=True,
)
return trend_line
@classmethod
0
Source : painter.py
with MIT License
from williamfzc
with MIT License
from williamfzc
def build_match_template_line(cls, time_list: list, match_template_list: list):
"""
:param time_list:
:param match_template_list:
looks like:
[
{
"pic1": {
"min": -0.4684264361858368,
"max": 0.6224471926689148
},
"pic2": {
"min": -0.4022962152957916,
"max": 0.7294253706932068
},
"pic3": {
"min": -0.6132965087890625,
"max": 0.7038567066192627
}
}
...
]
:return:
"""
# build data structure for drawing
data_to_draw = {
name: list()
for name in match_template_list[0].keys()
}
for each_name in data_to_draw.keys():
# draw only max values
data_to_draw[each_name] = [i[each_name]['max'] for i in match_template_list]
match_template_line = Line('match_template')
for each_name, each_data in data_to_draw.items():
match_template_line.add(
each_name,
x_axis=time_list,
y_axis=each_data,
is_more_utils=True,
)
return match_template_line
0
Source : matplot.py
with MIT License
from XGHXT
with MIT License
from XGHXT
def chart(credit_list, time_list):
bar = Line("学生成绩平均绩点折线图\n")
bar.add("平均绩点GPA", time_list, credit_list, is_more_utils=True)
bar.show_config()
bar.render()
shutil.move(os.path.abspath('render.html'), os.path.abspath('templates/student.html'))
file = ""
with open(os.path.abspath('templates/student.html'), 'r') as f:
hello = f.read()
file = hello
f.close()
head = '''
{% extends 'base.html' %}
{% block page_name %}你好,{{login_user}}{% endblock %}
{% block body_part3 %}
< a href="{{ url_for('student') }}" class="nav-link active">
{% endblock %}
{% block body_part1 %}
< span class="glyphicon glyphicon-stats"> < /span> 你好,{{login_user}}
{% endblock %}
{% block body_part2 %}
'''
with open(os.path.abspath('templates/student.html'), 'w') as f1:
f1.write(head)
f1.write(file)
f1.write('\n')
f1.write("{% endblock %}")