Skip to content

Commit ae84624

Browse files
feat: add color legend to both SNIK and HITO: resolve #455
1 parent f5fa5ee commit ae84624

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

js/config/config.dist.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ Copy to js/config/config.ts after checkout and adapt to your preferences.
33
*/
44

55
import type { LogLevelDesc } from "loglevel";
6-
import snikConf from "./config.snik";
7-
//import hitoConf from "./config.hito";
6+
import ontologyConf from "./config.snik";
7+
//import ontologyConf from "./config.hito";
88

99
export const config = {
1010
nodeSize: 39,
@@ -24,7 +24,7 @@ export const config = {
2424
},
2525
},
2626
// Change this when you want to use a different ontology. Refer to ./config.snik.ts and ./config.hito.ts for examples.
27-
ontology: snikConf,
27+
ontology: ontologyConf,
2828
multiview: {
2929
initialTabs: 1,
3030
warnOnSessionLoad: true,

js/config/config.hito.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ function getMapKeyIncludedInString<V>(search: string, map: Map<string, V>): stri
3131
return undefined;
3232
}
3333

34+
const colorLegend = () => Array.from(colorMap.entries()).reduce((ac, [n, c]) => ac + ` <span style='color:${c}'>&#9632;</span> ${n}`, "");
35+
3436
export default {
3537
id: "hito",
3638
name: "HITO",
37-
legend: "<span>&#9632; Citation</span> <span>&#9650; Classification</span> <span>&#9679; Catalogue</span>",
39+
legend: "<span>&#9632; Citation</span> <span>&#9650; Classification</span> <span>&#9679; Catalogue</span> " + colorLegend(),
3840
title: "Health IT Ontology Graph",
3941
initialView: hitoView,
4042
snik: null,

js/config/config.snik.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ const colorMap = new Map([
2222
["bb2", "rgb(0, 255, 255)"],
2323
]);
2424

25+
const colorLegend = () => Array.from(colorMap.entries()).reduce((ac, [n, c]) => ac + ` <span style='color:${c}'>&#9632;</span> ${n}`, "");
26+
2527
export default {
2628
id: "snik",
2729
name: "SNIK",
28-
legend: "<span>&#9632; Entity Type</span> <span>&#9650; Role</span> <span>&#9679; Function</span> <span>* has Instances</span>",
30+
legend: "<span>&#9632; Entity Type</span> <span>&#9650; Role</span> <span>&#9679; Function</span> <span>* has Instances</span>" + colorLegend(),
2931
title: "SNIK Ontology Graph",
3032
initialView: snikView,
3133
snik: {

0 commit comments

Comments
 (0)