Hello,
after looking at the custom node example I could create a very basic custom node with a second text property.
I brought the text to the bottom of the node. But how can I center the text in the node. My problem is that I dont know to get the real width of the text. And the x coordinate depends on the length and width of the text.
With the normal text i could simply use setTextAlignment method and no need to worry.
Here is what I have so far ...
OrgChartNode.prototype =
{
// draw logic
updateCanvasElements: function (node)
{
MindFusion.AbstractionLayer.callBaseMethod(OrgChartNode, this, 'updateCanvasElements');
var titleFont = Font.copy(this.getEffectiveFont());
titleFont.size = titleFont.size - 0.3;
var titleLabel = new Text(this.getTitle(), new Rect(
this.bounds.x,
this.bounds.y + this.bounds.height - titleFont.size - 1,
this.bounds.width,
titleFont.size)
);
titleLabel.font = titleFont;
if ( this.title !== "")
console.log(titleLabel);
this.graphicsContainer.content.push(titleLabel);
},
getTitle: function ()
{
return this.title;
},
setTitle: function (value)
{
if (this.title !== value)
{
this.title = value;
}
}
};
Lastly I'd like to change the measure unit from mm to px for everything in the framework: fontsizes, bounds, grid, etc
diagram.getMeasureUnit() returns 6.
In the meantime, thank you so much for your attention and participation.