sankey_mermaid
MermaidSankeyConfiguration ¶
Bases: Viewer
, WidgetBase
An interactive Widget for editing the Mermaid JS configuration for Sankey diagram.
See https://mermaid.js.org/schemas/config.schema.json See https://mermaid.js.org/config/schema-docs/config.html#definitions-group-sankeydiagramconfig
Example:
sankey_config = MermaidSankeyConfiguration()
You can use it as a reference value for the MermaidDiagram:
sankey_diagram = MermaidDiagram( ... object="sankey-beta\n\n%% source,target,value\n...", ... configuration=sankey_config, ... )
Source code in src/diffinsights_web/views/plots/sankey_mermaid.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
|
path_depth ¶
path_depth(path: str) -> int
Return number of components in UNIX path stored as string
Treat '.' as root, with depth 0. Treat any path without '/' as having depth 1; each subsequent '/' means new component.
PARAMETER | DESCRIPTION |
---|---|
path
|
relative UNIX pathname
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
depth of pathname |
Source code in src/diffinsights_web/views/plots/sankey_mermaid.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
path_depth_adj ¶
path_depth_adj(path: str) -> int
Like path_depth
, but consider depth of 'path' and 'path/*' to be the same
PARAMETER | DESCRIPTION |
---|---|
path
|
relative UNIX pathname
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
adjusted depth of pathname |
Source code in src/diffinsights_web/views/plots/sankey_mermaid.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
path_parent ¶
path_parent(path: str) -> str
Same as str(PurePath(path).parent), but without wrapping.
Assumes path
is POSIX pathname, with '/' as directory separators.
Source code in src/diffinsights_web/views/plots/sankey_mermaid.py
188 189 190 191 192 193 194 195 196 197 |
|
shorten_path_repl ¶
shorten_path_repl(path: str, max_len: int) -> str
Shorten path to max_len
components, suffix with '/**' it if it was shortened
Examples:
shorten_path_repl('A/B/C/D/E/F', 2) 'A/B/**' shorten_path_repl('A/B', 2) 'A/B'
PARAMETER | DESCRIPTION |
---|---|
path
|
relative UNIX pathname
TYPE:
|
max_len
|
maximum number of components
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
pathname with up to |
Source code in src/diffinsights_web/views/plots/sankey_mermaid.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|