export function update()

in src/legend/legendData.ts [33:65]


export function update(legendData: LegendData, legendObject: powerbi.DataViewObject): void {
    if (legendObject[legendProps.show] == null) {
        legendObject[legendProps.show] = true;
    }

    if (legendObject[legendProps.show] === false) {
        legendData.dataPoints = [];
    }

    if (legendObject[legendProps.show] === true && legendObject[legendProps.position] == null) {
        legendObject[legendProps.position] = position.top;
    }

    if (legendObject[legendProps.fontSize] !== undefined) {
        legendData.fontSize = <number>legendObject[legendProps.fontSize];
    }

    if (legendObject[legendProps.labelColor] !== undefined) {

        let fillColor = <powerbi.Fill>legendObject[legendProps.labelColor];

        if (fillColor != null) {
            legendData.labelColor = fillColor.solid.color;
        }
    }

    if (legendObject[legendProps.showTitle] === false) {
        legendData.title = "";
    }
    else if (legendObject[legendProps.titleText] !== undefined) {
        legendData.title = <string>legendObject[legendProps.titleText];
    }
}