コード例 #1
0
def draw_line(task_id):
    page = Page()
    task = Task.objects.get(id=task_id)
    data_to_show = ['mp_kf', 'time', 'weak_rate', 'kfs', 'mps', 'slam_len']
    for area in eval(task.area):
        line = Line(area)
        line.width = 'auto'
        attr = Results.objects.show_data_of_area(task_id=task_id, keyword="rtv_name", area=str(area))
        for data in data_to_show:
            value = Results.objects.show_data_of_area(task_id=task_id, keyword=data, area=area)
            line.add(str(data), attr, value, is_smooth=True, is_datazoom_show=True, datazoom_range=[20, 100], is_more_utils=True)
        page.add(line)
    return page
コード例 #2
0
 def show_line(self):
     print('展示曲线')
     x = random.randint(0, 10)  #随机生成0到10之间的一个整数
     X = np.linspace(x - 20, x + 20, 41)
     Y = X**2 + 1
     print(X)
     print(Y)
     line = Line('定时更新曲线')
     line.width = 1440
     line.height = 550
     line.add('曲线',
              X,
              Y,
              xaxis_type='value',
              yaxis_type='value',
              xaxis_force_interval=2,
              is_smooth=True)
     line.render('html/test_3.html')
     self.web.load(
         QUrl("file:///untitled4/pyecharts数据可视化/html/test_3.html"))
コード例 #3
0
from pyecharts import Line
import numpy as np
#显示负数时如果不处理横纵坐标的类型会出现显示错误,因此一定要设置横纵坐标为数据类型即value。
x = np.linspace(-10, 10, 21)
y1 = x * 2 + 1
y2 = x**2 + 1
l = Line('pyecharts曲线测试')
l.height = 600
l.width = 1300
l.add('直线', x, y1, is_smooth=True, line_width=3)
l.add('抛物线',
      x,
      y2,
      is_smooth=True,
      xaxis_type='value',
      yaxis_type='value',
      xaxis_force_interval=2,
      line_width=3)
l.render('html/test_1.html')