前端之家收集整理的这篇文章主要介绍了
Chart.js在Laravel项目中的应用示例,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_3010@
介绍
@H301_0@Chart.js是一个HTML5图表库,使用canvas元素来展示各式各样的客户端图表,
支持折线图、柱形图、雷达图、饼图、环形图等, 本文将介绍如何在laravel项目中使用chart.js
@H_
3010@安装
@H301_0@可以通过以下命令在 npm 或 bower 中来安装chart.js。
<div class="jb51code">
<pre class="brush:bash;">
npm install chart.js --save
bower install chart.js --save
=',Carbon::today())->where('site',1)->count());
array_push($today_data,2)->count());
array_push($today_data,3)->count());
array_push($today_data,4)->count());
Log::info(json_encode($my_data));
return $my_data;
}
首页
文章列表","
分类文章列表","
文章详情","关于我",],datasets: [{
data: data,backgroundColor: [
window.chartColors.red,window.chartColors.orange,window.chartColors.purple,window.chartColors.green,}]
},options: {
responsive: true,}
});
});