javascriptjgraphmxgraph

mxGraph diagrameditor change label position


I'm editing the digrameditor in here! for my own project and I need to position the labels of the vertices to bottom. I tried by adding follow changes but seems it's not the case.

....
// Program starts here. The document.onLoad executes the
// mxApplication constructor with a given configuration.
// In the config file, the mxEditor.onInit method is
// overridden to invoke this global function as the
// last step in the editor constructor.
function onInit(editor)
{
     // Set align of the labels to bottom
     mxConstants.STYLE_VERTICAL_LABEL_POSITION = mxConstants.ALIGN_BOTTOM;
....

Any help?

Thanks.


Solution

  • After some more research I found out that it can be done using the diagrameditor.xml file locates in the config directory. You can find the mxStylesheet defined as stylesheet in line 123 and in their you can find the defaultVertex style. Change the verticalAlign attribute to bottom as follows.

    ...
    <add as="align" value="left"/>
    <add as="verticalAlign" value="bottom"/>
    <add as="shadow" value="0"/>
    ....