Skip to content

Commit

Permalink
merge: Fix complexity badge display
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuestengecko committed Feb 1, 2023
2 parents 5cb9639 + 04fb0bd commit be1fae3
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 8 deletions.
4 changes: 2 additions & 2 deletions capellambse/extensions/metrics/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def draw_summary_badge(
font_size=3.2,
)
return (
f'<SVG xmlns="http://www.w3.org/2000/svg"'
f'<svg xmlns="http://www.w3.org/2000/svg"'
f' width="{scale*134}" height="{scale*30}" viewBox="0 0 134 30">'
f"{text}</SVG>"
f"{text}</svg>"
)
60 changes: 54 additions & 6 deletions docs/source/examples/11 Complexity Assessment.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Complexity Assessment\n",
"\n",
"This notebook demonstrates how to use / view the model complexity badge for a Capella model."
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand All @@ -12,7 +21,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand All @@ -25,12 +34,52 @@
},
{
"data": {
"image/svg+xml": "<SVG xmlns=\"http://www.w3.org/2000/svg\" width=\"536.0\" height=\"120.0\" viewBox=\"0 0 134 30\"><g font-family=\"sans-serif\" font-size=\"3.2\">\n<rect fill=\"#FFF\" stroke=\"#333\" stroke-width=\"0.2\" x=\"1\" y=\"0\" width=\"132\" height=\"30\" />\n<rect fill=\"#FFF\" stroke=\"#333\" stroke-width=\"0.2\" x=\"23.8\" y=\"1.4\" width=\"108\" height=\"22\" />\n<g stroke=\"#555\" stroke-width=\".3\"><path fill=\"#ffdd87\" d=\"M3 5.5 h1.9 V7.4 h-2 z\"/><path fill=\"#a5c2e6\" d=\"M3.8 6.4 h2 v1.8 h-2 z\"/></g><text x=\"7\" y=\"6.4\">180</text>\n<text x=\"7\" y=\"9.4\">objects</text>\n<g font-size=\"3.2\">\n<rect fill=\"#ffdd87\" stroke=\"#333\" stroke-width=\"0\" x=\"24.2\" y=\"3.4\" width=\"31.77777777777778\" height=\"8\" />\n<text x=\"25.2\" y=\"8.4\">31%</text>\n<rect fill=\"#91cc84\" stroke=\"#333\" stroke-width=\"0\" x=\"55.977777777777774\" y=\"3.4\" width=\"16.177777777777777\" height=\"8\" />\n<text x=\"56.977777777777774\" y=\"8.4\">16%</text>\n<rect fill=\"#a5c2e6\" stroke=\"#333\" stroke-width=\"0\" x=\"72.15555555555555\" y=\"3.4\" width=\"28.31111111111111\" height=\"8\" />\n<text x=\"73.15555555555555\" y=\"8.4\">27%</text>\n<rect fill=\"#f89f9f\" stroke=\"#333\" stroke-width=\"0\" x=\"100.46666666666667\" y=\"3.4\" width=\"27.733333333333334\" height=\"8\" />\n<text x=\"101.46666666666667\" y=\"8.4\">27%</text>\n</g>\n<g stroke=\"#555\" stroke-width=\".2\"><path fill=\"#FFF\" d=\"M2.5 15.200000000000001 h3.6 v3.1 H2.5 z\"/><path fill=\"#a5c2e6\" d=\"M3 15.8 h1v.7 H3z m.8 1.2h1v.7h-1z m.9-1.1h.8v.6h-.8z\"/><path fill=\"none\" d=\"M3.9 16.2 h.8 m-1.3.3.4.8 m1 .1.4-.9\"/></g><text x=\"7\" y=\"16.4\">18</text>\n<text x=\"7\" y=\"19.4\">diagrams</text>\n<g font-size=\"3.2\">\n<rect fill=\"#ffdd87\" stroke=\"#333\" stroke-width=\"0\" x=\"24.2\" y=\"13.4\" width=\"40.44444444444444\" height=\"8\" />\n<text x=\"25.2\" y=\"18.4\">39%</text>\n<rect fill=\"#91cc84\" stroke=\"#333\" stroke-width=\"0\" x=\"64.64444444444445\" y=\"13.4\" width=\"23.11111111111111\" height=\"8\" />\n<text x=\"65.64444444444445\" y=\"18.4\">22%</text>\n<rect fill=\"#a5c2e6\" stroke=\"#333\" stroke-width=\"0\" x=\"87.75555555555556\" y=\"13.4\" width=\"28.88888888888889\" height=\"8\" />\n<text x=\"88.75555555555556\" y=\"18.4\">28%</text>\n<rect fill=\"#f89f9f\" stroke=\"#333\" stroke-width=\"0\" x=\"116.64444444444445\" y=\"13.4\" width=\"11.555555555555555\" height=\"8\" />\n<text x=\"117.64444444444445\" y=\"18.4\">11%</text>\n</g>\n<g font-size=\"2.8\" fill=\"#555\">\n<rect fill=\"#ffdd87\" stroke=\"#333\" stroke-width=\"0\" x=\"3\" y=\"25\" width=\"5\" height=\"3\" />\n<text x=\"9\" y=\"27.6\">Operational Analysis</text>\n<rect fill=\"#91cc84\" stroke=\"#333\" stroke-width=\"0\" x=\"37\" y=\"25\" width=\"5\" height=\"3\" />\n<text x=\"43\" y=\"27.6\">System Analysis</text>\n<rect fill=\"#a5c2e6\" stroke=\"#333\" stroke-width=\"0\" x=\"67\" y=\"25\" width=\"5\" height=\"3\" />\n<text x=\"73\" y=\"27.6\">Logical Architecture</text>\n<rect fill=\"#f89f9f\" stroke=\"#333\" stroke-width=\"0\" x=\"100\" y=\"25\" width=\"5\" height=\"3\" />\n<text x=\"106\" y=\"27.6\">Physical Architecture</text>\n</g>\n</g>\n</SVG>",
"image/svg+xml": [
"<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"536.0\" height=\"120.0\" viewBox=\"0 0 134 30\"><g font-family=\"sans-serif\" font-size=\"3.2\">\n",
"<rect fill=\"#FFF\" stroke=\"#333\" stroke-width=\"0.2\" x=\"1\" y=\"0\" width=\"132\" height=\"30\"/>\n",
"<rect fill=\"#FFF\" stroke=\"#333\" stroke-width=\"0.2\" x=\"23.8\" y=\"1.4\" width=\"108\" height=\"22\"/>\n",
"<g stroke=\"#555\" stroke-width=\".3\"><path fill=\"#ffdd87\" d=\"M3 5.5 h1.9 V7.4 h-2 z\"/><path fill=\"#a5c2e6\" d=\"M3.8 6.4 h2 v1.8 h-2 z\"/></g><text x=\"7\" y=\"6.4\">180</text>\n",
"<text x=\"7\" y=\"9.4\">objects</text>\n",
"<g font-size=\"3.2\">\n",
"<rect fill=\"#ffdd87\" stroke=\"#333\" stroke-width=\"0\" x=\"24.2\" y=\"3.4\" width=\"31.77777777777778\" height=\"8\"/>\n",
"<text x=\"25.2\" y=\"8.4\">31%</text>\n",
"<rect fill=\"#91cc84\" stroke=\"#333\" stroke-width=\"0\" x=\"55.977777777777774\" y=\"3.4\" width=\"16.177777777777777\" height=\"8\"/>\n",
"<text x=\"56.977777777777774\" y=\"8.4\">16%</text>\n",
"<rect fill=\"#a5c2e6\" stroke=\"#333\" stroke-width=\"0\" x=\"72.15555555555555\" y=\"3.4\" width=\"28.31111111111111\" height=\"8\"/>\n",
"<text x=\"73.15555555555555\" y=\"8.4\">27%</text>\n",
"<rect fill=\"#f89f9f\" stroke=\"#333\" stroke-width=\"0\" x=\"100.46666666666667\" y=\"3.4\" width=\"27.733333333333334\" height=\"8\"/>\n",
"<text x=\"101.46666666666667\" y=\"8.4\">27%</text>\n",
"</g>\n",
"<g stroke=\"#555\" stroke-width=\".2\"><path fill=\"#FFF\" d=\"M2.5 15.200000000000001 h3.6 v3.1 H2.5 z\"/><path fill=\"#a5c2e6\" d=\"M3 15.8 h1v.7 H3z m.8 1.2h1v.7h-1z m.9-1.1h.8v.6h-.8z\"/><path fill=\"none\" d=\"M3.9 16.2 h.8 m-1.3.3.4.8 m1 .1.4-.9\"/></g><text x=\"7\" y=\"16.4\">18</text>\n",
"<text x=\"7\" y=\"19.4\">diagrams</text>\n",
"<g font-size=\"3.2\">\n",
"<rect fill=\"#ffdd87\" stroke=\"#333\" stroke-width=\"0\" x=\"24.2\" y=\"13.4\" width=\"40.44444444444444\" height=\"8\"/>\n",
"<text x=\"25.2\" y=\"18.4\">39%</text>\n",
"<rect fill=\"#91cc84\" stroke=\"#333\" stroke-width=\"0\" x=\"64.64444444444445\" y=\"13.4\" width=\"23.11111111111111\" height=\"8\"/>\n",
"<text x=\"65.64444444444445\" y=\"18.4\">22%</text>\n",
"<rect fill=\"#a5c2e6\" stroke=\"#333\" stroke-width=\"0\" x=\"87.75555555555556\" y=\"13.4\" width=\"28.88888888888889\" height=\"8\"/>\n",
"<text x=\"88.75555555555556\" y=\"18.4\">28%</text>\n",
"<rect fill=\"#f89f9f\" stroke=\"#333\" stroke-width=\"0\" x=\"116.64444444444445\" y=\"13.4\" width=\"11.555555555555555\" height=\"8\"/>\n",
"<text x=\"117.64444444444445\" y=\"18.4\">11%</text>\n",
"</g>\n",
"<g font-size=\"2.8\" fill=\"#555\">\n",
"<rect fill=\"#ffdd87\" stroke=\"#333\" stroke-width=\"0\" x=\"3\" y=\"25\" width=\"5\" height=\"3\"/>\n",
"<text x=\"9\" y=\"27.6\">Operational Analysis</text>\n",
"<rect fill=\"#91cc84\" stroke=\"#333\" stroke-width=\"0\" x=\"37\" y=\"25\" width=\"5\" height=\"3\"/>\n",
"<text x=\"43\" y=\"27.6\">System Analysis</text>\n",
"<rect fill=\"#a5c2e6\" stroke=\"#333\" stroke-width=\"0\" x=\"67\" y=\"25\" width=\"5\" height=\"3\"/>\n",
"<text x=\"73\" y=\"27.6\">Logical Architecture</text>\n",
"<rect fill=\"#f89f9f\" stroke=\"#333\" stroke-width=\"0\" x=\"100\" y=\"25\" width=\"5\" height=\"3\"/>\n",
"<text x=\"106\" y=\"27.6\">Physical Architecture</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 3,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -43,7 +92,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 ('.venv': venv)",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -57,9 +106,8 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.10.9"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "f5c9192943a88c565de58e6fd7c534c9de794a35889e45ad6809ab92c821a96c"
Expand Down

0 comments on commit be1fae3

Please sign in to comment.