This modules add the Mermaid.js library to Odoo. Mermaid is a simple markdown-like script language for generating charts from text via JavaScript. It is used to create diagrams and flowcharts.
Create a Text field in a model and add the widget "mermaid" to the field.
mermaid_diagram = fields.Text('Mermaid Diagram', compute='_get_mermaid_diagram')
def _get_mermaid_diagram(self):
for rec in self:
rec.mermaid_diagram = """
graph LR;
A-->B;
A-->C;
B-->D;
C-->D;
"""
<field name="mermaid_diagram" widget="mermaid"/>
To update the initialization configuration of the mermaid library, you can add it to the options attribute of the field.
<field name="mermaid_diagram" widget="mermaid" options="{'theme': 'dark'}"/>
Available options: 'mermaid_scroll_x', 'division_ration'
Can be used to have a horizontal scroll bar for the diagram.
<group>
<field colspan="2" nolabel="1" name="mermaid_diagram" widget="mermaid" options="{'mermaid_scroll_x': True, 'division_ration': 1.5}"/>
</group>
To update the library, you can download the latest minified version and replace the file in the module.
Contributing:
If you're interested in contributing, please visit the GitHub repository @ github.com/VictorHachard/odoo-modules
Issue:
If you encounter any issues, please visit the GitHub repository issue section @ github.com/VictorHachard/odoo-modules/issues
Please log in to comment on this module