mxGraph控制vertex的label資訊顯示内容,此例為正常顯示或為空
// 展示cell的label
graph.getLabel = function(cell)
{
var label = (this.labelsVisible) ? this.convertValueToString(cell) : '';
var geometry = this.model.getGeometry(cell);
if (label != null && this.model.isVertex(cell))
{
if(cell.children != null && cell.children.length>0){ //如果是父級vertex則周遊子元素,分别執行getLabel方法
for ( var i = 0; i < cell.children.length; i++) {
graph.getLabel(cell.children[i]);
continue;
}
}
var style = this.getCellStyle(cell); //底層vertex開始執行處,隻有接口圖示的label的fontstyle為2,此時就傳回空
var fontStyle = style[mxConstants.STYLE_FONTSTYLE];
if (2==fontStyle)
{
return '';
}
}
return label; //底層vertex但不是接口圖示,此時正常顯示label
}