namespace Combodo\iTop\Application\Dashlet\Core; use Combodo\iTop\Application\Helper\WebResourcesHelper; use Combodo\iTop\Application\UI\Base\Component\Dashlet\DashletContainer; use Dict; use utils; class DashletGroupByPie extends DashletGroupBy { /** * @inheritdoc */ public function __construct($oModelReflection, $sId) { parent::__construct($oModelReflection, $sId); $this->aProperties['style'] = 'pie'; } /** * @inheritDoc */ public function GetJSFilesRelPaths(): array { return array_merge( parent::GetJSFilesRelPaths(), WebResourcesHelper::GetJSFilesRelPathsForC3JS() ); } /** * @inheritDoc */ public function GetCSSFilesRelPaths(): array { return array_merge( parent::GetCSSFilesRelPaths(), WebResourcesHelper::GetCSSFilesRelPathsForC3JS() ); } /** * @inheritdoc */ public function RenderNoData($oPage, $bEditMode = false, $aExtraParams = []) { $oDashletContainer = new DashletContainer(null, ['dashlet-content']); $sTitle = $this->aProperties['title']; $sBlockId = 'block_fake_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occuring in the same DOM) $HTMLsTitle = ($sTitle != '') ? '

'.utils::HtmlEntities($sTitle).'

' : ''; $oDashletContainer->AddHtml("
$HTMLsTitle
"); $aDisplayValues = $this->MakeSimulatedData(); $aColumns = []; $aNames = []; foreach ($aDisplayValues as $idx => $aValue) { $aColumns[] = ['series_'.$idx, (int)$aValue['value']]; $aNames['series_'.$idx] = $aValue['label']; } $sJSColumns = json_encode($aColumns); $sJSNames = json_encode($aNames); $oPage->add_ready_script( <<