<commit_before>package com.projects.view;

import com.projects.Main;
import javafx.fxml.FXML;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.XYChart;

import java.util.List;

/**
 * Created by Dan on 7/31/2015.
 */
public class ProductionStatisticsController
{
    @FXML
    private LineChart<String, Float> priceForDemandChart;

    @FXML
    private LineChart<String, Float> emissionsForDemandChart;

    private XYChart.Series<String, Float> priceForDemandSeries;

    private XYChart.Series<String, Float> emissionsForDemandSeries;

    private Main main;

    @FXML
    private void initialize()
    {
        priceForDemandSeries= new XYChart.Series<>();
        priceForDemandSeries.setName("Price");
        priceForDemandChart.getData().add(priceForDemandSeries);

        emissionsForDemandSeries = new XYChart.Series<>();
        emissionsForDemandSeries.setName("Emissions");
        emissionsForDemandChart.getData().add(emissionsForDemandSeries);
    }

    public void setPriceForDemandData(List<Float> prices)
    {
        priceForDemandSeries.getData().clear();

        for (int demand = 0; demand < prices.size(); demand+=30)
        {
            priceForDemandSeries.getData().add(new XYChart.Data<>(String.valueOf(demand), prices.get(demand)));
        }
    }

    public void setEmissionsForDemandData(List<Float> emissions)
    {
        emissionsForDemandSeries.getData().clear();

        for (int demand = 0; demand < emissions.size(); demand+=30)
        {
            emissionsForDemandSeries.getData().add(new XYChart.Data<>(String.valueOf(demand), emissions.get(demand)));
        }
    }

    public void setMain(Main main)
    {<commit_msg>Reduced the performance hit caused by the production statistics pane. The level of granularity in which the data was being presented was causing the application to lag. The data is now charted at less frequent intervals.<commit_after>package com.projects.view;

import com.projects.Main;
import javafx.fxml.FXML;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.XYChart;

import java.util.List;

/**
 * Created by Dan on 7/31/2015.
 */
public class ProductionStatisticsController
{
    @FXML
    private LineChart<String, Float> priceForDemandChart;

    @FXML
    private LineChart<String, Float> emissionsForDemandChart;

    private XYChart.Series<String, Float> priceForDemandSeries;

    private XYChart.Series<String, Float> emissionsForDemandSeries;

    private Main main;
    private int length = 100;

    @FXML
    private void initialize()
    {
        priceForDemandSeries= new XYChart.Series<>();
        priceForDemandSeries.setName("Price");
        priceForDemandChart.getData().add(priceForDemandSeries);

        emissionsForDemandSeries = new XYChart.Series<>();
        emissionsForDemandSeries.setName("Emissions");
        emissionsForDemandChart.getData().add(emissionsForDemandSeries);
    }

    public void setPriceForDemandData(List<Float> prices)
    {
        priceForDemandSeries.getData().clear();
        int increments = prices.size() / length;

        for (int index = 0; index < length; ++index)
        {
            int demand = index * increments;
            if (demand > prices.size())
                demand = prices.size() - 1;

            priceForDemandSeries.getData().add(new XYChart.Data<>(String.valueOf(demand), prices.get(demand)));
        }
    }

    public void setEmissionsForDemandData(List<Float> emissions)
    {
        emissionsForDemandSeries.getData().clear();
        int increments = emissions.size() / length;

        for (int  index = 0; index < length; ++index)
        {
            int demand = index * increments;
            if (demand > emissions.size())
                demand = emissions.size() - 1;

            emissionsForDemandSeries.getData().add(new XYChart.Data<>(String.valueOf(demand), emissions.get(demand)));
        }
    }

    public void setMain(Main main)
    {
{'fraction_non_alphanumeric': 0.10732323232323232, 'fraction_numerical': 0.006818181818181818, 'mean_word_length': 3.130344108446298, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2139526', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1113, 'n_words': 245}