博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
echart与ajax 获取动态数据
阅读量:6072 次
发布时间:2019-06-20

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

//引入echart.js  
//echart的data引入getStatus()函数,在函数中调用后台接口,从而获取到后台数据,按照echart所需要的格式在sql中查取数据 echart所要的格式为:[26, 59, 80, 24, 87, 70, 175, 1072, 48, 18, 69, 63] 后台sql语句的格式必须和echart的格式对应,若某个月份没有收入则默认为0,此时sql语句为: SELECT B.temp AS tempFROM (SELECT month(r_addtime)as months ,sum(r_paid_in) AS tempFROM recordWHERE r_status=#{rstatus} and shop_id=#{shopId} and year(r_addtime)=2019group by year(r_addtime), month(r_addtime)UNIONSELECT '1' as mon,'0' as tempunion SELECT '2' as mon,'0' as tempunion SELECT '3' as mon,'0' as temp union SELECT '4' as mon,'0' as temp union SELECT '5' as mon,'0' as temp union SELECT '6' as mon,'0' as temp union SELECT '7' as mon,'0' as temp union SELECT '8' as mon,'0' as temp union SELECT '9' as mon,'0' as temp union SELECT '10' as mon,'0' as temp union SELECT '11' as mon,'0' as temp union SELECT '12' as mon,'0' as temp) BGROUP BY B.monthsORDER BY B.months复制代码

效果图如下:

转载于:https://juejin.im/post/5c2d72d2f265da612e28c212

你可能感兴趣的文章
转:NetBeans的远程Linux C开发实践
查看>>
ScrollView拉到尽头时出现阴影的解决方法
查看>>
请允许我转载一篇关于套接字的博客:Socket
查看>>
wamp配置步骤
查看>>
JS - 点击事件排除父级标签
查看>>
Ubuntu 14.04 更新gcc版本至4.9.2
查看>>
启发录-打造用户喜爱的产品
查看>>
Mac/win eclipse genymotion 插件下载地址
查看>>
[LeetCode]Single Number 异或的妙用
查看>>
使用go语言解析xml
查看>>
HTML5学习笔记简明版(11):新增的API
查看>>
Nginx 进程间通信
查看>>
html单引号,双引号转义
查看>>
go语言使用go-sciter创建桌面应用(五) 加载元素资源
查看>>
基础认证伪造工具phishery
查看>>
CentOS7上RabbitMQ安装
查看>>
【Redis笔记(四)】 Redis数据结构 - list链表
查看>>
IntelliJ IDEA 2017.1.4 x64配置说明
查看>>
网址2
查看>>
MySQL 中随机抽样:order by rand limit 的替代方案
查看>>