当前位置:网站首页>Thinkphp5 + data large screen display effect
Thinkphp5 + data large screen display effect
2022-04-23 14:53:00 【Game programming】
1 Controller code display :
Controller code :
// The data output after loading the page public function index() { $data = Db::name('index')->limit(5)->select(); $this->assign('data',$data); $this->display(); return view('index'); } // Get data asynchronously public function data(){ $list = Db::name('index')->limit(5)->select(); // Reorganize array foreach ($list as $key => $value) { $arr['id'][] = $value['id']; $arr['name'][] = $value['name']; $arr['number'][] = $value['number']; $arr['details'][] = $value['details']; $arr['create_time'][] = $value['create_time']; } die(json_encode($arr)); // Convert to json Data output }
html Code :
<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>ECharts</title> <!-- introduce echarts.js --> <script src="echarts.min.js"></script></head><body><!-- by ECharts Prepare one with size ( Wide and high ) Of Dom --><div id="main" style="width: 600px;height:400px;"></div></body><script src="http://code.jquery.com/jquery-2.2.1.min.js"></script><script type="text/javascript"> var myChart; myChart = echarts.init(document.getElementById('main')); myChart.setOption({ title: { text: ' Asynchronous data loading example ' }, tooltip: {}, legend: { data:[' sales '] }, xAxis: { // Display in the chart after loading the page X Axis information data: [<?php foreach($data as $v){; ?>"<?php echo $v['name'] ?>",<?php }; ?>] }, yAxis: {}, series: [{ name: ' sales ', // type: 'line',// Broken line diagram type: 'bar',// Histogram // Display in the chart after loading the page Y Axis information data: [<?php foreach($data as $v){; ?>"<?php echo $v['number'] ?>",<?php }; ?>], itemStyle:{ // Color definition normal:{color:'#00bc12'} } }] }); // Load background data asynchronously , Through the timer to achieve var i = 0; function run() { i++; $.ajax({ url: "{:url('index/index/data')}", type: 'POST', dataType: 'JSON', data:{page:i}, success:function(json){ if(json.datetime.length != 5){ clearInterval(time); return; } myChart.setOption({ xAxis: { data: json.create_time }, series: [{ name: ' sales ', data: json.details }] }); } }) }; <!--var time = setInterval(run,3000);--></script></html>
Display effect display :
Database display :
Line chart effect :
author : A deep preference
Game programming ️, A game development favorite ~
If the picture is not displayed for a long time , Please use Chrome Kernel browser .
版权声明
本文为[Game programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231447589940.html
边栏推荐
- [servlet] detailed explanation of servlet (use + principle)
- Swift protocol Association object resource name management multithreading GCD delay once
- Borui data and F5 jointly build the full data chain DNA of financial technology from code to user
- 如何打开Win10启动文件夹?
- Advanced application of I / O multiplexing: Processing TCP and UDP services at the same time
- Little red book timestamp2 (2022 / 04 / 22)
- Leetcode165 compare version number double pointer string
- 牛客网数据库SQL实战详细剖析(26-30)
- Outsourcing for four years, abandoned
- SQLSERVER事物与锁的问题
猜你喜欢

DVWA之暴力破解(Brute Force)Low-->high

Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot

每日一题-LeetCode396-旋转函数-递推

电容

Swift: entry of program, swift calls OC@_ silgen_ Name, OC calls swift, dynamic, string, substring

3、 Gradient descent solution θ

Sword finger offer II 019 Delete at most one character to get palindrome (simple)

Do (local scope), initializer, memory conflict, swift pointer, inout, unsafepointer, unsafebitcast, success

we引用My97DatePicker 实现时间插件使用

LeetCode151-颠倒字符串中的单词-字符串-模拟
随机推荐
Do (local scope), initializer, memory conflict, swift pointer, inout, unsafepointer, unsafebitcast, success
Difference between like and regexp
When splicing HQL, the new field does not appear in the construction method
Progress in the treatment of depression
【Proteus仿真】自动量程(范围<10V)切换数字电压表
Ali developed three sides, and the interviewer's set of combined punches made me confused on the spot
ASEMI三相整流桥和单相整流桥的详细对比
多语言通信基础 06 go实现grpc的四种数据流模式实现
Unity_ Code mode add binding button click event
Introduction to Arduino for esp8266 serial port function
【工厂模式详解】工厂方法模式
Go basic reflection
LeetCode151-颠倒字符串中的单词-字符串-模拟
A good tool: aardio
3、 Gradient descent solution θ
Sqlserver transaction and lock problem
填充每个节点的下一个右侧节点指针 II [经典层次遍历 | 视为链表 ]
抑郁症治疗的进展
Async keyword
Swift - literal, literal protocol, conversion between basic data types and dictionary / array