/** * Returns the style for each data set. This is either an instance of tx_pbimagegraph_Fill_Array or * a simple php array with style data * @param $confArr * @return tx_pbimagegraph_Fill_Array */ public function getDataStyles($plotId, $confArr) { $arrConf = $confArr['dataStyle.']; $objFillStyle = tx_pbimagegraph::factory('tx_pbimagegraph_Fill_Array'); if (!is_object($arrConf)) { return $objFillStyle; } $templateServiceClass = tx_rnbase_util_Typo3Classes::getTemplateServiceClass(); $arrKeys = $templateServiceClass::sortedKeyList($arrConf); foreach ($arrKeys as $strKey) { $strType = $arrConf[$strKey]; if (intval($strKey) && !strstr($strKey, '.')) { $strId = $arrConf[$strKey . '.']['id'] ? $arrConf[$strKey . '.']['id'] : FALSE; switch ($strType) { case 'color': case 'addColor': $strColor = $arrConf[$strKey . '.']['color']; $objFillStyle->addColor($strColor, $strId); break; case 'gradient': $intDirection = tx_rnbase_plot_Builder::readConstant('IMAGE_GRAPH_GRAD_' . strtoupper($arrConf[$strKey . '.']['direction'])); $strStartColor = $arrConf[$strKey . '.']['startColor']; $strEndColor = $arrConf[$strKey . '.']['endColor']; $objFillStyle->addNew('gradient', array($intDirection, $strStartColor, $strEndColor), $strId); break; } } } return $objFillStyle; }
/** * Returns the style for each data set. This is either an instance of tx_pbimagegraph_Fill_Array or * a simple php array with style data * @param $confArr * @return array */ public function getDataStyles($plotId, $confArr) { // Es wird der Style mit der ID 0 ausgelesen. Hier können mehrere Angaben gemacht werden $ret = array(); $type = $confArr['dataStyle.']['0']; $data = $confArr['dataStyle.']['0.']; switch ($type) { case 'color': case 'addColor': $strColors = tx_rnbase_util_Strings::trimExplode(',', $data['color']); foreach ($strColors as $color) { $ret[] = array('type' => 'color', 'color' => $color); } break; case 'gradient': $intDirection = tx_rnbase_plot_Builder::readConstant('IMAGE_GRAPH_GRAD_' . strtoupper($data['direction'])); $strColorsStart = tx_rnbase_util_Strings::trimExplode(',', $data['startColor']); $strColorsEnd = tx_rnbase_util_Strings::trimExplode(',', $data['endColor']); $maxStart = count($strColorsStart); $maxEnd = count($strColorsEnd); $max = $maxStart > $maxEnd ? $maxStart : $maxEnd; for ($i = 0; $i < $max; $i++) { $strStartColor = $i < $maxStart ? $strColorsStart[$i] : $strColorsStart[$maxStart - 1]; $strEndColor = $i < $maxEnd ? $strColorsEnd[$i] : $strColorsEnd[$maxEnd - 1]; $ret[] = array('type' => 'gradient', 'color' => array($intDirection, $strStartColor, $strEndColor)); } break; } return $ret; }