} else { $i = 0; foreach ($arCurrency as $k1 => $v) { if ($arFind["find_all_" . $k1] == "Y") { Graf($arX, $arPriceY[$k1], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arColor[$i], "N"); } $i++; if ($arFind["find_payed_" . $k1] == "Y") { Graf($arX, $arPayedY[$k1], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arColor[$i], "N"); } $i++; if ($arFind["find_allow_delivery_" . $k1] == "Y") { Graf($arX, $arDelivY[$k1], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arColor[$i], "N"); } $i++; if ($arFind["find_canceled_" . $k1] == "Y") { Graf($arX, $arCancelY[$k1], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arColor[$i], "N"); } $i++; foreach ($arStatus as $k2 => $v2) { if ($arFind["find_status_" . $k2 . "_" . $k1] == "Y") { Graf($arX, $arStatusY[$k2][$k1], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arColor[$i], "N"); } $i++; } } } /****************************************************** send image to client *******************************************************/ ShowImageHeader($ImageHandle);
$value = $arD[$keyL][$find_data_type]; $arrY_data[$keyL][] = $value; $arrY[] = $value; } $prev_date = $date; } /****************************************************** Axes X *******************************************************/ $arrayX = GetArrayX($arrX, $MinX, $MaxX); /****************************************************** Axes Y *******************************************************/ $arrayY = GetArrayY($arrY, $MinY, $MaxY); /****************************************************** Draw grid *******************************************************/ DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle); /****************************************************** Plot data *******************************************************/ reset($arrLegend); while (list($keyL, $arrL) = each($arrLegend)) { if (strlen($keyL) > 0) { Graf($arrX, $arrY_data[$keyL], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrL["COLOR"]); } } /****************************************************** Send image *******************************************************/ ShowImageHeader($ImageHandle);
} } } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="paint line chart"> $imageHandle = $ImageHandle = CreateImageHandle($width, $height); $arYNorm = GetArrayY($arYAll, $minY, $maxY); $arrTTF_FONT = array('X' => array('FONT_PATH' => '/bitrix/components/bitrix/report.view/ttf/verdana.ttf', 'FONT_SIZE' => 8, 'FONT_SHIFT' => 12, 'FONT_BASE' => 3), 'Y' => array('FONT_PATH' => '/bitrix/components/bitrix/report.view/ttf/verdana.ttf', 'FONT_SIZE' => 8, 'FONT_SHIFT' => 12, 'FONT_BASE' => 3)); DrawCoordinatGrid($arXLabels, $arYNorm, $width, $height, $imageHandle, $backgroundColor, 'B1B1B1', '000000', 10, 2, $arrTTF_FONT); $nColors = count($arYValues); $color = $baseColor; $arLegendInfo = array(); foreach ($arYValues as $columnIndex => $arY) { $arLegendInfo[$columnIndex] = $color; Graf($arXValues, $arY, $imageHandle, $minX, $maxX, $minY, $maxY, $color); $color = GetNextRGB($color, $nColors); } // </editor-fold> } else { $errorCode = 42; } // At least two rows of values are required } else { if ($chartData['type'] === 'bar') { if (count($chartData['data']) >= 2) { // <editor-fold defaultstate="collapsed" desc="prepare data for bar chart"> $arXLabels = array(); $arXValues = array(); $arData = array(); $minX = null;
$arrY = array_merge($arrY, $arrY_overdue_mess); } $arrayY = GetArrayY($arrY, $MinY, $MaxY); //while (list($key, $value) = each($arrX)) echo date("d.m.Y",$value)." = ".$arrY_all[$key]."<br>"; //EchoGraphData($arrayX, $MinX, $MaxX, $arrayY, $MinY, $MaxY, $arrX, $arrY); /****************************************************** –исуем координатную сетку *******************************************************/ DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHendle); /****************************************************** –исуем графики *******************************************************/ if ($find_all == "Y") { Graf($arrX, $arrY_all, $ImageHendle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["ALL_TICKET"]); } if ($find_open == "Y") { Graf($arrX, $arrY_open, $ImageHendle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["OPEN_TICKET"]); } if ($find_close == "Y") { Graf($arrX, $arrY_close, $ImageHendle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["CLOSE_TICKET"]); } if ($find_mess == "Y") { Graf($arrX, $arrY_mess, $ImageHendle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["MESSAGES"]); } if ($find_overdue_mess == "Y") { Graf($arrX, $arrY_overdue_mess, $ImageHendle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["OVERDUE_MESSAGES"]); } /****************************************************** ќтображаем изображение *******************************************************/ ShowImageHeader($ImageHendle);
if ($show == "time") { $arData["AM_AVERAGE_TIME"] = (double) $arData["AM_AVERAGE_TIME"]; $arrY[] = round($arData["AM_AVERAGE_TIME"] / 60, 2); } else { $arData["AH_AVERAGE_HITS"] = (double) $arData["AH_AVERAGE_HITS"]; $arrY[] = round($arData["AH_AVERAGE_HITS"], 2); } $prev_date = $date; } /****************************************************** X axis *******************************************************/ $arrayX = GetArrayX($arrX, $MinX, $MaxX); /****************************************************** Y axis *******************************************************/ $arrayY = GetArrayY($arrY, $MinY, $MaxY); //EchoGraphData($arrayX, $MinX, $MaxX, $arrayY, $MinY, $MaxY, $arrX, $arrY); /****************************************************** draw grid *******************************************************/ DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle); /****************************************************** plot data *******************************************************/ $color = $show == "time" ? $arrColor["AM_AVERAGE_TIME"] : $arrColor["AH_AVERAGE_HITS"]; Graf($arrX, $arrY, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $color); /****************************************************** send image *******************************************************/ ShowImageHeader($ImageHandle);
if ($find_visitors=="Y") $arrY = array_merge($arrY,$arrY_visitors); if ($find_visits=="Y") $arrY = array_merge($arrY,$arrY_visits); if ($find_new_visitors=="Y") $arrY = array_merge($arrY,$arrY_new_visitors); $arrayY = GetArrayY($arrY, $MinY, $MaxY); DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle, "FFFFFF", "B1B1B1", "000000", 15, 2, $arrTTF_FONT); /****************************************************** data plot *******************************************************/ if ($find_page_views=="Y") Graf($arrX, $arrY_page_views, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["PAGE_VIEWS"], "N"); if ($find_visitors=="Y") Graf($arrX, $arrY_visitors, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["VISITORS"], "N"); if ($find_visits=="Y") Graf($arrX, $arrY_visits, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["VISITS"], "N"); if ($find_new_visitors=="Y") Graf($arrX, $arrY_new_visitors, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["NEW_VISITORS"], "N"); } /****************************************************** send image to client *******************************************************/ ShowImageHeader($ImageHandle); ?>
–исуем координатную сетку *******************************************************/ DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle); /****************************************************** –исуем графики *******************************************************/ reset($arrLegend); while (list($keyL, $arrS) = each($arrLegend)) { if (strlen($keyL) > 0) { if (in_array("ctr", $arShow)) { //reset($arrX); echo "<pre>ctr - ".$keyL." color - <font style='color:#".$arrS["COLOR_CTR"]."'><b>".$arrS["COLOR_CTR"]."</b></font>\n"; while (list($key, $value) = each($arrX)) echo date("d.m.Y",$value)." = ".$arrY_ctr[$keyL][$key]."\n"; echo "\n</pre>"; Graf($arrX, $arrY_ctr[$keyL], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrS["COLOR_CTR"]); } if (in_array("show", $arShow)) { //reset($arrX); echo "<pre>show - ".$keyL." color - <font style='color:#".$arrS["COLOR_SHOW"]."'><b>".$arrS["COLOR_SHOW"]."</b></font>\n"; while (list($key, $value) = each($arrX)) echo date("d.m.Y",$value)." = ".$arrY_show[$keyL][$key]."\n"; echo "\n</pre>"; Graf($arrX, $arrY_show[$keyL], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrS["COLOR_SHOW"]); } if (in_array("click", $arShow)) { //reset($arrX); echo "<pre>click - ".$keyL." color - <font style='color:#".$arrS["COLOR_CLICK"]."'><b>".$arrS["COLOR_CLICK"]."</b></font>\n"; while (list($key, $value) = each($arrX)) echo date("d.m.Y",$value)." = ".$arrY_click[$keyL][$key]."\n"; echo "\n</pre>"; reset($arrX); Graf($arrX, $arrY_click[$keyL], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrS["COLOR_CLICK"]); } if (in_array("visitor", $arShow)) { //reset($arrX); echo "<pre>visitor - ".$keyL." color - <font style='color:#".$arrS["COLOR_VISITOR"]."'><b>".$arrS["COLOR_VISITOR"]."</b></font>\n"; while (list($key, $value) = each($arrX)) echo date("d.m.Y",$value)." = ".$arrY_visitor[$keyL][$key]."\n"; echo "\n</pre>"; reset($arrX); Graf($arrX, $arrY_visitor[$keyL], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrS["COLOR_VISITOR"]); } } } /****************************************************** ќтображаем изображение *******************************************************/ ShowImageHeader($ImageHandle);
$arrX[] = $date; reset($arrLegend); while (list($adv_id, $arrS) = each($arrLegend)) { $arrY_adv[$adv_id][] = $arD[$adv_id]; $arrY[] = $arD[$adv_id]; } $prev_date = $date; } /****************************************************** X axis *******************************************************/ $arrayX = GetArrayX($arrX, $MinX, $MaxX); /****************************************************** Y axis *******************************************************/ $arrayY = GetArrayY($arrY, $MinY, $MaxY); /****************************************************** draw grid *******************************************************/ DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle); /****************************************************** plot graph *******************************************************/ reset($arrLegend); while (list($adv_id, $arrS) = each($arrLegend)) { Graf($arrX, $arrY_adv[$adv_id], $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrS["CLR"]); } /****************************************************** send image *******************************************************/ ShowImageHeader($ImageHandle);
} $arrayY = GetArrayY($arrY, $MinY, $MaxY); DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle, "FFFFFF", "B1B1B1", "000000", 15, 2, $arrTTF_FONT); /****************************************************** data plot *******************************************************/ if ($find_hit == "Y") { Graf($arrX, $arrY_hit, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["HITS"], "N"); } if ($find_host == "Y") { Graf($arrX, $arrY_host, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["HOSTS"], "N"); } if ($find_session == "Y") { Graf($arrX, $arrY_session, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["SESSIONS"], "N"); } if ($find_event == "Y") { Graf($arrX, $arrY_event, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["EVENTS"], "N"); } if (!$site_filtered) { if ($find_guest == "Y") { Graf($arrX, $arrY_guest, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["GUESTS"], "N"); } if ($find_new_guest == "Y") { Graf($arrX, $arrY_new_guest, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["NEW_GUESTS"], "N"); } } } /****************************************************** send image to client *******************************************************/ ShowImageHeader($ImageHandle);
if ($find_sessions == "Y") { Graf($arrX, $arrY_sessions, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["SESSIONS"]); } if ($find_sessions_back == "Y") { Graf($arrX, $arrY_sessions_back, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["SESSIONS"], "Y"); } if ($find_guests == "Y") { Graf($arrX, $arrY_guests, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["GUESTS"]); } if ($find_guests_back == "Y") { Graf($arrX, $arrY_guests_back, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["GUESTS"], "Y"); } if ($find_new_guests == "Y") { Graf($arrX, $arrY_new_guests, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["NEW_GUESTS"]); } if ($find_hosts == "Y") { Graf($arrX, $arrY_hosts, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["HOSTS"]); } if ($find_hosts_back == "Y") { Graf($arrX, $arrY_hosts_back, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["HOSTS"], "Y"); } if ($find_hits == "Y") { Graf($arrX, $arrY_hits, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["HITS"]); } if ($find_hits_back == "Y") { Graf($arrX, $arrY_hits_back, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["HITS"], "Y"); } /****************************************************** send image *******************************************************/ ShowImageHeader($ImageHandle);
$arrX[] = $i; $i++; if ($_REQUEST["find_data_type"] == "PAGE_EXEC_TIME") { $arExec[] = $ar["PAGE_EXEC_TIME"]; $arrY[] = $ar["PAGE_EXEC_TIME"]; $arResp[] = $ar["PAGE_RESP_TIME"]; $arrY[] = $ar["PAGE_RESP_TIME"]; } else { $arPages[] = $ar["PAGES_PER_SECOND"]; $arrY[] = $ar["PAGES_PER_SECOND"]; } } if (count($arrX) > 1) { $arrayX = GetArrayY($arrX, $MinX, $MaxX, 10, 'N', true); // X axis grid points $arrayY = GetArrayY($arrY, $MinY, $MaxY, 10, 'Y', $_REQUEST["find_data_type"] == "PAGE_EXEC_TIME" ? false : true); // Y axis grid points DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle); if ($_REQUEST["find_data_type"] == "PAGE_EXEC_TIME") { Graf($arrX, $arExec, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, "ff0000"); Graf($arrX, $arResp, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, "0000ff"); } else { Graf($arrX, $arPages, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, "ff0000"); } } else { DrawCoordinatGrid(array(1, 2), array(0, 0), $width, $height, $ImageHandle); } /****************************************************** send image *******************************************************/ ShowImageHeader($ImageHandle);
if ($find_hits == "Y") { $arrY = array_merge($arrY, $arrY_hits); } if ($find_enter_points == "Y") { $arrY = array_merge($arrY, $arrY_enter_points); } if ($find_exit_points == "Y") { $arrY = array_merge($arrY, $arrY_exit_points); } $arrayY = GetArrayY($arrY, $MinY, $MaxY); //EchoGraphData($arrayX, $MinX, $MaxX, $arrayY, $MinY, $MaxY, $arrX, $arrY); /****************************************************** grid *******************************************************/ DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle); /****************************************************** plot *******************************************************/ if ($find_hits == "Y") { Graf($arrX, $arrY_hits, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["RED"]); } if ($find_enter_points == "Y") { Graf($arrX, $arrY_enter_points, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["GREEN"]); } if ($find_exit_points == "Y") { Graf($arrX, $arrY_exit_points, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $arrColor["BLUE"]); } /****************************************************** send to client *******************************************************/ ShowImageHeader($ImageHandle);
$arr = $arrY_events[$eid]; foreach ($arr as $value) { $arrY[] = intval($value); } $arr = $arrY_events_back[$eid]; foreach ($arr as $value) { $arrY[] = intval($value); } } $arrayY = GetArrayY($arrY, $MinY, $MaxY); //EchoGraphData($arrayX, $MinX, $MaxX, $arrayY, $MinY, $MaxY, $arrX, $arrY); /****************************************************** draw grid *******************************************************/ DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle); /****************************************************** plot data *******************************************************/ reset($find_events); $total = sizeof($find_events); foreach ($find_events as $eid) { $arrY_dk = $arrY_events[$eid]; $arrY_bc = $arrY_events_back[$eid]; $color = GetNextRGB($color, $total); Graf($arrX, $arrY_dk, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $color); Graf($arrX, $arrY_bc, $ImageHandle, $MinX, $MaxX, $MinY, $MaxY, $color, "Y"); } /****************************************************** send image *******************************************************/ ShowImageHeader($ImageHandle);