package hozza.network.views.frontend.components;

import com.storedobject.chart.*;
import hozza.network.models.twitch.result.IStreamerCountry;
import hozza.network.models.twitch.result.IWatchingDayOfWeek;

import java.util.List;

public class StreamerCountryChart extends SOChart implements IChartGenerable
{
    final List<IStreamerCountry> service;
    public StreamerCountryChart(List<IStreamerCountry> service)
    {
        this.service = service;
        this.generateChart();
    }

    public void generateChart()
    {
        CategoryData names = new CategoryData();
        Data values = new Data();

        this.service.forEach(e -> {
            names.add(e.getCountry());
            values.add(e.getCount());
        });

        PieChart chart = new PieChart(names, values);
        this.add(chart);
        this.add(new Title("Streamers of country"));
    }
}
