// Generated by CoffeeScript 1.10.0 (function() { var app; Vue.component('matrix', { props: { data: { type: Array, required: true }, padding: { type: Number, "default": 1 }, cellsize: { type: Number, "default": 20 } }, template: '\n \n \n \n', computed: { max: function() { return d3.max(this.data, function(r) { return d3.max(r); }); }, nrows: function() { return this.data.length; }, ncols: function() { if (this.data.length > 0) { return this.data[0].length; } else { return 0; } }, scale: function() { return d3.scaleSqrt().domain([0, this.max]).range([0, Math.max(0, this.cellsize - this.padding)]); } } }); app = new Vue({ el: '#app', data: { matrix1: [[1, 2, 3], [4, 5, 6], [9, 9, 9]], matrix2: [[12, 24, 35], [45, 15, 60], [60, 60, 60]] } }); }).call(this);