1 line
3.7 KiB
JavaScript
1 line
3.7 KiB
JavaScript
|
!function(r){"use strict";var e={},t=function(){return Math.round(15*Math.random())+5};r(document).ready(function(){return r("#bar-chartjs-chart").length&&e.bar("bar-chartjs-chart","top","bar"),r("#horizontal-bar-chartjs-chart").length&&e.bar("horizontal-bar-chartjs-chart","right","horizontalBar"),r("#line-chartjs-chart").length&&e.line("line-chartjs-chart",!1),r("#area-chartjs-chart").length&&e.line("area-chartjs-chart",!0),r("#pie-chartjs-chart").length&&e.pie("pie-chartjs-chart","pie"),r("#donut-chartjs-chart").length&&e.pie("donut-chartjs-chart","doughnut"),r("#polar-chartjs-chart").length&&e.polar("polar-chartjs-chart"),r("#radar-chartjs-chart").length&&e.radar("radar-chartjs-chart"),!1}),e={bar:function(r,e,o){var a={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:[t(),t(),t(),t()]},{label:"Dataset 2",backgroundColor:"rgba(127, 193, 252, 0.3)",borderColor:"#7fc1fc",borderWidth:1,hoverBackgroundColor:"rgba(127, 193, 252, 0.6)",hoverBorderColor:"#7fc1fc",data:[t(),t(),t(),t()]},{label:"Dataset 3",backgroundColor:"rgba(245,112,122,0.3)",borderColor:"#f5707a",borderWidth:1,hoverBackgroundColor:"rgba(245,112,122,0.6)",hoverBorderColor:"#f5707a",data:[t(),t(),t(),t()]}]},i=document.getElementById(r).getContext("2d");return new Chart(i,{type:o,data:a,options:{hover:{mode:"label"},responsive:!0,legend:{position:e},scales:{xAxes:[{ticks:{beginAtZero:!0}}],yAxes:[{ticks:{beginAtZero:!0}}]}}}),!1},line:function(r,e){var o={labels:["0","1","2","3","4","5","6","7","8","9","10"],datasets:[{label:"Series 1",fill:e,borderColor:"rgba(245,112,122,1)",pointBackgroundColor:"rgb(245,112,122)",backgroundColor:"rgba(245,112,122,0.3)",data:[t(),t(),t(),t(),t(),t(),t(),t(),t(),t(),t()]}]},a=document.getElementById(r).getContext("2d");return new Chart(a,{type:"line",data:o,options:{hover:{mode:"label"},responsive:!0,scales:{xAxes:[{ticks:{beginAtZero:!0}}],yAxes:[{ticks:{beginAtZero:!0}}]}}}),!1},pie:function(r,e){var o=document.getElementById(r).getContext("2d"),a={type:e,data:{datasets:[{data:[t(),t(),t()],backgroundColor:["#f9c851","#3ac9d6","#ebeff2"],hoverBackgroundColor:["#f9c851","#3ac9d6","#ebeff2"],hoverBorderColor:"#fff"}],labels:["Red","Green","Yellow"]},options:{responsive:!0}};return new Chart(o,a),!1},polar:function(r){var e=document.getElementById(r).getContext("2d"),o={data:{datasets:[{data:[t(),t(),t(),t()],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(e,o),!1},radar:function(r){var e=document.getElementById(r).getContext("2d"),o={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:[t(),t(),t(),t(),t(),t(),t()]},{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:[t(),t(),t(),t(),t(),t(),t()]}]},options:{legend:{position:"top"},scale:{reverse:!1,gridLines:{color:["black","red","orange","yellow","green","blue","indigo","violet"]},ticks:{beginAtZero:!0}}}};return new Chart(e,o),!1}}}(jQuery);
|