<commit_before><?php

use MapasCulturais\i;

/**
 * 
    $this->part('charts/line', [
        'vertical',
        'labels' => ['Draft', 'Pending', 'Publish'],
        'series' => [
           ['label' => 'Preto', 'data' => [66,120,70], 'color' => 'black'],
           ['label' => 'Branco', 'data' => [22,44,66], 'color' => 'white'],
           ['label' => 'Amarelo', 'data' => [77,55,34], 'color' => 'yellow']
        ]
    ]);
 * 
 */
$title = $title ?? null;
$chart_id = uniqid('chart-line-');
$datasets = [];

if (isset($series) && is_array($series)) {
    $datasets = array_map(function ($dataset) {

        $dataset['fill'] = $dataset['fill'] ?? false;
        $dataset['pointBorderWidth'] = $dataset['pointBorderWidth'] ?? '0';
        $dataset['radius'] = $dataset['radius'] ?? '4';
        $dataset['hoverRadius'] = $dataset['hoverRadius'] ?? $dataset['radius'] + 1;

        if (isset($dataset['colors'])) {
            $dataset['borderColor'] = $dataset['borderColor'] ?? $dataset['colors'];
            $dataset['pointBackgroundColor'] = $dataset['pointBackgroundColor'] ?? $dataset['colors'];
            unset($dataset['colors']);
        }
        return $dataset;
    }, $series);
}

/**
 * Calcula a largura em porcentagem para o gráfico, baseado na quantidade de dados
 */
$count_data = function ( $data ) {
    if ( count( $data ) < 30 ) {
        return 100;
    } else {
        return count( $data ) * 2;
    }
};

$width = $width ?? '50vw';
$height = $height ?? '50vw';

$route = MapasCulturais\App::i()->createUrl('reports', $action, ['opportunity_id' => $opportunity->id, 'action' => $action]);
<commit_msg>Corrige calculo de percentual para exibição do scroll Ref.: #1824<commit_after><?php

use MapasCulturais\i;

/**
 * 
    $this->part('charts/line', [
        'vertical',
        'labels' => ['Draft', 'Pending', 'Publish'],
        'series' => [
           ['label' => 'Preto', 'data' => [66,120,70], 'color' => 'black'],
           ['label' => 'Branco', 'data' => [22,44,66], 'color' => 'white'],
           ['label' => 'Amarelo', 'data' => [77,55,34], 'color' => 'yellow']
        ]
    ]);
 * 
 */
$title = $title ?? null;
$chart_id = uniqid('chart-line-');
$datasets = [];

if (isset($series) && is_array($series)) {
    $datasets = array_map(function ($dataset) {

        $dataset['fill'] = $dataset['fill'] ?? false;
        $dataset['pointBorderWidth'] = $dataset['pointBorderWidth'] ?? '0';
        $dataset['radius'] = $dataset['radius'] ?? '4';
        $dataset['hoverRadius'] = $dataset['hoverRadius'] ?? $dataset['radius'] + 1;

        if (isset($dataset['colors'])) {
            $dataset['borderColor'] = $dataset['borderColor'] ?? $dataset['colors'];
            $dataset['pointBackgroundColor'] = $dataset['pointBackgroundColor'] ?? $dataset['colors'];
            unset($dataset['colors']);
        }
        return $dataset;
    }, $series);
}

/**
 * Calcula a largura em porcentagem para o gráfico, baseado na quantidade de dados
 */
$count_data = function ( $data ) {
    if ( count( $data ) < 30 || (count( $data ) * 2) < 100) {
        return 100;
    } else {
        return count( $data ) * 2;
    }
};

$width = $width ?? '50vw';
$height = $height ?? '50vw';

$route = MapasCulturais\App::i()->createUrl('reports', $action, ['opportunity_id' => $opportunity->id, 'action' => $action]);

{'fraction_non_alphanumeric': 0.22600896860986547, 'fraction_numerical': 0.021524663677130046, 'mean_word_length': 3.0606796116504853, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 35, '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': '7252022', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1106, 'n_words': 223}