Esempio n. 1
0
 /**
  * 不同的部分
  */
 public function go_diff()
 {
     $geoType = $this->dateType;
     $showLabels = 0;
     $type = 'flash';
     $aInput = $this->aInput['input'][$type];
     $_ALYSconfig = \YcheukfReport\Lib\ALYS\ALYSConfig::get();
     $noDataShowLabel = empty($_ALYSconfig['fusion']['geography']['noDataShowLabel']) ? 0 : 1;
     $geographyRange = empty($aInput['geoRangeStyle']) ? 'common' : $aInput['geoRangeStyle'];
     unset($this->aChartStyles['range']);
     $field = $aInput['mainTable']['showField'][0];
     $oId2Label = \YcheukfReport\Lib\ALYS\ALYSFunction::loadDictionary('Id2label');
     $aTmp = $oId2Label->ALYSchgId2Label($this->dimenkey2selected);
     $aryLabelSet4Geo = $aTmp[key($this->dimenkey2selected)];
     $Data = $this->aDatas[0][$field];
     $DataN = $this->aFlashDatas[0][$field];
     //$Data = $DataN = array(58=>900);
     //		var_dump($aTmp);
     //翻译citykey
     $sCitykey = 'num2citykey';
     $aIDs = array();
     if (is_array($DataN)) {
         foreach ($DataN as $k => $v) {
             $aIDs[$sCitykey][] = $k;
         }
     }
     $aLabel = $oId2Label->ALYSchgId2Label(array($sCitykey => $sCitykey), $aIDs);
     $aCityMap = $aLabel[$sCitykey];
     //var_dump($aCityMap,$Data);exit;
     $fieldLabel = \YcheukfReport\Lib\ALYS\ALYSLang::_($field);
     if ($geoType == 'country') {
         $aCountrySN2Id = $this->_getCountryShortName2Id();
         $aryLabelSet4Geo = $this->_getCompatibleCode($aryLabelSet4Geo);
         foreach ($aryLabelSet4Geo as $shortName => $geoLabel) {
             $fusionCountryId = $this->_chgLocationCode2FusionCode($shortName);
             if (empty($aCountrySN2Id[$fusionCountryId])) {
                 continue;
             }
             $iniId = $aCountrySN2Id[$fusionCountryId];
             if ($Data[$fusionCountryId]) {
                 if (!empty($_ALYSconfig['fusion']['geography']['linkble'])) {
                     $event = $shortName == 'CN' ? "link=\\\"JavaScript:changeGeoMap('country', '" . $shortName . "');\\\"" : "";
                 }
                 $value = $DataN[$fusionCountryId];
                 $entitys .= "<entity id='" . $iniId . "' value='" . $value . "' showLabel='1' displayValue='" . $geoLabel . "' toolText='" . $fieldLabel . ',' . $geoLabel . ',' . $Data[$fusionCountryId] . "' " . $event . "/>";
             } else {
                 $entitys .= "<entity id='" . $iniId . "' value='0' displayValue='" . $geoLabel . "' toolText='" . $geoLabel . "' showLabel='" . $noDataShowLabel . "' />";
             }
         }
     } elseif ($geoType == 'province') {
         unset($Data['CN00']);
         foreach ($aryLabelSet4Geo as $shortName => $geoLabel) {
             list($t, $geoLabel) = explode('-', $geoLabel);
             $countryCode = substr($shortName, 0, 2);
             if ($countryCode == 'CN') {
                 $provinceCode = substr($shortName, 2, 2);
                 $fusionProvinceId = 'CN.' . $provinceCode;
                 $fusionProvinceId = $this->_chgLocationCode2FusionCode($fusionProvinceId);
                 if (!empty($_ALYSconfig['fusion']['geography']['linkble'])) {
                     $event = " link=\\\"JavaScript:changeGeoMap('province', '" . $countryCode . '.' . $provinceCode . "');\\\"";
                 }
                 if (!empty($aCityMap[$shortName])) {
                     $shortName = $aCityMap[$shortName];
                 }
                 if ($Data[$shortName]) {
                     //$selectedProvince = ($geoType == 'city' && strtoupper($provinceCode)==strtoupper($aryData['geoTypeProvinceCode']))? "fontBold='1' fontSize='16' fontColor='0' color='FF9933'":"";
                     $value = $DataN[$shortName];
                     $entitys .= "<entity id='" . $fusionProvinceId . "' value='" . $value . "' showLabel='1' displayValue='" . $geoLabel . "' toolText='" . $fieldLabel . ',' . $geoLabel . ',' . $Data[$shortName] . "' {$event} {$selectedProvince}/>";
                 } else {
                     $entitys .= "<entity id='" . $fusionProvinceId . "' value='0' displayValue='" . $geoLabel . "' toolText='" . $geoLabel . "' showLabel='" . $noDataShowLabel . "'  {$event}/>";
                 }
             } else {
                 unset($Data[$shortName]);
             }
         }
         $showLabels = 1;
     }
     //echo "aryLabelSet4Geo=";print_r($aryLabelSet4Geo);
     //$colorRange = $this->_getFusionColorRange($field, @max($DataN));
     if ('percent' == $geographyRange) {
         $colorRange = $this->_rangeColor1to10percent(@max($DataN));
     } elseif ('5hundred' == $geographyRange) {
         $colorRange = $this->_rangeColor1to5hun(@max($DataN));
     } else {
         $colorRange = $this->_getFusionColorRange($field, @max($DataN));
     }
     $s1 = "";
     $sUrlBase = \YcheukfCommon\Lib\Functions::getBaseUrl($_ALYSconfig['smHandle']);
     if (count($this->aChartStyles)) {
         foreach ($this->aChartStyles as $k => $v) {
             $s1 .= " {$k}='{$v}'";
         }
         if (isset($_ALYSconfig['fusion']['exportHandler'])) {
             $s1 .= " exportHandler='" . $sUrlBase . '/' . $_ALYSconfig['fusion']['exportHandler'] . "'";
         }
     }
     $this->xmlData = "<map showLabels ='" . $showLabels . "' legendCaption='" . $fieldLabel . "' {$s1}>" . $colorRange . "<data>" . $entitys . '</data></map>';
 }