File tree Expand file tree Collapse file tree 4 files changed +67
-0
lines changed
src/ui/src/components/visualizer Expand file tree Collapse file tree 4 files changed +67
-0
lines changed Original file line number Diff line number Diff line change @@ -912,6 +912,43 @@ export declare interface LegendConfig {
912912 * If set, rename the "outputs" label to this string.
913913 */
914914 renameOutputsTo ?: string ;
915+
916+ /**
917+ * If set, add custom legend items to the legend panel.
918+ *
919+ * Each item has a color block and a label.
920+ */
921+ customLegendItems ?: CustomLegendItem [ ] ;
922+ }
923+
924+ /** A custom legend item. */
925+ export declare interface CustomLegendItem {
926+ label : string ;
927+
928+ /**
929+ * The background color of the color block. Default is transparent.
930+ */
931+ backgroundColor ?: string ;
932+
933+ /**
934+ * The border width of the color block. Default is 0.
935+ */
936+ borderWidth ?: number ;
937+
938+ /**
939+ * The border color of the color block. Default is transparent.
940+ */
941+ borderColor ?: string ;
942+
943+ /**
944+ * The border style of the color block. Default is solid.
945+ */
946+ borderStyle ?: string ;
947+
948+ /**
949+ * The border radius of the color block. Default is 0.
950+ */
951+ borderRadius ?: number ;
915952}
916953
917954/** Config for "View on node" menu. */
Original file line number Diff line number Diff line change 7373 </ tr >
7474 }
7575 </ ng-container >
76+ <!-- Custom legend items -->
77+ @for (item of customLegendItems; track item) {
78+ < tr >
79+ < td >
80+ < div class ="key custom-key "
81+ [style.background-color] ="item.backgroundColor ?? 'transparent' "
82+ [style.border-width.px] ="item.borderWidth ?? 0 "
83+ [style.border-color] ="item.borderColor ?? 'transparent' "
84+ [style.border-style] ="item.borderStyle ?? 'solid' "
85+ [style.border-radius.px] ="item.borderRadius ?? 0 ">
86+ </ div >
87+ </ td >
88+ < td >
89+ < div class ="label ">
90+ {{item.label}}
91+ </ div >
92+ </ td >
93+ </ tr >
94+ }
7695 @if (!hideShortcuts) {
7796 @if (showDivider()) {
7897 < tr > < td colspan ="2 "> < div class ="divider "> </ div > </ td > </ tr >
Original file line number Diff line number Diff line change @@ -94,6 +94,12 @@ $block_height: 14px;
9494 border : 2px solid var (--me-outgoing-edge-color );
9595 }
9696
97+ .custom-key {
98+ width : $block_height ;
99+ height : $block_height ;
100+ margin-left : auto ;
101+ }
102+
97103 .shortcut {
98104 color : var (--me-on-surface-variant-color );
99105 font-size : 10px ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import {
2929import { MatIconModule } from '@angular/material/icon' ;
3030
3131import { AppService } from './app_service' ;
32+ import { CustomLegendItem } from './common/types' ;
3233
3334/**
3435 * The panel that shows the lengends.
@@ -148,4 +149,8 @@ export class LegendsPanel {
148149 get hideShortcuts ( ) : boolean {
149150 return this . appService . config ( ) ?. legendConfig ?. hideShortcuts ?? false ;
150151 }
152+
153+ get customLegendItems ( ) : CustomLegendItem [ ] {
154+ return this . appService . config ( ) ?. legendConfig ?. customLegendItems ?? [ ] ;
155+ }
151156}
You can’t perform that action at this time.
0 commit comments