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
}