Style comparison simple function realized and share with everyone
There are a lot of plug-ins in this address can be used in cylindrical polyline and so we can refer to the development
https://bbs.hcharts.cn/forum.php
On the code (the first version there are many places to deal with the uncomfortable, we can improve themselves)
html+ Plugin JS code continues to optimize iterations
<! DOCTYPE html>
<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 Code/
</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>
<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: ' Register member Stats '
},
Subtitle: {
Text: ' Data source: Charming Group '
},
Xaxis: {
categories: [data[0].date,data[1].date] }, yAxis: { title: { text: ‘人数(个)‘ } }, plotOptions: { line: { dataLabels: { // 开启数据标签 enabled: true }, // 关闭鼠标跟踪,对应的提示框、点击事件会失效 enableMouseTracking: false } }, series: [{ name: ‘会员量‘, data: [data[0].count,data[1].count] }] }); }});
</script>
</body>
Based on TP5 framework Development
Controller
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(); }} 数据表: ![](http://i2.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=)
TP5 counting the number of member registrations based on JS line graph plugin