欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

怎么在laravel5.5中添加echarts實(shí)現(xiàn)畫圖功能-創(chuàng)新互聯(lián)

今天就跟大家聊聊有關(guān)怎么在laravel5.5中添加echarts實(shí)現(xiàn)畫圖功能,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

創(chuàng)新互聯(lián)網(wǎng)站建設(shè)由有經(jīng)驗(yàn)的網(wǎng)站設(shè)計(jì)師、開發(fā)人員和項(xiàng)目經(jīng)理組成的專業(yè)建站團(tuán)隊(duì),負(fù)責(zé)網(wǎng)站視覺設(shè)計(jì)、用戶體驗(yàn)優(yōu)化、交互設(shè)計(jì)和前端開發(fā)等方面的工作,以確保網(wǎng)站外觀精美、成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、外貿(mào)營銷網(wǎng)站建設(shè)易于使用并且具有良好的響應(yīng)性。

一、下載echarts

二、在頁面中引入echarts


<script type="text/javascript" src="/js/echarts.min.js"></script>

我把下載下來的echarts.min.js放在了public/js/目錄下

三、通過post的請(qǐng)求獲取數(shù)據(jù)并在頁面展示

1.添加路由

Route::get('/test2', 'CunliangController@test2')->name('test2');

Route::post('/odata', 'CunliangController@odata');

/test2用來展示echarts的界面,/odata獲取數(shù)據(jù)。

2.控制器添加代碼

public function test2()
{
 return view('cunliang.test2');
}
public function odata()
{
 //返回最近七天的數(shù)據(jù)
 $data = Cunliang::where("file_type", "O")->latest()
     ->take(7)
     ->get();

 return array_reverse($data->toArray(),false);

}

3.頁面blade模板添加

<div id="contain" ></div>

4.添加js

<script type="text/javascript">
 var names = [];
 var ttls = [];
 function getData()
 {
  $.post("{{ url('/odata') }}", {
   "_token": "{{ csrf_token() }}"
  }, function(data) {
   $.each(data, function(i, item) {
    names.push(item.update_date);
    ttls.push(item.space_size);
   });
  });
 }
 getData();
 function chart() {
  var myChart = echarts.init(document.getElementById("contain"));


  option = {
   title : {
    text: 'O域數(shù)據(jù)最近7天更新情況'
   },
   tooltip : {
    trigger: 'axis'
   },
   legend: {
    data:['數(shù)據(jù)大小']
   },
   toolbox: {
    show : true,
    feature : {
     mark : {show: true},
     dataView : {show: true, readOnly: false},
     magicType : {show: true, type: ['line', 'bar']},
     restore : {show: true},
     saveAsImage : {show: true}
    }
   },
   calculable : true,
   xAxis : [
    {
     axisLine: {
      lineStyle: { color: '#333' }
     },
     axisLabel: {
      rotate: 30,
      interval: 0
     },
     type : 'category',
     boundaryGap : false,
     data : names // x的數(shù)據(jù),為上個(gè)方法中得到的names
    }
   ],
   yAxis : [
    {
     type : 'value',
     axisLabel : {
      formatter: '{value} M'
     },
     axisLine: {
      lineStyle: { color: '#333' }
     }
    }
   ],
   series : [
    {
     name:'數(shù)據(jù)大小',
     type:'line',
     smooth: 0.3,
     data: ttls // y軸的數(shù)據(jù),由上個(gè)方法中得到的ttls
    }
   ]
 };
 // 使用剛指定的配置項(xiàng)和數(shù)據(jù)顯示圖表。
 myChart.setOption(option);
 }
 setTimeout('chart()', 1000);
</script>

看完上述內(nèi)容,你們對(duì)怎么在laravel5.5中添加echarts實(shí)現(xiàn)畫圖功能有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。

新聞名稱:怎么在laravel5.5中添加echarts實(shí)現(xiàn)畫圖功能-創(chuàng)新互聯(lián)
分享路徑:http://chinadenli.net/article16/ioidg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航網(wǎng)站設(shè)計(jì)公司、網(wǎng)頁設(shè)計(jì)公司、全網(wǎng)營銷推廣、服務(wù)器托管外貿(mào)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化