打造自己的树莓派监控系统3--canvas.js绘制数据
发布日期:2022-03-18 18:19:19 浏览次数:5 分类:技术文章

本文共 943 字,大约阅读时间需要 3 分钟。

系列文章:

  • 文章1:
  • 文章2:
  • 文章3:
  • GitHub仓库:

介绍

前面2篇文章都是使用matplotlib画图的,但当数据量较多时matplotlib的显示和交互性不让我满意,所以我使用canvas.js绘图。

canvasjs介绍:JavaScript Charts & Graphs with 10x better performance and a simple API. Integrates easily with popular JS Frameworks like AngularJS, etc. Library comes with 30 different types of charts including line, column, bar, area, spline, pie, doughnut, stacked charts, etc. It supports various interactive features like tooltips, zooming, panning, animation, events, drilldown, exporting and can easily be integrated with various server side technologies like PHP, Ruby, Python, , Node.JS, Java, etc. To top it all off, it can easily render thousands of data-points without any performance lag.

使用canvas.js

flask代码:

@app.route('/', methods=['GET'])def main():    temperature = get_temperature()    mem, MemTotal = get_mem()    return render_template('index.html', temperature=temperature, mem=mem, MemTotal=MemTotal)

HTML核心代码:

效果图如下:

在这里插入图片描述

转载地址:https://zhang0peter.blog.csdn.net/article/details/84819958 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:设置树莓派的无线网卡为监听模式(monitor)
下一篇:anaconda: import numpy报错:ImportError: DLL load failed: 找不到指定的模块。

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2024年04月18日 03时55分47秒