import { Component } from "react";

export class Donut extends Component {
    render() {
        let teamColors = undefined
        let tmp = []
        this.props.data.context.forEach(element => {
            tmp.push(element.team === this.props.data.array[0].team ? "#3b3bd4" : "#d43b3b")
        });
        if (tmp !== []) {
            teamColors = tmp
        }

        let chart = DonutChart(this.props.data.context, {
            name: d => d.name,
            value: d => d.score,
            width,
            height: 400,
            colors: teamColors
        })

        return (
            {chart}
        )
    }
}