1if (urlParams['dev'] == '1') 2{ 3 (function() 4 { 5 var graphGetTooltipForCell = Graph.prototype.getTooltipForCell; 6 7 /** 8 * Overrides tooltips to show custom tooltip or metadata. 9 */ 10 Graph.prototype.getTooltipForCell = function(cell) 11 { 12 var tip = graphGetTooltipForCell.apply(this, arguments); 13 var geo = this.getCellGeometry(cell); 14 15 tip += ((tip.length > 0) ? '<br>' : '') + 'id=' + cell.id + '<br>'; 16 17 if (geo != null) 18 { 19 if (geo.sourcePoint != null) 20 { 21 tip += 'source=' + parseFloat(geo.sourcePoint.x) + ',' + parseFloat(geo.sourcePoint.y) + '<br>'; 22 } 23 24 if (geo.targetPoint != null) 25 { 26 tip += 'target=' + parseFloat(geo.targetPoint.x) + ',' + parseFloat(geo.targetPoint.y) + '<br>'; 27 } 28 29 var state = this.view.getState(cell); 30 31 if (state != null && state.absolutePoints != null) 32 { 33 tip += 'abspoints(' + state.absolutePoints.length + ')='; 34 35 for (var i = 0; i < state.absolutePoints.length; i++) 36 { 37 tip += parseFloat(state.absolutePoints[i].x) + ',' + parseFloat(state.absolutePoints[i].y) + ';'; 38 } 39 40 tip += '<br>'; 41 42 if (geo.points != null) 43 { 44 tip += 'points(' + geo.points.length + ')='; 45 46 for (var i = 0; i < geo.points.length; i++) 47 { 48 tip += parseFloat(geo.points[i].x) + ',' + parseFloat(geo.points[i].y) + ';'; 49 } 50 } 51 } 52 else 53 { 54// tip += 'pos=' + this.view.formatUnitText(parseFloat(geo.x)) + ',' + this.view.formatUnitText(parseFloat(geo.y)) + '<br>' + 55// 'size=' + this.view.formatUnitText(parseFloat(geo.width)) + 'x' + this.view.formatUnitText(parseFloat(geo.height)); 56 tip += 'x/y=' + parseFloat(geo.x) + ',' + parseFloat(geo.y) + '<br>' + 57 'w/h=' + parseFloat(geo.width) + 'x' + parseFloat(geo.height); 58 59 if (state != null) 60 { 61 tip += '<br>pos=' + parseFloat(state.x) + ',' + parseFloat(state.y) + '<br>' + 62 'size=' + parseFloat(state.width) + 'x' + parseFloat(state.height); 63 } 64 } 65 66 if (cell.style != null) 67 { 68 tip += '<br>style=<div style="display:inline-block;vertical-align:bottom;white-space:nowrap;width:480px;overflow:hidden;text-overflow:ellipsis;">' + cell.style + '</span>'; 69 } 70 } 71 72 return tip; 73 }; 74 })(); 75} 76