• 【源码】数据可视化:基于 Echarts + Java SpringBoot 动态实时大屏范例 - 监管系统


    数据可视化大屏的出现,掀起一番又一番的浪潮,众多企业主纷纷想要打造属于自己的“酷炫吊炸天”的霸道总裁大屏驾驶舱。

    之前有小伙伴们建议我出一些视频课程来学习Echarts,这样可以更快上手,所以我就追星赶月的录制了 ,希望对有需要的小伙伴有帮助。

    传送门

    YYDatav的数据可视化大屏《精彩案例汇总》(Java SpringBoot&Echarts源码)_YYDataV的博客-CSDN博客

    32【源码】数据可视化:基于Echarts+JavaSpringBoot动态实时大屏-银行监管系统.zip-企业管理文档类资源-CSDN下载

    效果图展示

    1.动态实时更新数据效果图

    2.鼠标右键切换主题

     一、 确定需求方案

    1、确定产品上线部署的屏幕LED分辨率

    本案例基于16:9 屏宽比,F11全屏显示。

    2、部署方式

    基于免安装可执行程序:支持Windows、Linux、Mac等各种操作系统;将程序复制到服务器上即可,无需其它环境依赖;

    观看方式:既可在服务器上直接观看程序界面,也可在远程用浏览器打开播放,例如Chrome浏览器、360浏览器等。

    二、整体架构设计

    1. 前端基于 Echarts开源库设计 ,使用WebStorm编辑器;
    2. 后端基于Java Web实现,使用 IDEA 编辑器;
    3. 数据传输格式:JSON;
    4. 数据源类型:目前采用JSON文件方式,自行添加Mybatis可支持PostgreSQL、MySQL、Oracle、Microsoft SQL Server、SQLite,自行添加POI可支持Excel表格等,还可以定制HTTP API接口方式。
    5. 数据更新方式: **采用http get 轮询方式 ** 。在实际应用中,也可以视情况选择j监测后端数据实时更新,实时推送到前端的方式;

    三、编码实现 (关键代码)

    1、前端html代码 - 页面布局layout&样式style

    <pre class="prettyprint hljs xml" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><div class="grid-container">
            <div id="lo_0">
                <h2>32 数据可视化-银行监管系统</h2>
            </div>
            <div id="lo_1">
    
            </div>
            <div id="lo_2">
    
            </div>
            <div id="lo_3">
    
            </div>
            <div id="lo_4">
    
            </div>
            <div id="lo_5">
    
            </div>
            <div id="lo_6">
    
            </div>
            <div id="lo_7">
    
            </div>
            <div id="lo_8">
                <div style="height: 10%;">
                    <button
                        onclick="async_echart_china('container_8', 'map_china_map/map_china_map.json', 'confirmAdd')">新增金额</button>
                    <button
                        onclick="async_echart_china('container_8', 'map_china_map/map_china_map.json', 'confirm')">累计金额</button>
                    <button
                        onclick="async_echart_china('container_8', 'map_china_map/map_china_map.json', 'nowConfirm')">现有金额</button>
                </div>
                <div id="container_8" style="height: 90%;"></div>
            </div>
            <div id="lo_9">9</div>
            <div id="lo_10">10</div>
        </div></pre>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39

    grid-container 定义

    <pre class="prettyprint hljs css" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">.grid-container {
                display: grid;
                /* 6列,定义列宽 */
                grid-template-columns: 14% 14.5% 20% 20% 14.5% 14%;
                /* auto: 它用于自动设置行的高度,即取决于行中容器和内容的大小。 */
                grid-template-rows: 10% 25% 30% 30%;
                grid-gap: 10px;
                /* background-color: #2196F3; */
                padding: 0;
                width: 100%;
                height: 100%;
            }</pre>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    对横跨多个行列的格子定义

    <pre class="hljs css" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 0.75em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">#lo_5 {
                grid-area: 3 / 1 / 4 / 3;
            }</pre>
    
    • 1
    • 2
    • 3

    2. 前端JS -echarts图表

    <pre class="prettyprint hljs typescript" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">function init_echart_line_visualMap(container) {
      // 基于准备好的dom,初始化echarts实例
      var myChart = echarts.init(document.getElementById(container), gTheme);
      option = {
        title: {
          text: "股票市值实时监测",
          // top: 0,
          // left: "center",
          textStyle: {
            // color: "#17c0ff",
            fontSize: "12",
          },
        },
    
        tooltip: {
          trigger: "item",
          formatter: "{a} <br/>{b}: {c} ({d}%)",
          position: function (p) {
            //其中p为当前鼠标的位置
            return [p[0] + 10, p[1] - 10];
          },
        },
    
        grid: {
          left: "3%",
          right: "3%",
          bottom: "3%",
          top: "25%",
          containLabel: true,
        },
    
        xAxis: {
          name: "名称",
          type: "category",
          data: [],
          axisLabel: {
            textStyle: {
              color: "rgba(255,255,255,.8)",
              //fontSize: 14,
            },
            // formatter: "{value}%",
          },
          axisLine: {
            lineStyle: {
              color: "rgba(255,255,255,.2)",
            },
          },
          splitLine: {
            lineStyle: {
              color: "rgba(255,255,255,.1)",
            },
          },
        },
        yAxis: {
          name: "亿元",
          type: "value",
          data: [],
          axisLabel: {
            textStyle: {
              color: "rgba(255,255,255,.8)",
              //fontSize: 14,
            },
            formatter: "{value}",
          },
          axisLine: {
            lineStyle: {
              color: "rgba(255,255,255,.2)",
            },
          },
          splitLine: {
            lineStyle: {
              color: "rgba(255,255,255,.1)",
            },
          },
        },
        visualMap: {
          top: "top",
          left: "right",
          textStyle: {
            color: "rgba(255,255,255,.8)",
            //fontSize: 14,
          },
          pieces: [
            {
              gt: 0,
              lte: 100,
              color: "#FF0000",
            },
            {
              gt: 100,
              lte: 800,
              color: "#FFA500",
            },
            {
              gt: 800,
              lte: 900,
              color: "#2E8B57",
            },
          ],
        },
        series: [
          {
            name: "年龄分布",
            type: "line",
            // stack: "total",
            // label: {
            //   show: true,
            // },
            // 使用系统函数
            markPoint: {
              label: {
                textStyle: {
                  color: "rgba(255,255,255,.8)",
                  //fontSize: 14,
                },
              },
              data: [
                { type: "max", name: "Max" },
                { type: "min", name: "Min" },
              ],
            },
            markLine: {
              data: [{ type: "average", name: "Avg" }],
            },
            // 自定义数据
            // markLine: {
            //   // 图形是否不响应和触发鼠标事件
            //   silent: true,
            //   label: {
            //     textStyle: {
            //       color: "rgba(255,255,255,.8)",
            //       //fontSize: 14,
            //     },
            //   },
            //   data: [
            //     {
            //       yAxis: 100,
            //       lineStyle: {
            //         color: "#FF0000",
            //       },
            //     },
            //     {
            //       yAxis: 800,
            //       lineStyle: {
            //         color: "#FFA500",
            //       },
            //     },
            //     {
            //       yAxis: 900,
            //       lineStyle: {
            //         color: "#2E8B57",
            //       },
            //     },
            //   ],
            // },
          },
        ],
      };
    
      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    }
    
    function getKeys(dataList) {
      var keys = [];
      var len = dataList.length;
      for (var i = 0; i < len; i++) keys.push(dataList[i].name);
      return keys;
    }</pre>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172

    3. 前端JS - 数据定时更新控制

    支持在每个echarts图表中独立控制定时更新的间隔。

    <pre class="prettyprint hljs php" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">// 定时1s执行数据更新函数
      setInterval(function () {
        async_echart_bar_horizontal(
          container,
          path_bar_horizontal + "bar_horizontal.json"
        );
      }, 1000);</pre>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    4、后端Java代码

    <pre class="prettyprint hljs kotlin" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">@RestController
    @RequestMapping("/json")
    public class Process {
    
        @RequestMapping("/{filename}")
        public String json(@PathVariable("filename") String filename) throws Exception {
            System.out.println(filename);
            ChangeJSON(filename);
    
            String jsonStr = readJSON(filename);
            System.out.println(jsonStr);
            return jsonStr;
        }</pre>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    5、数据通信 JSON

    <pre class="prettyprint hljs json" style="padding: 0.5em; font-family: Menlo, Monaco, Consolas, &quot;Courier New&quot;, monospace; color: rgb(68, 68, 68); border-radius: 4px; display: block; margin: 0px 0px 1.5em; font-size: 14px; line-height: 1.5em; word-break: break-all; overflow-wrap: break-word; white-space: pre; background-color: rgb(246, 246, 246); border: none; overflow-x: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">[
        {
            "name": "10:00",
            "value": 300
        },
        {
            "name": "10:01",
            "value": 301
        },
        {
            "name": "10:02",
            "value": 301
        },
        {
            "name": "10:03",
            "value": 300
        },
        {
            "name": "10:04",
            "value": 300
        },
        {
            "name": "10:05",
            "value": 303
        },
        {
            "name": "10:06",
            "value": 303
        },
        {
            "name": "10:07",
            "value": 303
        }
    ]</pre>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34

    四、开发配置&代码结构说明

    ​数据可视化:基于 Echarts +Java SpringBoot 实现的动态实时大屏【Java开发环境搭建】

    五. 运行效果

    六、更多案例

    YYDatav的数据可视化大屏《精彩案例汇总》(Python&Echarts源码)_YYDataV的博客-CSDN博客

    【工厂扫码打印&扫码装箱&错误追溯系统】完整案例详解(Python&PyQt 源码&Mysql数据库)_YYDataV数据可视化的博客-CSDN博客_pyqt案例

    本次分享结束,欢迎讨论!QQ微信同号: 6550523

  • 相关阅读:
    CV计算机视觉每日开源代码Paper with code速览-2023.11.14
    开源模型应用落地-工具使用篇-向量数据库(三)
    站点到站点的流量监控
    从 C# 崩溃异常 中研究页堆布局
    详细剖析多线程4----锁策略(八股文/面试常考)
    UG NX二次开发(C#)- 制图(Draft)-工程图框选制图曲线并输出制图曲线的信息
    前端数据加解密:保护敏感信息的关键
    微信小程序AI类目-深度合成-AI问答/AI绘画 互联网信息服务算法备案审核通过教程
    2021视觉算法岗社招面经
    HarmonyOS鸿蒙原生应用开发设计- 服务组件库
  • 原文地址:https://blog.csdn.net/jjc4261/article/details/125526138