public drawLegend()

in ui/src/Map.tsx [219:247]


    public drawLegend(xOffset: number, yOffset: number) {

        const robotStatuses: string[] = Object.keys(RobotStatus).map((key: string) => {
            return RobotStatus[key]
        }).filter(value => typeof value === 'string') as string[];

        const legend = this.svg.selectAll("g.legend")
            .data(robotStatuses)
            .enter().append("svg:g")
            .attr("class", "legend")
            .attr("transform", (d: string, i: number) => {
                return "translate(" + xOffset + "," + (i * 20 + yOffset) + ")";
            });

        legend.append("svg:circle")
            .attr("class", "legend")
            .attr("r", 3.5)
            .style("fill", (status: any) => this.getRobotColor(status));

        legend.append("svg:text")
            .attr("class", "legend")
            .attr("x", 12)
            .attr("dy", ".31em")
            .text((status: string) => {
                return status;
            });

        return legend;
    }