SO Question
https://stackoverflow.com/questions/65564743/jointjs-baseline-shift
by Roman Bruckner
HTML
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jointjs/3.2.0/joint.css" />
</head>
<body>
<!-- content -->
<div id="paper"></div>
<!-- dependencies -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.4.0/backbone.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jointjs/3.2.0/joint.js"></script>
</body>
</html>
JavaScript
const graph = new joint.dia.Graph({}, { cellNamespace: joint.shapes });
const paper = new joint.dia.Paper({
el: document.getElementById('paper'),
width: 800,
height: 800,
model: graph,
cellViewNamespace: joint.shapes
});
const el = new joint.shapes.standard.Rectangle({
size: { width: 100, height: 100 },
position: { x: 100, y: 100 },
attrs: {
label: {
text: 'Pn = xxx',
annotations: [{ start: 1, end: 2, attrs: { 'baseline-shift': 'sub' }}]
}
}
});
el.addTo(graph);