本文整理汇总了PHP中GetNextRGB函数的典型用法代码示例。如果您正苦于以下问题:PHP GetNextRGB函数的具体用法?PHP GetNextRGB怎么用?PHP GetNextRGB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetNextRGB函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetGraphArray
function GetGraphArray($arFilter, &$arrLegend)
{
$err_mess = "File: " . __FILE__ . "<br>Line: ";
$DB = CDatabase::GetModuleConnection('statistic');
$arSqlSearch = array("D.SEARCHER_ID <> 1");
$strSqlSearch = "";
if (is_array($arFilter)) {
foreach ($arFilter as $key => $val) {
if (is_array($val)) {
if (count($val) <= 0) {
continue;
}
} else {
if (strlen($val) <= 0 || $val === "NOT_REF") {
continue;
}
}
$match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
$key = strtoupper($key);
switch ($key) {
case "SEARCHER_ID":
$arSqlSearch[] = GetFilterQuery("D.SEARCHER_ID", $val, "N");
break;
case "DATE1":
if (CheckDateTime($val)) {
$arSqlSearch[] = "D.DATE_STAT>=" . $DB->CharToDateFunction($val, "SHORT");
}
break;
case "DATE2":
if (CheckDateTime($val)) {
$arSqlSearch[] = "D.DATE_STAT<=" . $DB->CharToDateFunction($val . " 23:59:59", "FULL");
}
break;
}
}
}
$arrDays = array();
$arrLegend = array();
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
$summa = $arFilter["SUMMA"] == "Y" ? "Y" : "N";
$strSql = CSearcher::GetGraphArray_SQL($strSqlSearch);
$rsD = $DB->Query($strSql, false, $err_mess . __LINE__);
while ($arD = $rsD->Fetch()) {
$arrDays[$arD["DATE_STAT"]]["D"] = $arD["DAY"];
$arrDays[$arD["DATE_STAT"]]["M"] = $arD["MONTH"];
$arrDays[$arD["DATE_STAT"]]["Y"] = $arD["YEAR"];
if ($summa == "N") {
$arrDays[$arD["DATE_STAT"]][$arD["SEARCHER_ID"]]["TOTAL_HITS"] = $arD["TOTAL_HITS"];
$arrLegend[$arD["SEARCHER_ID"]]["COUNTER_TYPE"] = "DETAIL";
$arrLegend[$arD["SEARCHER_ID"]]["NAME"] = $arD["NAME"];
} elseif ($summa == "Y") {
$arrDays[$arD["DATE_STAT"]]["TOTAL_HITS"] += $arD["TOTAL_HITS"];
$arrLegend[0]["COUNTER_TYPE"] = "TOTAL";
}
}
reset($arrLegend);
$total = sizeof($arrLegend);
while (list($key, $arr) = each($arrLegend)) {
$color = GetNextRGB($color, $total);
$arr["COLOR"] = $color;
$arrLegend[$key] = $arr;
}
reset($arrDays);
reset($arrLegend);
return $arrDays;
}
示例2: GetGraphArray
//.........这里部分代码省略.........
} else {
if (strlen($val) <= 0 || $val === "NOT_REF") {
continue;
}
}
$match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
$key = strtoupper($key);
switch ($key) {
case "COUNTRY_ID":
if ($val != "NOT_REF") {
$arSqlSearch[] = GetFilterQuery("C.COUNTRY_ID", $val, "N");
}
break;
case "DATE1":
if (CheckDateTime($val)) {
$arSqlSearch[] = "D.DATE_STAT>=" . $DB->CharToDateFunction($val, "SHORT");
}
break;
case "DATE2":
if (CheckDateTime($val)) {
$arSqlSearch[] = "D.DATE_STAT<=" . $DB->CharToDateFunction($val . " 23:59:59", "FULL");
}
break;
}
}
}
$arrDays = array();
$arLegend = array();
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
$strSql = "\n\t\t\tSELECT\n\t\t\t\t" . $DB->DateToCharFunction("D.DATE_STAT", "SHORT") . " DATE_STAT,\n\t\t\t\t" . $DB->DateFormatToDB("DD", "D.DATE_STAT") . " DAY,\n\t\t\t\t" . $DB->DateFormatToDB("MM", "D.DATE_STAT") . " MONTH,\n\t\t\t\t" . $DB->DateFormatToDB("YYYY", "D.DATE_STAT") . " YEAR,\n\t\t\t\tD.CITY_ID,\n\t\t\t\tD.SESSIONS,\n\t\t\t\tD.NEW_GUESTS,\n\t\t\t\tD.HITS,\n\t\t\t\tD.C_EVENTS,\n\t\t\t\tC.NAME,\n\t\t\t\tC.SESSIONS TOTAL_SESSIONS,\n\t\t\t\tC.NEW_GUESTS TOTAL_NEW_GUESTS,\n\t\t\t\tC.HITS TOTAL_HITS,\n\t\t\t\tC.C_EVENTS TOTAL_C_EVENTS\n\t\t\tFROM\n\t\t\t\tb_stat_city_day D\n\t\t\t\tINNER JOIN b_stat_city C ON (C.ID = D.CITY_ID)\n\t\t\tWHERE\n\t\t\t\t" . $strSqlSearch . "\n\t\t\tORDER BY\n\t\t\t\tD.DATE_STAT, D.CITY_ID\n\t\t";
$rsD = $DB->Query($strSql, false, $err_mess . __LINE__);
while ($arD = $rsD->Fetch()) {
$arrDays[$arD["DATE_STAT"]]["D"] = $arD["DAY"];
$arrDays[$arD["DATE_STAT"]]["M"] = $arD["MONTH"];
$arrDays[$arD["DATE_STAT"]]["Y"] = $arD["YEAR"];
$arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["SESSIONS"] = $arD["SESSIONS"];
$arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["NEW_GUESTS"] = $arD["NEW_GUESTS"];
$arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["HITS"] = $arD["HITS"];
$arrDays[$arD["DATE_STAT"]][$arD["CITY_ID"]]["C_EVENTS"] = $arD["C_EVENTS"];
$arLegend[$arD["CITY_ID"]]["CITY_ID"] = intval($arD["CITY_ID"]);
$arLegend[$arD["CITY_ID"]]["NAME"] = $arD["NAME"];
$arLegend[$arD["CITY_ID"]]["SESSIONS"] += $arD["SESSIONS"];
$arLegend[$arD["CITY_ID"]]["NEW_GUESTS"] += $arD["NEW_GUESTS"];
$arLegend[$arD["CITY_ID"]]["HITS"] += $arD["HITS"];
$arLegend[$arD["CITY_ID"]]["C_EVENTS"] += $arD["C_EVENTS"];
$arLegend[$arD["CITY_ID"]]["TOTAL_SESSIONS"] = $arD["TOTAL_SESSIONS"];
$arLegend[$arD["CITY_ID"]]["TOTAL_NEW_GUESTS"] = $arD["TOTAL_NEW_GUESTS"];
$arLegend[$arD["CITY_ID"]]["TOTAL_HITS"] = $arD["TOTAL_HITS"];
$arLegend[$arD["CITY_ID"]]["TOTAL_C_EVENTS"] = $arD["TOTAL_C_EVENTS"];
}
if ($sort) {
CStatisticSort::Sort($arLegend, $sort);
}
if ($top) {
$totals = array("CITY_ID" => 0, "NAME" => GetMessage("STAT_CITY_OTHER"), "SESSIONS" => 0, "NEW_GUESTS" => 0, "HITS" => 0, "C_EVENTS" => 0, "TOTAL_SESSIONS" => 0, "TOTAL_NEW_GUESTS" => 0, "TOTAL_HITS" => 0, "TOTAL_C_EVENTS" => 0);
$i = 0;
while (count($arLegend) > $top) {
$i++;
$tail = array_pop($arLegend);
$totals["SESSIONS"] += $tail["SESSIONS"];
$totals["NEW_GUESTS"] += $tail["NEW_GUESTS"];
$totals["HITS"] += $tail["HITS"];
$totals["C_EVENTS"] += $tail["C_EVENTS"];
$totals["TOTAL_SESSIONS"] += $tail["TOTAL_SESSIONS"];
$totals["TOTAL_NEW_GUESTS"] += $tail["TOTAL_NEW_GUESTS"];
$totals["TOTAL_HITS"] += $tail["TOTAL_HITS"];
$totals["TOTAL_C_EVENTS"] += $tail["TOTAL_C_EVENTS"];
}
if ($i) {
$arLegend[0] = $totals;
}
foreach ($arrDays as $DATE_STAT => $arDate) {
foreach ($arDate as $CITY_ID => $arCity) {
if (intval($CITY_ID) > 0) {
if (!array_key_exists($CITY_ID, $arLegend)) {
$arrDays[$DATE_STAT][0]["CITY_ID"] = 0;
$arrDays[$DATE_STAT][0]["NAME"] = GetMessage("STAT_CITY_OTHER");
$arrDays[$DATE_STAT][0]["SESSIONS"] += $arCity["SESSIONS"];
$arrDays[$DATE_STAT][0]["NEW_GUESTS"] += $arCity["NEW_GUESTS"];
$arrDays[$DATE_STAT][0]["HITS"] += $arCity["HITS"];
$arrDays[$DATE_STAT][0]["C_EVENTS"] += $arCity["C_EVENTS"];
unset($arrDays[$DATE_STAT][$CITY_ID]);
}
}
}
}
}
$total = count($arLegend);
foreach ($arLegend as $key => $arr) {
if (strlen($arCountryColor[$key]) > 0) {
$color = $arCountryColor[$key];
} else {
$color = GetNextRGB($color_getnext, $total);
$color_getnext = $color;
}
$arr["COLOR"] = $color;
$arLegend[$key] = $arr;
}
return $arrDays;
}
示例3: GetDynamicList
//.........这里部分代码省略.........
}
}
if (in_array($arD["GROUP_SID"], $arGroup)) {
if ($group_total == "N") {
$arrLegend["2_GROUP_" . $arD["GROUP_SID"]]["TYPE"] = "GROUP";
$arrLegend["2_GROUP_" . $arD["GROUP_SID"]]["ID"] = $arD["GROUP_SID"];
$arrLegend["2_GROUP_" . $arD["GROUP_SID"]]["COUNTER_TYPE"] = "DETAIL";
$arrLegend["2_GROUP_" . $arD["GROUP_SID"]][$ctype_u] += $arD[$ctype_u . "_COUNT"];
$arrDays[$arD["DATE_STAT"]]["GROUP"]["DETAIL_" . $ctype_u][$arD["GROUP_SID"]] += $arD[$ctype_u . "_COUNT"];
} elseif ($group_total == "Y") {
$arrLegend["2_GROUP"]["TYPE"] = "GROUP";
$arrLegend["2_GROUP"]["COUNTER_TYPE"] = "TOTAL";
$arrLegend["2_GROUP"][$ctype_u] += $arD[$ctype_u . "_COUNT"];
$arrDays[$arD["DATE_STAT"]]["GROUP"]["TOTAL_" . $ctype_u] += $arD[$ctype_u . "_COUNT"];
}
}
}
}
}
if (in_array("ctr", $arShow)) {
// рассчитаем CTR
reset($arrDays);
while (list($keyD, $arD) = each($arrDays)) {
reset($arrLegend);
while (list(, $arrS) = each($arrLegend)) {
if ($arrS["COUNTER_TYPE"] == "DETAIL") {
$show_value = intval($arD[$arrS["TYPE"]][$arrS["COUNTER_TYPE"] . "_SHOW"][$arrS["ID"]]);
$click_value = intval($arD[$arrS["TYPE"]][$arrS["COUNTER_TYPE"] . "_CLICK"][$arrS["ID"]]);
if ($show_value <= 0) {
$ctr_value = 0;
} else {
$ctr_value = round($click_value * 100 / $show_value, 2);
}
$arD[$arrS["TYPE"]]["DETAIL_CTR"][$arrS["ID"]] = $ctr_value;
$arrDays[$keyD] = $arD;
} else {
$show_value = intval($arD[$arrS["TYPE"]][$arrS["COUNTER_TYPE"] . "_SHOW"]);
$click_value = intval($arD[$arrS["TYPE"]][$arrS["COUNTER_TYPE"] . "_CLICK"]);
if ($show_value <= 0) {
$ctr_value = 0;
} else {
$ctr_value = round($click_value * 100 / $show_value, 2);
}
$arD[$arrS["TYPE"]]["TOTAL_CTR"] = $ctr_value;
$arrDays[$keyD] = $arD;
}
}
}
}
// Определим цвета и суммарный CTR
reset($arrLegend);
$s = 0;
if (in_array("ctr", $arShow)) {
$s++;
}
if ($arFilter["WHAT_SHOW"] != array("ctr") && in_array("show", $arShow)) {
$s++;
}
if ($arFilter["WHAT_SHOW"] != array("ctr") && in_array("click", $arShow)) {
$s++;
}
if ($arFilter["WHAT_SHOW"] != array("ctr") && in_array("visitor", $arShow)) {
$s++;
}
$total = sizeof($arrLegend) * $s;
$color = "";
while (list($key, $arr) = each($arrLegend)) {
if (in_array("ctr", $arShow)) {
$color = GetNextRGB($color, $total);
$arr["COLOR_CTR"] = $color;
if ($arr["SHOW"] <= 0) {
$ctr = 0;
} else {
$ctr = round($arr["CLICK"] * 100 / $arr["SHOW"], 2);
}
$arr["CTR"] = $ctr;
}
if ($arFilter["WHAT_SHOW"] != array("ctr")) {
if (in_array("show", $arShow)) {
$color = GetNextRGB($color, $total);
$arr["COLOR_SHOW"] = $color;
}
if (in_array("click", $arShow)) {
$color = GetNextRGB($color, $total);
$arr["COLOR_CLICK"] = $color;
}
if (in_array("visitor", $arShow)) {
$color = GetNextRGB($color, $total);
$arr["COLOR_VISITOR"] = $color;
}
}
$arr["COLOR"] = $color;
$arrLegend[$key] = $arr;
}
krsort($arrLegend);
$is_filtered = IsFiltered($strSqlSearch);
reset($arrDays);
reset($arrLegend);
return $arrDays;
}
示例4: intval
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php";
global $arrSaveColor;
if (CModule::IncludeModule("vote")) {
$diameter = intval($_REQUEST["dm"]) > 0 ? intval($_REQUEST["dm"]) : 150;
$res = CVoteAnswer::GetList($qid, $by = "s_counter", $order = "desc");
$res->NavStart(1000);
$totalRecords = $res->SelectedRowsCount();
$arChart = array();
$color = "";
$sum = 0;
while ($arAnswer = $res->Fetch()) {
$arChart[] = array("COLOR" => strlen($arAnswer["COLOR"]) > 0 ? TrimEx($arAnswer["COLOR"], "#") : ($color = GetNextRGB($color, $totalRecords)), "COUNTER" => $arAnswer["COUNTER"]);
$sum += $arAnswer["COUNTER"];
}
// create an image
$ImageHandle = CreateImageHandle($diameter, $diameter);
imagefill($ImageHandle, 0, 0, imagecolorallocate($ImageHandle, 255, 255, 255));
// drawing pie chart
if ($sum > 0) {
Circular_Diagram($ImageHandle, $arChart, "FFFFFF", $diameter, $diameter / 2, $diameter / 2);
}
// displaying of the resulting image
ShowImageHeader($ImageHandle);
}
示例5: array
}
}
if (round($prcntCount, 2) < 100.0) {
$arCounting['__trifle__'] = 100.0 - $prcntCount;
$arConsolidated['__trifle__'] = $sumTrifle;
$nValues++;
}
$arData = array();
$arLegendInfo = array();
$i = 0;
$color = $baseColor;
foreach ($arCounting as $k => $v) {
$arData[$i]['COUNTER'] = intval($v * 100);
$arData[$i]['COLOR'] = $color;
$arLegendInfo[$i] = array('color' => $color, 'label' => CharsetConverter::ConvertCharset($k, LANG_CHARSET, 'UTF-8'), 'value' => $arConsolidated[$k], 'prcnt' => round($v, 2));
$color = GetNextRGB($color, $nValues);
$i++;
}
} else {
$errorCode = 46;
}
} else {
$errorCode = 45;
}
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="paint pie diagram">
if ($errorCode === 0) {
$diameter = min($width, $height);
$imageHandle = $ImageHandle = CreateImageHandle($diameter, $diameter);
Circular_Diagram($imageHandle, $arData, $backgroundColor, $diameter, round($diameter / 2), round($diameter / 2));
$h = $diameter * 0.6;
示例6: count
if ($total > 0)
{
$cnt = count($arReferers);
?><table width="100%">
<tr>
<td colspan="2" align="center"><table class="referers-table">
<?
$color = null;
foreach ($arReferers as $domain => $arData)
{
$percent = number_format($arData['PERCENT'], 2);
?>
<tr>
<td width="30%" align="left"><a href="javascript:void(0)" onclick="BXToggle('bx_referer_ex_<?echo CUtil::JSEscape($domain)?>'); return false;" title="<?echo GetMessage('SEO_PAGE_REFERERS_SEO_PAGE_REFERERS_ALT')?>"><?echo htmlspecialcharsbx($domain)?></td>
<td width="70%">
<div style="height: 15px; border: solid 1px #<?echo $color = GetNextRGB($color, $cnt)?> !important; width: 100%; position: relative; cursor: pointer; text-align: left !important;" onclick="BXToggle('bx_referer_ex_<?echo CUtil::JSEscape($domain)?>'); return false;">
<div style="float: left; height: 15px; width: <?echo $percent?>%; background-color: #<?echo $color; ?>; white-space: nowrap; position: absolute;">
<?echo intval($arData['TOTAL'])?> (<?echo $percent?>%)
</div>
<?echo intval($arData['TOTAL'])?> (<?echo $percent?>%)
</div>
</td>
</tr>
<tr id="bx_referer_ex_<?echo CUtil::JSEscape($domain)?>" style="display: none;">
<td colspan="2" align="center"><table>
<tr class="bx-th">
<td width="90%" style="text-align: left !important;"><?echo GetMessage('SEO_PAGE_REFERERS_LINK')?></td>
<td width="10%"><?echo GetMessage('SEO_PAGE_REFERERS_COUNT')?></td>
</tr>
<?
foreach ($arData['URL_FROM'] as $url => $count):
示例7: GetMessage
$domainEnc = \Bitrix\Main\Text\Converter::getHtmlConverter()->encode($domain);
?>
<tr>
<td width="30%" align="left"><a href="javascript:void(0)" onclick="BXToggle('bx_referer_ex_<?php
echo CUtil::JSEscape($domainEnc);
?>
'); return false;" title="<?php
echo GetMessage('SEO_PAGE_REFERERS_SEO_PAGE_REFERERS_ALT');
?>
"><?php
echo $domainEnc;
?>
</td>
<td width="70%">
<div style="height: 15px; border: solid 1px #<?php
echo $color = GetNextRGB($color, $cnt);
?>
!important; width: 100%; position: relative; cursor: pointer; text-align: left !important;" onclick="BXToggle('bx_referer_ex_<?php
echo CUtil::JSEscape($domainEnc);
?>
'); return false;">
<div style="float: left; height: 15px; width: <?php
echo $percent;
?>
%; background-color: #<?php
echo $color;
?>
; white-space: nowrap; position: absolute;">
<?php
echo intval($arData['TOTAL']);
?>
示例8: GetAnalysisGraphArray
//.........这里部分代码省略.........
while ($arD = $rsD->Fetch()) {
$cnt = 0;
switch ($DATA_TYPE) {
default:
$cnt = intval($arD["SESSIONS"]) + intval($arD["SESSIONS_BACK"]);
break;
case "SESSION":
$cnt = intval($arD["SESSIONS"]);
break;
case "SESSION_BACK":
$cnt = intval($arD["SESSIONS_BACK"]);
break;
case "VISITOR_SUMMA":
$cnt = intval($arD["GUESTS"]) + intval($arD["GUESTS_BACK"]);
break;
case "VISITOR":
$cnt = intval($arD["GUESTS"]);
break;
case "VISITOR_BACK":
$cnt = intval($arD["GUESTS_BACK"]);
break;
case "NEW_VISITOR":
$cnt = intval($arD["NEW_GUESTS"]);
break;
case "FAV_SUMMA":
$cnt = intval($arD["FAVORITES"]) + intval($arD["FAVORITES_BACK"]);
break;
case "FAV":
$cnt = intval($arD["FAVORITES"]);
break;
case "FAV_BACK":
$cnt = intval($arD["FAVORITES_BACK"]);
break;
case "HOST_SUMMA":
$cnt = intval($arD["C_HOSTS"]) + intval($arD["HOSTS_BACK"]);
break;
case "HOST":
$cnt = intval($arD["C_HOSTS"]);
break;
case "HOST_BACK":
$cnt = intval($arD["HOSTS_BACK"]);
break;
case "HIT_SUMMA":
$cnt = intval($arD["HITS"]) + intval($arD["HITS_BACK"]);
break;
case "HIT":
$cnt = intval($arD["HITS"]);
break;
case "HIT_BACK":
$cnt = intval($arD["HITS_BACK"]);
break;
case "EVENT_SUMMA":
$cnt = intval($arD["EVENTS"]) + intval($arD["EVENTS_BACK"]);
break;
case "EVENT":
$cnt = intval($arD["EVENTS"]);
break;
case "EVENT_BACK":
$cnt = intval($arD["EVENTS_BACK"]);
break;
case "MONEY_SUMMA":
$cnt = doubleval($arD["MONEY"]) + doubleval($arD["MONEY_BACK"]);
break;
case "MONEY":
$cnt = doubleval($arD["MONEY"]);
break;
case "MONEY_BACK":
$cnt = doubleval($arD["MONEY_BACK"]);
break;
}
if ($cnt > 0) {
$arrDays[$arD["DATE_STAT"]]["D"] = $arD["DAY"];
$arrDays[$arD["DATE_STAT"]]["M"] = $arD["MONTH"];
$arrDays[$arD["DATE_STAT"]]["Y"] = $arD["YEAR"];
$arrDays[$arD["DATE_STAT"]][$arD["ADV_ID"]] = $cnt;
$arrLegend[$arD["ADV_ID"]]["ID"] = $arD["ADV_ID"];
$arrLegend[$arD["ADV_ID"]]["R1"] = $arD["REFERER1"];
$arrLegend[$arD["ADV_ID"]]["R2"] = $arD["REFERER2"];
$arrSum[$arD["ADV_ID"]] += $cnt;
}
}
reset($arrLegend);
$summa = 0;
$max = 0;
$total = sizeof($arrLegend);
while (list($key, $arr) = each($arrLegend)) {
$color = GetNextRGB($color, $total);
$arr["CLR"] = $color;
$arrLegend[$key] = $arr;
$arrLegend[$key]["SM"] = $arrSum[$key];
$summa += $arrSum[$key];
if ($arrSum[$key] > $max) {
$max = $arrSum[$key];
}
}
reset($arrDays);
reset($arrLegend);
$is_filtered = IsFiltered($strSqlSearch);
return $arrDays;
}
示例9: prepareChartDataForAmCharts
//.........这里部分代码省略.........
$v[10] = 'T';
if ($bDateSort && !$bSkipRow) {
$arDateSort[$rowIndex] = strtotime($v);
}
}
}
$dataRow[$chartInfo['columnsNames'][$k]] = $v;
}
if (!$bSkipRow) {
$tmpData[] = $dataRow;
}
}
if (!$bDateSort) {
$data = $tmpData;
} else {
if (count($arDateSort) >= 1) {
asort($arDateSort);
foreach (array_keys($arDateSort) as $rowIndex) {
$data[] = $tmpData[$rowIndex];
}
}
}
unset($tmpData);
if (count($data) >= 1) {
$nColors = count($chartInfo['columnsNames']) - 1;
$color = $baseColor;
foreach ($chartInfo['columnsNames'] as $k => $v) {
if ($k === 0) {
$categoryField = $v;
} else {
$valueFields[] = $v;
$valueTypes[] = $chartInfo['requestData']['columnTypes'][$k];
$valueColors[] = '#' . $color;
$color = GetNextRGB($color, $nColors);
}
}
} else {
$err = 48;
}
} else {
$err = 47;
}
//42;
} else {
if ($type === 'column') {
if (count($chartInfo['requestData']['data']) >= 1) {
foreach ($chartInfo['requestData']['data'] as $row) {
$dataRow = array();
foreach ($row as $k => $v) {
$dataRow[$chartInfo['columnsNames'][$k]] = $v;
}
$data[] = $dataRow;
}
$nColors = count($chartInfo['columnsNames']) - 1;
$color = $baseColor;
foreach ($chartInfo['columnsNames'] as $k => $v) {
if ($k === 0) {
$categoryField = $v;
} else {
$valueFields[] = $v;
$valueTypes[] = $chartInfo['requestData']['columnTypes'][$k];
$valueColors[] = '#' . $color;
$color = GetNextRGB($color, $nColors);
}
}
} else {
示例10: number_format
$arAnswer["PERCENT"] = $arAnswer["PERCENT2"] = $arAnswer["PERCENT3"];
if ($counterSum > 0) {
$arAnswer["PERCENT"] = $arAnswer["PERCENT2"] = $arAnswer["PERCENT3"] = $percentage = $arAnswer["COUNTER"] * 100 / $counter;
if (is_float($percentage)) {
$arAnswer["PERCENT"] = number_format($percentage, 0, ".", "");
$arAnswer["PERCENT2"] = number_format($percentage, 1, ".", "");
if ($arAnswer["PERCENT2"] != $percentage) {
$arAnswer["PERCENT3"] = number_format($percentage, 2, ".", "");
}
}
$sum1 += $arAnswer["PERCENT"];
$sum2 += $arAnswer["PERCENT2"];
$sum3 += $arAnswer["PERCENT3"];
}
$arAnswer["BAR_PERCENT"] = $arAnswer["FIELD_TYPE"] == 0 || $arAnswer["FIELD_TYPE"] == 2 ? $counterMax > 0 ? round($arAnswer["COUNTER"] * 100 / $counterMax) : 0 : round($arAnswer["PERCENT"]);
$arAnswer["COLOR"] = empty($arAnswer["COLOR"]) && ($color = GetNextRGB($color, count($arQuestion["ANSWERS"]))) ? $color : TrimEx($arAnswer["COLOR"], "#");
$arQuestion["ANSWERS"][$aID] = $arAnswer;
}
$var = $sum1 == 100 ? 1 : ($sum2 == 100 ? 2 : 3);
if ($var > 1) {
foreach ($arQuestion["ANSWERS"] as $aID => $arAnswer) {
$arQuestion["ANSWERS"][$aID]["PERCENT"] = $arQuestion["ANSWERS"][$aID]["PERCENT" . $var];
}
}
$arResult["QUESTIONS"][$qID]["COUNTER_SUM"] = $counterSum;
$arResult["QUESTIONS"][$qID]["COUNTER_MAX"] = $counterMax;
//Images
$arResult["QUESTIONS"][$qID]["IMAGE"] = CFile::GetFileArray($arResult["QUESTIONS"][$qID]["IMAGE_ID"]);
//Diagram type
if (!empty($arParams["QUESTION_DIAGRAM_" . $qID]) && $arParams["QUESTION_DIAGRAM_" . $qID] != "-") {
$arResult["QUESTIONS"][$qID]["DIAGRAM_TYPE"] = trim($arParams["QUESTION_DIAGRAM_" . $qID]);
示例11: max
$counterSum += $arAnswer["COUNTER"];
$counterMax = max(intVal($arAnswer["COUNTER"]), $counterMax);
}
if ($arParams["NEED_SORT"] != "N")
uasort($arQuestion["ANSWERS"], "_vote_answer_sort");
$color = "";
foreach ($arQuestion["ANSWERS"] as $aID => $arAnswer)
{
$arResult["LAST_VOTE"] = ($arResult["LAST_VOTE"] === false ? $arAnswer["LAST_VOTE"] : $arResult["LAST_VOTE"]);
$arResult["LAST_VOTE"] = min($arResult["LAST_VOTE"], $arAnswer["LAST_VOTE"]);
$arAnswer["PERCENT"] = ($counterSum > 0 ? number_format(($arAnswer["COUNTER"]*100/$counter),0,",","") : 0);
$arAnswer["BAR_PERCENT"] = ($arAnswer["FIELD_TYPE"] == 0 || $arAnswer["FIELD_TYPE"] == 2 ? /* radio || dropdown */
($counterMax > 0 ? round($arAnswer["COUNTER"]*100/$counterMax) : 0) : round($arAnswer["PERCENT"]));
$arAnswer["COLOR"] = (empty($arAnswer["COLOR"]) && ($color = GetNextRGB($color, count($arQuestion["ANSWERS"]))) ?
$color : TrimEx($arAnswer["COLOR"], "#"));
$arQuestion["ANSWERS"][$aID] = $arAnswer;
}
$arResult["QUESTIONS"][$qID]["COUNTER_SUM"] = $counterSum;
$arResult["QUESTIONS"][$qID]["COUNTER_MAX"] = $counterMax;
//Images
$arResult["QUESTIONS"][$qID]["IMAGE"] = CFile::GetFileArray($arResult["QUESTIONS"][$qID]["IMAGE_ID"]);
//Diagram type
if (!empty($arParams["QUESTION_DIAGRAM_".$qID]) && $arParams["QUESTION_DIAGRAM_".$qID]!="-")
$arResult["QUESTIONS"][$qID]["DIAGRAM_TYPE"] = trim($arParams["QUESTION_DIAGRAM_".$qID]);
//Answers
$arResult["QUESTIONS"][$qID]["ANSWERS"] = $arQuestion["ANSWERS"];
示例12: intval
$arrPages[] = $arPage;
$sum_counter += $arPage["COUNTER"];
if (intval($arPage["COUNTER"]) > $max_counter) {
$max_counter = intval($arPage["COUNTER"]);
}
}
$total = count($arrPages);
if ($total > 10) {
$total = 11;
}
$i = 1;
$top_sum = 0;
foreach ($arrPages as $key => $arVal) {
if ($i == 11) {
break;
}
$top_sum += $arVal["COUNTER"];
$color = GetNextRGB($color, $total);
$arChart[] = array("COUNTER" => $arVal["COUNTER"], "COLOR" => $color);
$i++;
}
if ($total == 11) {
$arChart[] = array("COUNTER" => $sum_counter - $top_sum, "COLOR" => GetNextRGB($color, $total));
}
$diameter = COption::GetOptionString("statistic", "DIAGRAM_DIAMETER");
// create an image canvas
$ImageHandle = CreateImageHandle($diameter, $diameter);
// draw pie chart
Circular_Diagram($ImageHandle, $arChart, "FFFFFF", $diameter, $diameter / 2, $diameter / 2, true);
// send to client
ShowImageHeader($ImageHandle);
示例13: urlencode
<td class="number"><?php
echo "<a href=\"hit_list.php?lang=" . LANG . "&find_url=" . urlencode($arVal["URL"] . "%") . "&find_url_exact_match=Y&set_filter=Y\">" . $arVal["COUNTER"] . "</a>";
?>
</td>
</tr>
<?php
$i++;
}
?>
<?php
if ($total == 11) {
?>
<tr>
<td valign="center" class="color">
<div style="background-color: <?php
echo "#" . GetNextRGB($color, $total);
?>
"></div>
</td>
<td class="number"><?php
echo number_format(($sum_counter - $top_sum) * 100 / $sum_counter, 2, '.', '');
?>
%</td>
<td><?php
echo GetMessage("STAT_OTHER");
?>
</td>
<td class="number"><?php
echo $sum_counter - $top_sum;
?>
</td>
示例14: GetGraphArray
//.........这里部分代码省略.........
if(is_array($val))
{
if(count($val) <= 0)
continue;
}
else
{
if( (strlen($val) <= 0) || ($val === "NOT_REF") )
continue;
}
$match_value_set = array_key_exists($key."_EXACT_MATCH", $arFilter);
$key = strtoupper($key);
switch($key)
{
case "COUNTRY_ID":
if ($val!="NOT_REF")
$arSqlSearch[] = GetFilterQuery("D.COUNTRY_ID",$val,"N");
break;
case "DATE1":
if (CheckDateTime($val))
$arSqlSearch[] = "D.DATE_STAT>=".$DB->CharToDateFunction($val, "SHORT");
break;
case "DATE2":
if (CheckDateTime($val))
$arSqlSearch[] = "D.DATE_STAT<=".$DB->CharToDateFunction($val." 23:59:59", "FULL");
break;
}
}
}
$arrDays = array();
$arLegend = array();
$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
$strSql = "
SELECT
".$DB->DateToCharFunction("D.DATE_STAT","SHORT")." DATE_STAT,
".$DB->DateFormatToDB("DD", "D.DATE_STAT")." DAY,
".$DB->DateFormatToDB("MM", "D.DATE_STAT")." MONTH,
".$DB->DateFormatToDB("YYYY", "D.DATE_STAT")." YEAR,
D.COUNTRY_ID,
D.SESSIONS,
D.NEW_GUESTS,
D.HITS,
D.C_EVENTS,
C.NAME,
C.SESSIONS TOTAL_SESSIONS,
C.NEW_GUESTS TOTAL_NEW_GUESTS,
C.HITS TOTAL_HITS,
C.C_EVENTS TOTAL_C_EVENTS
FROM
b_stat_country_day D
INNER JOIN b_stat_country C ON (C.ID = D.COUNTRY_ID)
WHERE
".$strSqlSearch."
ORDER BY
D.DATE_STAT, D.COUNTRY_ID
";
$rsD = $DB->Query($strSql, false, $err_mess.__LINE__);
while ($arD = $rsD->Fetch())
{
$arrDays[$arD["DATE_STAT"]]["D"] = $arD["DAY"];
$arrDays[$arD["DATE_STAT"]]["M"] = $arD["MONTH"];
$arrDays[$arD["DATE_STAT"]]["Y"] = $arD["YEAR"];
$arrDays[$arD["DATE_STAT"]][$arD["COUNTRY_ID"]]["SESSIONS"] = $arD["SESSIONS"];
$arrDays[$arD["DATE_STAT"]][$arD["COUNTRY_ID"]]["NEW_GUESTS"] = $arD["NEW_GUESTS"];
$arrDays[$arD["DATE_STAT"]][$arD["COUNTRY_ID"]]["HITS"] = $arD["HITS"];
$arrDays[$arD["DATE_STAT"]][$arD["COUNTRY_ID"]]["C_EVENTS"] = $arD["C_EVENTS"];
$arLegend[$arD["COUNTRY_ID"]]["NAME"] = $arD["NAME"];
$arLegend[$arD["COUNTRY_ID"]]["SESSIONS"] += $arD["SESSIONS"];
$arLegend[$arD["COUNTRY_ID"]]["NEW_GUESTS"] += $arD["NEW_GUESTS"];
$arLegend[$arD["COUNTRY_ID"]]["HITS"] += $arD["HITS"];
$arLegend[$arD["COUNTRY_ID"]]["C_EVENTS"] += $arD["C_EVENTS"];
$arLegend[$arD["COUNTRY_ID"]]["TOTAL_SESSIONS"] = $arD["TOTAL_SESSIONS"];
$arLegend[$arD["COUNTRY_ID"]]["TOTAL_NEW_GUESTS"] = $arD["TOTAL_NEW_GUESTS"];
$arLegend[$arD["COUNTRY_ID"]]["TOTAL_HITS"] = $arD["TOTAL_HITS"];
$arLegend[$arD["COUNTRY_ID"]]["TOTAL_C_EVENTS"] = $arD["TOTAL_C_EVENTS"];
}
reset($arLegend);
$total = sizeof($arLegend);
while (list($key, $arr) = each($arLegend))
{
if (strlen($arCountryColor[$key])>0)
{
$color = $arCountryColor[$key];
}
else
{
$color = GetNextRGB($color_getnext, $total);
$color_getnext = $color;
}
$arr["COLOR"] = $color;
$arLegend[$key] = $arr;
}
reset($arrDays);
reset($arLegend);
return $arrDays;
}