Merge remote-tracking branch 'remotes/origin/ticket15' into develop
This commit is contained in:
commit
1fc090c43d
4 changed files with 258 additions and 5 deletions
|
|
@ -26,6 +26,7 @@
|
|||
<script type="application/ld+json"><?php bcn_display_json_ld(); ?></script>
|
||||
<script src="https://www.google.com/recaptcha/api.js?render=6LePZvAUAAAAABs8uGHxhSkJVPVs4yCJ3amJ1HpX"></script>
|
||||
<script src="<?= get_template_directory_uri() . '/js/masonry.pkgd.min.js' ?>"></script>
|
||||
<script scrc="<?= get_template_directory_uri() . '/js/chart.min.js' ?>"></script>
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
<body <?php body_class(); ?>>
|
||||
|
|
|
|||
15
content/themes/ldc/js/chart.min.js
vendored
Normal file
15
content/themes/ldc/js/chart.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -277,15 +277,247 @@ Template Name: Page Finance
|
|||
set_query_var('text_block', $key_figures_and_results['text_block']);
|
||||
get_template_part('partials/text-block');
|
||||
?>
|
||||
<?php if(!empty($key_figures_and_results['blocks'])) : ?>
|
||||
<?php if (!empty($key_figures_and_results['graphiques'])) : ?>
|
||||
<div class="kfar-blocks fw">
|
||||
<div class="kfar__wrapper wrapper">
|
||||
<div class="kfar__list">
|
||||
<?php foreach($key_figures_and_results['blocks'] as $b) : ?>
|
||||
<?php foreach ($key_figures_and_results['graphiques'] as $k => $b) : ?>
|
||||
<div class="kfar-item">
|
||||
<div class="kfar-item__title subtitle"><?php echo $b['title'] ?></div>
|
||||
<div class="kfar-item__text description"><?php echo $b['text'] ?></div>
|
||||
<a class="kfar-item__image" href="<?php echo $b['image'] ?>" title="<?php echo $b['title'] ?>" data-fancybox><img src="<?php echo $b['image'] ?>" alt="<?php echo $b['title'] ?>" /></a>
|
||||
<div class="kfar-item__title subtitle"><?php echo $b['titre'] ?></div>
|
||||
<div class="kfar-item__text description">
|
||||
<p><?php echo $b['sous-titre'] ?></p>
|
||||
</div>
|
||||
<div class="kfar-item__text description">
|
||||
<canvas id="<?php
|
||||
$id = sha1($b['titre']);
|
||||
echo $id; ?>" width="400" height="400"></canvas>
|
||||
<script>
|
||||
var $ctx = $('#<?php echo $id; ?>');
|
||||
<?php
|
||||
switch ($k) {
|
||||
case 'evolution_du_chiffre_d’affaires':
|
||||
$labels = array_map(function ($a) {
|
||||
return $a['annee'];
|
||||
}, $b['valeurs']['annees']);
|
||||
$values = array_map(function ($a) {
|
||||
return $a['annee_valeur'];
|
||||
}, $b['valeurs']['annees']);
|
||||
$chart = [
|
||||
'type' => 'line',
|
||||
'data' => [
|
||||
'labels' => $labels,
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => $b['titre'],
|
||||
'data' => $values,
|
||||
'backgroundColor' => [
|
||||
'rgba(54, 162, 235, 1)'
|
||||
],
|
||||
'borderColor' => [
|
||||
'rgba(54, 162, 235, 0.2)'
|
||||
],
|
||||
'borderWidth' => 1
|
||||
]
|
||||
]
|
||||
],
|
||||
'options' => [
|
||||
'responsive' => true,
|
||||
'elements' => [
|
||||
'point' => [
|
||||
'radius' => 12,
|
||||
'hitRadius' => 14,
|
||||
'hoverRadius' => 14,
|
||||
'pointStyle' => 'rect'
|
||||
],
|
||||
'line' => [
|
||||
'borderWidth' => 0,
|
||||
'backgroundColor' => '',
|
||||
'fill' => 'rect'
|
||||
]
|
||||
],
|
||||
'legend' => [
|
||||
'display' => false
|
||||
]
|
||||
]
|
||||
];
|
||||
echo 'new Chart($ctx, ' . json_encode($chart) . ');';
|
||||
break;
|
||||
case 'repartition_du_chiffre_d’affaires':
|
||||
$labels = array_map(function ($a) {
|
||||
return $a['titre'];
|
||||
}, $b['valeurs']['chiffre_daffaire']);
|
||||
$values = array_map(function ($a) {
|
||||
return $a['valeur_en_pourcentage'];
|
||||
}, $b['valeurs']['chiffre_daffaire']);
|
||||
$chart = [
|
||||
'type' => 'pie',
|
||||
'data' => [
|
||||
'labels' => $labels,
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => $b['titre'],
|
||||
'data' => $values,
|
||||
'backgroundColor' => [
|
||||
'rgba(85, 154, 213, 1)',
|
||||
'rgba(64, 114, 203, 1)',
|
||||
'rgba(242, 125, 32, 1)',
|
||||
'rgba(165, 165, 165, 1)',
|
||||
'rgba(255, 192, 0, 1)',
|
||||
'rgba(75, 192, 192, 1)'
|
||||
],
|
||||
'borderColor' => [
|
||||
'rgba(85, 154, 213, 0.2)',
|
||||
'rgba(64, 114, 203, 0.2)',
|
||||
'rgb(242, 125, 32, 0.2)',
|
||||
'rgba(165, 165, 165, 0.2)',
|
||||
'rgba(255, 192, 0, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
],
|
||||
'borderWidth' => 1
|
||||
]
|
||||
]
|
||||
],
|
||||
'options' => [
|
||||
'scales' => [
|
||||
'y' => [
|
||||
'beginAtZero' => true
|
||||
]
|
||||
],
|
||||
'tooltips' => [
|
||||
'callbacks' => [
|
||||
'label' => 'function() { return null; }'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
echo 'var repartitionChart = ' . json_encode($chart) . ';';
|
||||
echo 'repartitionChart.options.tooltips.callbacks.label = function(context,e) { console.log(context,e); return e.labels[context.index]+" "+e.datasets[context.datasetIndex].data[context.index]+" %"; };';
|
||||
echo 'new Chart($ctx, repartitionChart);';
|
||||
break;
|
||||
case 'capacite_dautofinancement':
|
||||
$labels = array_map(function ($a) {
|
||||
return $a['annee'];
|
||||
}, $b['valeurs']['capacite']);
|
||||
$valuesCPT = array_map(function ($a) {
|
||||
return $a['capital_dautofinancement'];
|
||||
}, $b['valeurs']['capacite']);
|
||||
$valuesIVT = array_map(function ($a) {
|
||||
return $a['investissements_industriels'];
|
||||
}, $b['valeurs']['capacite']);
|
||||
$chart = [
|
||||
'type' => 'bar',
|
||||
'data' => [
|
||||
'labels' => $labels,
|
||||
'datasets' => [
|
||||
[
|
||||
'type' => 'line',
|
||||
'label' => $b['valeurs']['legende_investissement_industriels'],
|
||||
'data' => $valuesIVT,
|
||||
'borderColor' => 'rgba(231, 122, 37, 1)',
|
||||
'borderWidth' => 2,
|
||||
'order' => 1
|
||||
],
|
||||
[
|
||||
'type' => 'bar',
|
||||
'label' => $b['valeurs']['legende_capital_dautofinancement'],
|
||||
'data' => $valuesCPT,
|
||||
'backgroundColor' => 'rgba(64, 114, 203, 1)',
|
||||
'borderColor' => 'rgba(64, 114, 203, 0.2)',
|
||||
'borderWidth' => 1,
|
||||
'order' => 0
|
||||
]
|
||||
]
|
||||
],
|
||||
'options' => [
|
||||
'responsive' => true,
|
||||
'legend' => [
|
||||
'position' => 'bottom'
|
||||
],
|
||||
'point' => [
|
||||
'radius' => 6,
|
||||
'hitRadius' => 8,
|
||||
'hoverRadius' => 8,
|
||||
],
|
||||
]
|
||||
];
|
||||
echo 'new Chart($ctx, ' . json_encode($chart) . ');';
|
||||
break;
|
||||
case 'bilan_simplifie':
|
||||
$i = 0;
|
||||
$colors = [
|
||||
'rgb(90, 155, 211)',
|
||||
'rgb(255, 170, 0)',
|
||||
'rgb(165, 165, 165)',
|
||||
'rgb(238, 126, 52)',
|
||||
'rgb(69, 116, 198)',
|
||||
'rgb(113, 174, 71)',
|
||||
'rgb(93, 169, 156)',
|
||||
'rgb(253, 199, 0)',
|
||||
'rgb(165, 165, 165)',
|
||||
'rgb(238, 166, 52)',
|
||||
'rgb(69, 80, 178)',
|
||||
];
|
||||
$datasetActif = array_map(function ($a) use ($colors, &$i) {
|
||||
return [
|
||||
'label' => $a['titre'],
|
||||
'data' => [floatval($a['valeur'])],
|
||||
'stack' => 'Stack 0',
|
||||
'backgroundColor' => $colors[$i++]
|
||||
];
|
||||
}, $b['valeurs']['actif']['strate']);
|
||||
$datasetPassif = array_map(function ($a) use ($colors, &$i) {
|
||||
return [
|
||||
'label' => $a['titre'],
|
||||
'data' => [floatval($a['valeur'])],
|
||||
'stack' => 'Stack 1',
|
||||
'backgroundColor' => $colors[$i++]
|
||||
];
|
||||
}, $b['valeurs']['passif']['strate']);
|
||||
$chart = [
|
||||
'type' => 'bar',
|
||||
'data' => [
|
||||
'labels' => [sprintf(
|
||||
'%s %s',
|
||||
$b['valeurs']['actif']['titre_colonne'],
|
||||
$b['valeurs']['passif']['titre_colonne']
|
||||
)],
|
||||
'datasets' => array_merge(
|
||||
$datasetActif,
|
||||
$datasetPassif
|
||||
)
|
||||
],
|
||||
'options' => [
|
||||
'responsive' => true,
|
||||
'scales' => [
|
||||
'x' => ['stacked' => true],
|
||||
'y' => ['stacked' => true]
|
||||
],
|
||||
'tooltips' => [
|
||||
'callbacks' => [
|
||||
'title' => 'function() { return null; }'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
echo 'var stackChart = ' . json_encode($chart) . ';';
|
||||
echo 'stackChart.options.tooltips.callbacks.title = function() { return null; };';
|
||||
echo 'new Chart($ctx, stackChart);';
|
||||
break;
|
||||
default:
|
||||
$chart = [];
|
||||
echo 'new Chart($ctx, ' . json_encode($chart) . ');';
|
||||
}
|
||||
?>
|
||||
</script>
|
||||
</div>
|
||||
<?php if ($k === 'bilan_simplifie') : ?>
|
||||
<div class="kfar-item__text description centered">
|
||||
<?php echo $b['valeurs']['base_en_euros']; ?>
|
||||
</div>
|
||||
<div class="kfar-item__text description small centered">
|
||||
<?php echo $b['valeurs']['legende__texte_en_bas']; ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -235,6 +235,11 @@ iframe {
|
|||
line-height: 1.75;
|
||||
}
|
||||
|
||||
.description.small {
|
||||
font-style: italic;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.description h3 {
|
||||
font-weight: 500;
|
||||
font-size: 28px;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue