您好,登錄后才能下訂單哦!
樣式比較簡單 功能實現(xiàn)了 和大家共享
這個地址里面有好多插件可以用 圓柱 折線 等等 大家可以去參考 開發(fā)
https://bbs.hcharts.cn/forum.php
上代碼(第一版本還有好多地方處理的不周到,大家可以自行改進)
html+插件js代碼 繼續(xù)優(yōu)化迭代
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8"><link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/ css 代碼 /
</style>
<script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
<script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script>
<script src="https://img.hcharts.cn/highcharts/modules/oldie.js"></script>
<script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script>
<script src="https://img.hcharts.cn/highcharts/themes/sand-signika.js"></script>
</head>
<body>
<div id="container" style="min-width:400px;height:400px"></div>
<script type="text/javascript" src="/static/index/js/jquery-1.12.4.js"></script>
<script type="text/javascript" src="/static/index/js/gw-2.js"></script>
<script>
$.ajax({
type:"post",
url :"{:url('user/user_gy')}",
data :"list:0,list:1",
dataType:"json",
success:function(data){
/ var i = 0;
for(i;i<data.length;i++){
var d_time = data[i].date;
var count = data[i].count;
}/
var chart = Highcharts.chart('container', {
chart: {
type: 'line'
},
title: {
text: '注冊會員統(tǒng)計'
},
subtitle: {
text: '數(shù)據(jù)來源:嬌美夫集團 '
},
xAxis: {
categories: [data[0].date,data[1].date]
},
yAxis: {
title: {
text: '人數(shù)(個)'
}
},
plotOptions: {
line: {
dataLabels: {
// 開啟數(shù)據(jù)標簽
enabled: true
},
// 關(guān)閉鼠標跟蹤,對應的提示框、點擊事件會失效
enableMouseTracking: false
}
},
series: [{
name: '會員量',
data: [data[0].count,data[1].count]
}]
});
}
});
</script>
</body>
</html>
基于tp5框架開發(fā)
控制器
public function user_gy(){
if(request()->isPost()){
$time = date("Y-m-d");
$j_t =time();
$lastM =date("Y-m-d",strtotime("$time -1 month"));
$new_T =strtotime($lastM);
$user = Db::name("User")
->field("count(id) as count,FROM_UNIXTIME(update_time,'%Y-%m-%d') as date")
->where("status = 1 and update_time <= '$j_t' and update_time >= '$new_T'")
->group("date")
->select();
return json($user);
}else{
return $this->fetch();
}
}
數(shù)據(jù)表:
![](https://s1.51cto.com/images/blog/201808/02/45df760c594c76c6117e5eb26d1bc27e.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。