text: "use strict";var chartjsBarDemo={init:function(){this.bindUIActions()},bindUIActions:function(){Chart.defaults.global.maintainAspectRatio=!1,this.barChart(),this.barHorizontal(),this.barStacked(),this.barStackedGroup(),this.barMultiAxis()},colors:function(){return{red:"#B76BA3",orange:"#EC935E",yellow:"#F7C46C",green:"#A7C796",teal:"#00A28A",blue:"#346CB0",purple:"#5F4B8B",gray:"#BEC1C4"}},getColor:function(a){return this.colors()[a]},colorNames:function(a){return Object.keys(this.colors())},randomScalingFactor:function(){return(.5<Math.random()?1:-1)*Math.round(100*Math.random())},months:function(){return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},barChart:function(){var r=this,n={labels:["Jan","Feb","Mar","Apr","May","Jun","Jul"],datasets:[{label:"Dataset 1",backgroundColor:r.getColor("purple"),borderColor:r.getColor("purple"),borderWidth:1,data:[r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor()]},{label:"Dataset 2",backgroundColor:r.getColor("teal"),borderColor:r.getColor("teal"),borderWidth:1,data:[r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor(),r.randomScalingFactor()]}]},a=$("#canvas-bar")[0].getContext("2d"),l=new Chart(a,{type:"bar",data:n,options:{responsive:!0,legend:{display:!1},title:{display:!0,text:"Bar Chart"},scales:{xAxes:[{ticks:{maxRotation:0,maxTicksLimit:5}}]}}});$("#randomizeData").on("click",function(a){a.preventDefault();var t=Math.random()<.2;n.datasets.forEach(function(a){a.data=a.data.map(function(){return t?0:r.randomScalingFactor()})}),l.update()}),$("#addData").on("click",function(a){if(a.preventDefault(),0<n.datasets.length){var t=r.months()[n.labels.length%r.months().length];n.labels.push(t);for(var o=0;o<n.datasets.length;++o)n.datasets[o].data.push(r.randomScalingFactor());l.update()}}),$("#removeData").on("click",function(a){a.preventDefault(),n.labels.splice(-1,1),n.datasets.forEach(function(a,t){a.data.pop()}),l.update()})},barHorizontal:function(){var l=this,c={labels:["Jan","Feb","Mar","Apr","May","Jun","Jul"],datasets:[{label:"Dataset 1",backgroundColor:l.getColor("purple"),borderColor:l.getColor("purple"),borderWidth:1,data:[l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor()]},{label:"Dataset 2",backgroundColor:l.getColor("teal"),borderColor:l.getColor("teal"),data:[l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor(),l.randomScalingFactor()]}]},a=$("#canvas-horizontal-bar")[0].getContext("2d"),e=new Chart(a,{type:"horizontalBar",data:c,options:{elements:{rectangle:{borderWidth:2}},responsive:!0,legend:{display:!1},title:{display:!0,text:"Horizontal Bar Chart"}}});$("#randomizeDataHorizontalBar").on("click",function(a){a.preventDefault();var t=Math.random()<.2;c.datasets.forEach(function(a){a.data=a.data.map(function(){return t?0:l.randomScalingFactor()})}),e.update()}),$("#addDatasetHorizontalBar").on("click",function(a){if(a.preventDefault(),c.datasets.length<=6){for(var t=l.colorNames()[c.datasets.length%Object.keys(l.colors()).length],o=l.getColor(t),r={label:"Dataset "+c.datasets.length,backgroundColor:o,borderColor:o,data:[]},n=0;n<c.labels.length;++n)r.data.push(l.randomScalingFactor());c.datasets.push(r),e.update()}}),$("#removeDatasetHorizontalBar").on("click",function(){c.datasets.splice(0,1),e.update()})},barStacked:function(){var a=this,t={labels:["Jan","Feb","Mar","Apr","May","Jun","Jul"],datasets:[{label:"Dataset 1",backgroundColor:a.getColor("blue"),data:[a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor()]},{label:"Dataset 2",backgroundColor:a.getColor("teal"),data:[a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor()]},{label:"Dataset 3",backgroundColor:a.getColor("purple"),data:[a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor()]}]},o=$("#canvas-stacked")[0].getContext("2d");new Chart(o,{type:"bar",data:t,options:{title:{display:!0,text:"Stacked"},tooltips:{mode:"index",intersect:!1},responsive:!0,legend:{display:!1},scales:{xAxes:[{stacked:!0}],yAxes:[{stacked:!0}]}}})},barStackedGroup:function(){var a=this,t={labels:["Jan","Feb","Mar","Apr","May","Jun","Jul"],datasets:[{label:"Dataset 1",backgroundColor:a.getColor("purple"),stack:"Stack 0",data:[a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor()]},{label:"Dataset 2",backgroundColor:a.getColor("teal"),stack:"Stack 0",data:[a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor()]},{label:"Dataset 3",backgroundColor:a.getColor("teal"),stack:"Stack 1",data:[a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor()]}]},o=$("#canvas-stacked-group")[0].getContext("2d");new Chart(o,{type:"bar",data:t,options:{title:{display:!0,text:"Stacked Group"},tooltips:{mode:"index",intersect:!1},responsive:!0,legend:{display:!1},scales:{xAxes:[{stacked:!0}],yAxes:[{stacked:!0}]}}})},barMultiAxis:function(){var a=this,t={labels:["Jan","Feb","Mar","Apr","May","Jun","Jul"],datasets:[{label:"Dataset 1",backgroundColor:[a.getColor("purple"),a.getColor("orange"),a.getColor("green"),a.getColor("teal"),a.getColor("blue"),a.getColor("red"),a.getColor("purple")],yAxisID:"y-axis-1",data:[a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor()]},{label:"Dataset 2",backgroundColor:a.getColor("gray"),yAxisID:"y-axis-2",data:[a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor(),a.randomScalingFactor()]}]},o=$("#canvas-multi-axis")[0].getContext("2d");new Chart(o,{type:"bar",data:t,options:{responsive:!0,legend:{display:!1},title:{display:!0,text:"Multi Axis"},tooltips:{mode:"index",intersect:!0},scales:{yAxes:[{type:"linear",display:!0,position:"left",id:"y-axis-1"},{type:"linear",display:!0,position:"right",id:"y-axis-2",gridLines:{drawOnChartArea:!1}}]}}})}};chartjsBarDemo.init();