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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM