コード例 #1
0
ファイル: RouteFilesChart.php プロジェクト: zyxist/cantiga
 private function enhanceData($data)
 {
     $paletteGen = new PaletteGenerator();
     $palette = $paletteGen->generatePalette(sizeof($data), 138, 86, 226);
     $chartData = [];
     $i = 0;
     foreach ($data as $item) {
         $color = $palette[$i++];
         $chartData[] = ['label' => $this->translator->trans($item['name'], [], 'edk'), 'value' => $item['value'], 'color' => $color['c'], 'highlight' => $color['h']];
     }
     return $chartData;
 }
コード例 #2
0
 private function enhanceData($data)
 {
     $paletteGen = new PaletteGenerator();
     $palette = $paletteGen->generatePalette(sizeof($data), 138, 86, 226);
     $chartData = [];
     $i = 0;
     foreach ($data as $route) {
         $color = $palette[$i++];
         $chartData[] = ['label' => $route['name'], 'value' => $route['participantNum'], 'color' => $color['c'], 'highlight' => $color['h']];
     }
     return $chartData;
 }
コード例 #3
0
 private function enhanceData($data)
 {
     $options = WhereLearntAbout::getItems();
     $paletteGen = new PaletteGenerator();
     $palette = $paletteGen->generatePalette(sizeof($options), 138, 86, 226);
     $chartData = [];
     foreach ($options as $option) {
         if (!empty($data[$option->getId()])) {
             $color = $this->chooseColor($palette, $option->getId());
             $chartData[] = ['value' => $data[$option->getId()], 'label' => $this->translator->trans($option->getName(), [], 'edk'), 'color' => $color['c'], 'highlight' => $color['h']];
         }
     }
     return $chartData;
 }