N°3685 - Front-end performances: Include graph lib. (D3/C3.js) only when necessary

This commit is contained in:
Molkobain
2021-09-09 17:26:18 +02:00
parent df189bd1f2
commit 15081ba82c
4 changed files with 70 additions and 3 deletions

View File

@@ -537,6 +537,11 @@ function DisplayRelatedClassesGraph($oPage, $sClass)
// 3) Processing data and building graph
//
// - Add graphs dependencies
$oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/c3.min.css');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/d3.js');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/c3.js');
// - Add markup
$oPage->add(
<<<EOF
<div id="dataModelGraph">
@@ -545,6 +550,7 @@ function DisplayRelatedClassesGraph($oPage, $sClass)
</div>
EOF
);
// - Add scripts
$oPage->add_ready_script(
<<<JS