1 line
3.7 KiB
JavaScript
1 line
3.7 KiB
JavaScript
!function(e){"use strict";var t={},r=function(){return Math.round(15*Math.random())+5};e(document).ready(function(){return e("#bar-chartjs-chart").length&&t.bar("bar-chartjs-chart","top","bar"),e("#horizontal-bar-chartjs-chart").length&&t.bar("horizontal-bar-chartjs-chart","right","horizontalBar"),e("#line-chartjs-chart").length&&t.line("line-chartjs-chart",!1),e("#area-chartjs-chart").length&&t.line("area-chartjs-chart",!0),e("#pie-chartjs-chart").length&&t.pie("pie-chartjs-chart","pie"),e("#donut-chartjs-chart").length&&t.pie("donut-chartjs-chart","doughnut"),e("#polar-chartjs-chart").length&&t.polar("polar-chartjs-chart"),e("#radar-chartjs-chart").length&&t.radar("radar-chartjs-chart"),!1}),t={bar:function(e,t,i){var o={labels:["January","February","March","April"],datasets:[{label:"Dataset 1",backgroundColor:"rgba(249,200,81,0.3)",borderColor:"rgb(249, 200, 81)",borderWidth:1,hoverBackgroundColor:"rgba(249,200,81,0.6)",hoverBorderColor:"rgb(249, 200, 81)",data:[r(),r(),r(),r()]},{label:"Dataset 2",backgroundColor:"rgba(127, 193, 252, 0.3)",borderColor:"#7fc1fc",borderWidth:1,hoverBackgroundColor:"rgba(127, 193, 252, 0.6)",hoverBorderColor:"#7fc1fc",data:[r(),r(),r(),r()]},{label:"Dataset 3",backgroundColor:"rgba(245,112,122,0.3)",borderColor:"#f5707a",borderWidth:1,hoverBackgroundColor:"rgba(245,112,122,0.6)",hoverBorderColor:"#f5707a",data:[r(),r(),r(),r()]}]},a=document.getElementById(e).getContext("2d");return new Chart(a,{type:i,data:o,options:{hover:{mode:"label"},responsive:!0,legend:{position:t},scales:{xAxes:[{ticks:{beginAtZero:!0}}],yAxes:[{ticks:{beginAtZero:!0}}]}}}),!1},line:function(e,t){var i={labels:["0","1","2","3","4","5","6","7","8","9","10"],datasets:[{label:"Series 1",fill:t,borderColor:"rgba(245,112,122,1)",pointBackgroundColor:"rgb(245,112,122)",backgroundColor:"rgba(245,112,122,0.3)",data:[r(),r(),r(),r(),r(),r(),r(),r(),r(),r(),r()]}]},o=document.getElementById(e).getContext("2d");return new Chart(o,{type:"line",data:i,options:{hover:{mode:"label"},responsive:!0,scales:{xAxes:[{ticks:{beginAtZero:!0}}],yAxes:[{ticks:{beginAtZero:!0}}]}}}),!1},pie:function(e,t){var i=document.getElementById(e).getContext("2d"),o={type:t,data:{datasets:[{data:[r(),r(),r()],backgroundColor:["#f9c851","#3ac9d6","#ebeff2"],hoverBackgroundColor:["#f9c851","#3ac9d6","#ebeff2"],hoverBorderColor:"#fff"}],labels:["Red","Green","Yellow"]},options:{responsive:!0}};return new Chart(i,o),!1},polar:function(e){var t=document.getElementById(e).getContext("2d"),i={data:{datasets:[{data:[r(),r(),r(),r()],backgroundColor:["#f5707a","#188ae2","#4bd396","#8d6e63"],label:"My dataset"}],labels:["Red","Blue","Green","Grey"]},options:{responsive:!0,legend:{position:"top"},scale:{ticks:{beginAtZero:!0},reverse:!1},animation:{animateRotate:!1,animateScale:!0}}};return new Chart.PolarArea(t,i),!1},radar:function(e){var t=document.getElementById(e).getContext("2d"),i={type:"radar",data:{labels:["Eating","Drinking","Sleeping","Designing","Coding","Cycling","Running"],datasets:[{label:"Peter",backgroundColor:"rgba(179,181,198,0.2)",borderColor:"rgba(179,181,198,1)",pointBackgroundColor:"rgba(179,181,198,1)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"rgba(179,181,198,1)",data:[r(),r(),r(),r(),r(),r(),r()]},{label:"John",backgroundColor:"rgba(255,99,132,0.2)",borderColor:"rgba(255,99,132,1)",pointBackgroundColor:"rgba(255,99,132,1)",pointBorderColor:"#fff",pointHoverBackgroundColor:"#fff",pointHoverBorderColor:"rgba(255,99,132,1)",data:[r(),r(),r(),r(),r(),r(),r()]}]},options:{legend:{position:"top"},scale:{reverse:!1,gridLines:{color:["black","red","orange","yellow","green","blue","indigo","violet"]},ticks:{beginAtZero:!0}}}};return new Chart(t,i),!1}}}(jQuery); |