Skip to content

Datadesciption: Let datadescription place units at values #66

@FlorianFehring

Description

@FlorianFehring

Datadescription descripes data with colors. But values often have units (e.g. km, mm, cm, ...) Datadescription should be expanded to add the units at the displayed data.

Example code:
function appendUnits(evt) {
let units = JSON.parse(localStorage.getItem("attributeUnits"));
const repeatedSets = evt.detail.repeateds;
repeatedSets.forEach(set => {
for (let i = 0; i < set.children.length; i++) {
const child = set.children[i];
const bpElements = child.querySelectorAll("swac-bp[attrname]");

        bpElements.forEach(bp => {
            const attr = bp.getAttribute("attrname");
            if (units[attr] !== null && units[attr] !== undefined) {
                const span = child.querySelector("span");
                if (span) {
                    span.textContent += " " + units[attr]
                }
            }
        });
    }
});

}

But code should not modify the displayed value itself but have to add the unit after the values bindpoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions