I need each type of node in a Memgraph Lab graph to have its own specific SVG image. For instance, nodes labeled as 'person' should display 'image1.png', and those labeled as 'place' should use 'image2.png'. I know that Memgraph Lab typically supports a single SVG for all nodes, but I'm looking to implement this more dynamic approach.
Do I need to add image URL as property value to each node? I hope not, since that is exactly that I want to avoid.
For each label you can use the Map structure and have label to image mapping in one place:
// A map structure to hold the key (label) -> value (url)
Define(IMAGE_BY_LABEL, AsMap(
"Country", "https://country.svg",
"Entity", "https://entity.svg",
"LabelA:LabelB", "https://labela-labelb.svg"
))
Define(DEFAULT_IMAGE_URL, "")
// For all the nodes, get the image from the map structure
@NodeStyle {
image-url: Get(IMAGE_BY_LABEL, Join(Labels(node), ":"), DEFAULT_IMAGE_URL)
}