<commit_before><?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\grid\GridView;
use reportmanager\models\ClassSearch;

use bburim\flot\Chart as Chart;
use bburim\flot\Plugin as Plugin;
use yii\web\JsExpression;

/* @var $this yii\web\View */
/* @var $model reportmanager\models\Reports */
/* @var $dataProvider yii\data\ActiveDataProvider */


if(count($model->columns) > 0):

    $models = $dataProvider->models;
    if(count($models) <= 0) return;

    $columns = $model->columns;
    if(count($columns) <= 0) return;

    $x_column = NULL;
    foreach($columns as $col) {
        if($col->alias === $model->graph_x) {
            $x_column = $col;
            break;
        }
    }

    foreach($columns as $col) {
        if($col->alias === $x_column->alias) {
            continue;
        }
        $plot_data[] = [
            'label' => $col->label,
            'data' => array_map(function($item) use($col, $x_column){
                $alias_y = $col->alias;
                if(is_object($x_column)) {
                    $alias_x = $x_column->alias;
                    return [$x_column->functionObj->prepareGraph($item->$alias_x),$col->functionObj->prepareGraph($item->$alias_y)];
                } else {
                    return [$col->functionObj->prepareGraph($item->$alias_y)];
                }
            },$models),
            'lines'  => ['show' => true],
            'points' => ['show' => true],
        ];

    }
?>
<pre>
    <?php //var_dump($plot_data) ?>
</pre>

<div class="reports-view-graph">

    <?= Chart::widget([
        'data' => $plot_data,<commit_msg>comment is removed<commit_after><?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\grid\GridView;
use reportmanager\models\ClassSearch;

use bburim\flot\Chart as Chart;
use bburim\flot\Plugin as Plugin;
use yii\web\JsExpression;

/* @var $this yii\web\View */
/* @var $model reportmanager\models\Reports */
/* @var $dataProvider yii\data\ActiveDataProvider */


if(count($model->columns) > 0):

    $models = $dataProvider->models;
    if(count($models) <= 0) return;

    $columns = $model->columns;
    if(count($columns) <= 0) return;

    $x_column = NULL;
    foreach($columns as $col) {
        if($col->alias === $model->graph_x) {
            $x_column = $col;
            break;
        }
    }

    foreach($columns as $col) {
        if($col->alias === $x_column->alias) {
            continue;
        }
        $plot_data[] = [
            'label' => $col->label,
            'data' => array_map(function($item) use($col, $x_column){
                $alias_y = $col->alias;
                if(is_object($x_column)) {
                    $alias_x = $x_column->alias;
                    return [$x_column->functionObj->prepareGraph($item->$alias_x),$col->functionObj->prepareGraph($item->$alias_y)];
                } else {
                    return [$col->functionObj->prepareGraph($item->$alias_y)];
                }
            },$models),
            'lines'  => ['show' => true],
            'points' => ['show' => true],
        ];

    }
?>

<div class="reports-view-graph">

    <?= Chart::widget([
        'data' => $plot_data,
{'fraction_non_alphanumeric': 0.17632241813602015, 'fraction_numerical': 0.001889168765743073, 'mean_word_length': 2.1238938053097347, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 64, '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': '4135727', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1012, 'n_words': 175}