<commit_before>//= require /node_modules/d3/d3.min.js
//= require /chartComponents/chartBars.js
//= require /chartComponents/chartBarScore.js
//= require /d3/chartColorProvider.js
//= require /chartComponents/chartLegend.js
//= require /chartComponents/chartSideLabels.js
//= require /chartComponents/chartHeader.js
//= require /chartComponents/common.js
//= require /d3/chartLabelUtil.js
//= require /aggregation/aggregationChartData.js
//= require_self

"use strict";

var OpenSpeedMonitor = OpenSpeedMonitor || {};
OpenSpeedMonitor.ChartModules = OpenSpeedMonitor.ChartModules || {};

OpenSpeedMonitor.ChartModules.Aggregation = (function (selector) {
    var svg = d3.select(selector);
    var chartBarsComponents = {};
    var chartLegendComponent = OpenSpeedMonitor.ChartComponents.ChartLegend();
    var chartBarScoreComponent = OpenSpeedMonitor.ChartComponents.ChartBarScore();
    var chartSideLabelsComponent = OpenSpeedMonitor.ChartComponents.ChartSideLabels();
    var chartHeaderComponent = OpenSpeedMonitor.ChartComponents.ChartHeader();
    // var data;
    var data = OpenSpeedMonitor.ChartModules.AggregationData(svg);
    var transitionDuration = OpenSpeedMonitor.ChartComponents.common.transitionDuration;

    chartLegendComponent.on("select", function (selectEvent) {
        toggleBarComponentHighlight(selectEvent.id, selectEvent.anySelected, selectEvent.selected);
    });

    chartLegendComponent.on("highlight", function (highlightEvent) {
        toggleBarComponentHighlight(highlightEvent.id, highlightEvent.anyHighlighted, highlightEvent.highlighted);
    });

    var resetData = function () {
        data.resetData();
    };

    var setData = function (inputData) {
         //data.setData(inputData);
        data = OpenSpeedMonitor.ChartModules.AggregationData;
        OpenSpeedMonitor.ChartModules.AggregationData.setData(inputData);
        chartHeaderComponent.setData(data.getDataForHeader());
        chartBarScoreComponent.setData(data.getDataForBarScore());
        chartLegendComponent.setData(data.getDataForLegend());
        chartSideLabelsComponent.setData(data.getDataForSideLabels());
        setDataForBars();
    };

    var setDataForBars = function () {
        var componentsToRender = {};
        data.getAllMeasurands().forEach(function (measurand) {
            if (!chartBarsComponents[measurand]) {
                var component = OpenSpeedMonitor.ChartComponents.ChartBars();
                component.on("click", function () {
                    chartLegendComponent.clickEntry({id: measurand});
                });
                chartBarsComponents[measurand] = component;
            }
            componentsToRender[measurand] = chartBarsComponents[measurand];
            componentsToRender[measurand].setData(data.getDataForBars(measurand));
        });
        chartBarsComponents = componentsToRender;
    };

    var render = function (isAggregationValueChange) {
        var shouldShowScore = data.hasLoadTimes();
        var componentMargin = OpenSpeedMonitor.ChartComponents.common.ComponentMargin;
        var headerHeight = OpenSpeedMonitor.ChartComponents.ChartHeader.Height + componentMargin;
        var barScorePosY = data.getChartBarsHeight() + componentMargin;<commit_msg>Undo changes in original Aggregation JS files so the original aggregation site still works.<commit_after>//= require /node_modules/d3/d3.min.js
//= require /chartComponents/chartBars.js
//= require /chartComponents/chartBarScore.js
//= require /d3/chartColorProvider.js
//= require /chartComponents/chartLegend.js
//= require /chartComponents/chartSideLabels.js
//= require /chartComponents/chartHeader.js
//= require /chartComponents/common.js
//= require /d3/chartLabelUtil.js
//= require /aggregation/aggregationChartData.js
//= require_self

"use strict";

var OpenSpeedMonitor = OpenSpeedMonitor || {};
OpenSpeedMonitor.ChartModules = OpenSpeedMonitor.ChartModules || {};

OpenSpeedMonitor.ChartModules.Aggregation = (function (selector) {
    var svg = d3.select(selector);
    var chartBarsComponents = {};
    var chartLegendComponent = OpenSpeedMonitor.ChartComponents.ChartLegend();
    var chartBarScoreComponent = OpenSpeedMonitor.ChartComponents.ChartBarScore();
    var chartSideLabelsComponent = OpenSpeedMonitor.ChartComponents.ChartSideLabels();
    var chartHeaderComponent = OpenSpeedMonitor.ChartComponents.ChartHeader();
    var data = OpenSpeedMonitor.ChartModules.AggregationData(svg);
    var transitionDuration = OpenSpeedMonitor.ChartComponents.common.transitionDuration;

    chartLegendComponent.on("select", function (selectEvent) {
        toggleBarComponentHighlight(selectEvent.id, selectEvent.anySelected, selectEvent.selected);
    });

    chartLegendComponent.on("highlight", function (highlightEvent) {
        toggleBarComponentHighlight(highlightEvent.id, highlightEvent.anyHighlighted, highlightEvent.highlighted);
    });

    var resetData = function () {
        data.resetData();
    };

    var setData = function (inputData) {
        data.setData(inputData);
        chartHeaderComponent.setData(data.getDataForHeader());
        chartBarScoreComponent.setData(data.getDataForBarScore());
        chartLegendComponent.setData(data.getDataForLegend());
        chartSideLabelsComponent.setData(data.getDataForSideLabels());
        setDataForBars();
    };

    var setDataForBars = function () {
        var componentsToRender = {};
        data.getAllMeasurands().forEach(function (measurand) {
            if (!chartBarsComponents[measurand]) {
                var component = OpenSpeedMonitor.ChartComponents.ChartBars();
                component.on("click", function () {
                    chartLegendComponent.clickEntry({id: measurand});
                });
                chartBarsComponents[measurand] = component;
            }
            componentsToRender[measurand] = chartBarsComponents[measurand];
            componentsToRender[measurand].setData(data.getDataForBars(measurand));
        });
        chartBarsComponents = componentsToRender;
    };

    var render = function (isAggregationValueChange) {
        var shouldShowScore = data.hasLoadTimes();
        var componentMargin = OpenSpeedMonitor.ChartComponents.common.ComponentMargin;
        var headerHeight = OpenSpeedMonitor.ChartComponents.ChartHeader.Height + componentMargin;
        var barScorePosY = data.getChartBarsHeight() + componentMargin;
{'fraction_non_alphanumeric': 0.10316967060285892, 'fraction_numerical': 0.0015537600994406464, 'mean_word_length': 3.810911808669656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '5450087', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1683, 'n_words': 261}