No value legends in Scheduling Gantt chart widget of Workshop

I am using a Scheduling Gantt chart widget in a Workshop dashboard and using the function-backed color config option linked to a function that outputs a map of a schedule containing a conditional property and the hex color String. However, the legend section on the bottom right of the Gantt chart (shown in figure) is not able to recognize the property with which each color connects and instead shows a “No Value” message. Is it possible to configure the legend names using a property or any other way?

P.S. I see that using the Conditional Coloring option allows me to configure the color and name at the same go but I have about 20+ different colors to configure according to a property of the Object Type and multiple similar Gantt charts throughout my Workshop application that all use the same coloring configuration. So, I was hoping there is an easier way to do this.

Hey!

Hopping it’s not too late for your feature.

Yep it’s possible to configure the legend names in your function-backed. If you look at the details of the function used to set the color, you can see that you have the possibility to return the type: FunctionMap<SomeObjectType, Struct<color: string, name: string>>.

It allows you to set the name displayed for each color you define.

And then, it appears in your legend:

Here is an example of function-backed you can use:

from dataclasses import dataclass
from functions.api import function
from ontology_sdk.ontology.objects import Test
from ontology_sdk.ontology.object_sets import TestObjectSet

# COLOR PALETTE
COLOR_GREEN = "#29A634"
COLOR_ORANGE = "#D99E0B"
COLOR_RED = "#D13913"
COLOR_BLUE = "#2965CC"
COLOR_GREY = "#8A9BA8"


@dataclass
class PuckColor:
    color: str
    name: str


@function
def get_puck_colors(objects: TestObjectSet) -> dict[Test, PuckColor]:
    result: dict[Test, PuckColor] = {}

    for obj in objects.iterate():
        status = obj.status

        if status is None:
            result[obj] = PuckColor(color=COLOR_GREY, name="Unknown")
            continue

        status_lower = status.strip().lower()

        if status_lower in {"backlog", "ready"}:
            result[obj] = PuckColor(color=COLOR_BLUE, name="Backlog / Ready")
        elif status_lower in {"in progress", "waiting for review"}:
            result[obj] = PuckColor(color=COLOR_ORANGE, name="In Progress")
        elif status_lower == "blocked":
            result[obj] = PuckColor(color=COLOR_RED, name="Blocked")
        elif status_lower == "completed":
            result[obj] = PuckColor(color=COLOR_GREEN, name="Completed")
        else:
            result[obj] = PuckColor(color=COLOR_GREY, name="Unknown")

    return result

I hope you find this helpful. Feel free to ask if you have any question.

Nathan :slight_smile:

Hey, Donat!

Thank you so much for the solution! I do not know why I didn’t just think to check the details of the field but scoured through endless pages of documents.