webpackJsonp([2],{Lpn0:function(t,a,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});e("WaEV"),e("UlOv");var r={name:"bubble",props:["chartData","options","width","height"],watch:{chartData:function(){this.myChart?this.myChart.update():this.myChart=new Chart(this.$refs.chart.getContext("2d"),{type:"bubble",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:"bubble",data:this.chartData,options:this.options}))},methods:{updateChart:function(){this.myChart.update()}}},n={render:function(){var t=this.$createElement,a=this._self._c||t;return a("div",[a("canvas",{ref:"chart",staticStyle:{margin:"auto"}})])},staticRenderFns:[]};var i={created:function(){},data:function(){return{DATA_COUNT:16,MIN_XY:-150,MAX_XY:100,_seed:"",bubbleData:null,bubbleOptions:null,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)"},COLORS:["#4dc9f6","#f67019","#f53794","#537bc4","#acc236","#166a8f","#00a950","#58595b","#8549ba"],MONTHS:["January","February","March","April","May","June","July","August","September","October","November","December"]}},mounted:function(){this.updateChart()},methods:{updateChart:function(){var t=this;this._seed=Date.now(),this.bubbleOptions={aspectRatio:1,legend:!1,tooltips:!1,elements:{point:{backgroundColor:this.colorize.bind(null,!1),borderColor:this.colorize.bind(null,!0),borderWidth:function(t){return Math.min(Math.max(1,t.datasetIndex+1),8)},hoverBackgroundColor:"transparent",hoverBorderColor:function(a){return t.color(a.datasetIndex)},hoverBorderWidth:function(t){var a=t.dataset.data[t.dataIndex];return Math.round(8*a.v/1e3)},radius:function(t){var a=t.dataset.data[t.dataIndex];return t.chart.width/24*(Math.abs(a.v)/1e3)}}}},this.bubbleData={datasets:[{data:this.generateData()},{data:this.generateData()}]}},colorize:function(t,a){var e=a.dataset.data[a.dataIndex],r=e.x/100,n=e.y/100;return"rgba("+(r<0&&n<0?250:r<0?150:n<0?50:0)+","+(r<0&&n<0?0:r<0?50:n<0?150:250)+","+(r<0&&n<0?0:r>0&&n>0?250:150)+","+(t?1:.5*e.v/1e3)+")"},color:function(t){return this.COLORS[t%this.COLORS.length]},generateData:function(){var t,a=[];for(t=0;t<this.DATA_COUNT;++t)a.push({x:this.rand(this.MIN_XY,this.MAX_XY),y:this.rand(this.MIN_XY,this.MAX_XY),v:this.rand(0,1e3)});return a},rand:function(t,a){var e=this._seed;return t=void 0===t?0:t,a=void 0===a?1:a,this._seed=(9301*e+49297)%233280,t+this._seed/233280*(a-t)},randomizeData:function(){var t=this,a=this.bubbleData;a.datasets.forEach(function(e,r){a.datasets[r].data=t.generateData()}),this.bubbleData=a,this.$refs.bubble.updateChart()},addDataset:function(){this.bubbleData.datasets.push({data:this.generateData()}),this.$refs.bubble.updateChart()},removeDataset:function(){this.bubbleData.datasets.shift(),this.$refs.bubble.updateChart()}},components:{bubbleChart:e("VU/8")(r,n,!1,function(t){e("iXz7")},"data-v-6f61358f",null).exports}},s={render:function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",[e("bubble-chart",{ref:"bubble",staticStyle:{"max-width":"700px",margin:"auto"},attrs:{chartData:t.bubbleData,options:t.bubbleOptions}}),t._v(" "),e("el-row",{staticStyle:{"margin-top":"50px"},attrs:{type:"flex",justify:"center"}},[e("el-button",{on:{click:t.randomizeData}},[t._v("随机改变值")]),t._v(" "),e("el-button",{attrs:{type:"primary"},on:{click:t.addDataset}},[t._v("添加数据集")]),t._v(" "),e("el-button",{attrs:{type:"success"},on:{click:t.removeDataset}},[t._v("删除数据集")])],1)],1)},staticRenderFns:[]};var o=e("VU/8")(i,s,!1,function(t){e("p74x")},"data-v-93d5e824",null);a.default=o.exports},iXz7:function(t,a){},p74x:function(t,a){}});
//# sourceMappingURL=2.9da6a41a8b4326fe6709.js.map