v-charts 和 websocket实现数据展示动态推送

v-charts

https://v-charts.js.org/#/

ELEMENT力作:

在使用 echarts 生成图表时,经常需要做繁琐的数据类型转化、修改复杂的配置项,v-charts 的出现正是为了解决这个痛点。基于 Vue2.0 和 echarts 封装的 v-charts 图表组件,只需要统一提供一种对前后端都友好的数据格式设置简单的配置项,便可轻松生成常见的图表。

 

 

websocket (socket.io)

https://socket.io/

 

实时分析,例如淘宝的双十一的大屏幕。

二进制流媒体, 图片、音频、视频。

即时消息,聊天应用。

Real-time analytics

Push data to clients that gets represented as real-time counters, charts or logs.

Binary streaming

Starting in 1.0, it's possible to send any blob back and forth: image, audio, video.

Instant messaging and chat

Socket.IO's "Hello world" is a chat app in just a few lines of code.

Document collaboration

Allow users to concurrently edit a document and see each other's changes.

 

例子

https://socket.io/get-started/chat/

 

自我实现例子

https://github.com/fanqingsong/web_data_visualization

 

实现思路:

1、 后台定时推送数据到前台(websocket-server and client)。

2、 前台接收到数据后,使用v-charts柱状图显示。

后台更新数据推送时刻,前台就徽更新柱状图。

 

运行命令

# serve with hot reload at localhost:8080
npm run dev
 # start websocket server npm run websocket

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值