webpackJsonp([9],{MBlM:function(a,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=r("fZjL"),n=r.n(e),o=r("WaEV"),s=r.n(o),i=(r("UlOv"),{name:"radar",props:["chartData","options","width","height"],watch:{chartData:function(){this.myChart?this.myChart.update():this.myChart=new Chart(this.$refs.chart.getContext("2d"),{type:"radar",data:this.chartData,options:this.options})}},data:function(){return{myChart:null}},mounted:function(){this.chartData&&(this.myChart=new Chart(this.$refs.chart.getContext("2d"),{type:"radar",data:this.chartData,options:this.options}))},methods:{updateChart:function(){this.myChart.update()}}}),d={render:function(){var a=this.$createElement,t=this._self._c||a;return t("div",[t("canvas",{ref:"chart",staticStyle:{margin:"auto"},attrs:{height:this.height}})])},staticRenderFns:[]};var h=r("VU/8")(i,d,!1,function(a){r("ffRr")},"data-v-7b87284d",null).exports,c=s.a.helpers.color,l={created:function(){},data:function(){return{_seed:"",radarData:null,radarOptions:{legend:{position:"top"},title:{display:!0,text:"雷达图"},scale:{ticks:{beginAtZero:!0}}},chartColors:{red:"rgb(255, 99, 132)",orange:"rgb(255, 159, 64)",yellow:"rgb(255, 205, 86)",green:"rgb(75, 192, 192)",blue:"rgb(54, 162, 235)",purple:"rgb(153, 102, 255)",grey:"rgb(201, 203, 207)"},MONTHS:["January","February","March","April","May","June","July","August","September","October","November","December"]}},mounted:function(){this.updateChart()},methods:{updateChart:function(){this._seed=Date.now(),this.radarData={labels:[["Eating","Dinner"],["Drinking","Water"],"Sleeping",["Designing","Graphics"],"Coding","Cycling","Running"],datasets:[{label:"数据集1",backgroundColor:c(this.chartColors.red).alpha(.2).rgbString(),borderColor:this.chartColors.red,pointBackgroundColor:this.chartColors.red,data:[this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor()]},{label:"数据集2",backgroundColor:c(this.chartColors.blue).alpha(.2).rgbString(),borderColor:this.chartColors.blue,pointBackgroundColor:this.chartColors.blue,data:[this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor(),this.randomScalingFactor()]}]}},randomScalingFactor:function(){return Math.round(100*Math.random())},randNum:function(a,t){var r=this._seed;return a=void 0===a?0:a,t=void 0===t?1:t,this._seed=(9301*r+49297)%233280,a+this._seed/233280*(t-a)},randomizeData:function(){var a=this,t=this.radarData;t.datasets.forEach(function(r,e){var n=r;n.data.forEach(function(t,r){n.data[r]=a.randomScalingFactor()}),t.datasets[e]=n}),this.radarData=t,this.$refs.radar.updateChart()},addDataset:function(){for(var a=n()(this.chartColors),t=a[this.radarData.datasets.length%a.length],r=this.chartColors[t],e={label:"数据集 "+(this.radarData.datasets.length+1),borderColor:r,backgroundColor:c(r).alpha(.2).rgbString(),pointBorderColor:r,data:[]},o=0;o<this.radarData.labels.length;++o)e.data.push(this.randomScalingFactor());this.radarData.datasets.push(e),this.$refs.radar.updateChart()},removeDataset:function(){this.radarData.datasets.splice(this.radarData.datasets.length-1,1),this.$refs.radar.updateChart()},addData:function(){var a=this;this.radarData.datasets.length>0&&(this.radarData.labels.push("dataset #"+this.radarData.labels.length),this.radarData.datasets.forEach(function(t,r){a.radarData.datasets[r].data.push(a.randomScalingFactor())}),this.$refs.radar.updateChart())},removeData:function(){this.radarData.datasets.splice(0,1),this.$refs.radar.updateChart()}},components:{radarChart:h}},u={render:function(){var a=this,t=a.$createElement,r=a._self._c||t;return r("div",[r("radar-chart",{ref:"radar",staticStyle:{"max-width":"1200px",margin:"auto"},attrs:{height:150,chartData:a.radarData,options:a.radarOptions}}),a._v(" "),r("el-row",{staticClass:"btn-content",attrs:{type:"flex",justify:"center"}},[r("el-button",{on:{click:a.randomizeData}},[a._v("随机改变值")]),a._v(" "),r("el-button",{attrs:{type:"primary"},on:{click:a.addDataset}},[a._v("添加数据集")]),a._v(" "),r("el-button",{attrs:{type:"success"},on:{click:a.removeDataset}},[a._v("删除数据集")]),a._v(" "),r("el-button",{attrs:{type:"info"},on:{click:a.addData}},[a._v("添加数据")]),a._v(" "),r("el-button",{attrs:{type:"warning"},on:{click:a.removeData}},[a._v("删除数据")])],1)],1)},staticRenderFns:[]};var g=r("VU/8")(l,u,!1,function(a){r("aQK6")},"data-v-51ec2908",null);t.default=g.exports},aQK6:function(a,t){},ffRr:function(a,t){}});
//# sourceMappingURL=9.521b8d92391145f3ea68.js.map