reset($arrLegend); while (list($keyL, $arrL) = each($arrLegend)) { $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
$arDelivY[$k1][] = roundEx($v["ALLOW_DELIVERY"][$k1], SALE_VALUE_PRECISION); } if ($arFind["find_canceled_" . $k1] == "Y") { $arY[] = roundEx($v["CANCELED"][$k1], SALE_VALUE_PRECISION); $arCancelY[$k1][] = roundEx($v["CANCELED"][$k1], SALE_VALUE_PRECISION); } foreach ($arStatus as $k2 => $v2) { if ($arFind["find_status_" . $k2 . "_" . $k1] == "Y") { $arY[] = roundEx($v["STATUS"][$k2][$k1], SALE_VALUE_PRECISION); $arStatusY[$k2][$k1][] = roundEx($v["STATUS"][$k2][$k1], SALE_VALUE_PRECISION); } } } } } $arrayY = GetArrayY($arY, $MinY, $MaxY, 10); if ($arFind["filter_by"] == "day") { $arrayX = GetArrayX($arX, $MinX, $MaxX); } elseif ($arFind["filter_by"] == "weekday") { $arrayX = $arX1; $MinX = 0; $MaxX = 6; } else { $arrayX = $arX1; } if ($obCache->StartDataCache()) { $arCacheData = array("arX1" => $arX1, "arX" => $arX, "arY" => $arY, "arCountY" => $arCountY, "arPayedY" => $arPayedY, "arCancelY" => $arCancelY, "arDelivY" => $arDelivY, "arStatusY" => $arStatusY, "arPriceY" => $arPriceY, "MaxX" => $MaxX, "MinX" => $MinX, "MaxY" => $MaxY, "MinY" => $MinY, "arrayX" => $arrayX, "arrayY" => $arrayY, "arResult" => $arResult); $obCache->EndDataCache($arCacheData); } } /*
} if (in_array("visitor", $arShow)) { $arrY_visitor[$keyL][] = $visitor_value; $arrY[] = $visitor_value; } } $prev_date = $date; } /****************************************************** ‘ормируем ось X *******************************************************/ $arrayX = GetArrayX($arrX, $MinX, $MaxX); /****************************************************** ‘ормируем ось Y *******************************************************/ $arrayY = GetArrayY($arrY, $MinY, $MaxY, 10, "Y", true); /****************************************************** –исуем координатную сетку *******************************************************/ 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)) {
} else { $arYAll[] = $arData[$rowIndex]['DATA'][$columnIndex - 1] = $dataValue < 0 ? 0 : $dataValue; $minY = min($minY, $dataValue); $maxY = max($maxY, $dataValue); $arData[$rowIndex]['COLORS'][$columnIndex - 1][0] = $color; if ($rowIndex === 0) { $arLegendInfo[$columnIndex - 1] = $color; } $color = GetNextRGB($color, $nColors); } } } // </editor-fold> // <editor-fold defaultstate="collapsed" desc="paint bar diagram"> $imageHandle = $ImageHandle = CreateImageHandle($width, $height); $arYNorm = GetArrayY($arYAll, $minY, $maxY); $arrTTF_FONT = array('type' => 'bar', '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)); $gridInfo = DrawCoordinatGrid($arXLabels, $arYNorm, $width, $height, $imageHandle, $backgroundColor, 'B1B1B1', '000000', 10, 2, $arrTTF_FONT); Bar_Diagram($imageHandle, $arData, $minY, $maxY, $gridInfo); // </editor-fold> } else { $errorCode = 43; } // At least one row of values is required } else { if ($chartData['type'] === 'pie') { if (count($chartData['data']) >= 1) { // <editor-fold defaultstate="collapsed" desc="prepare data for pie chart"> $arConsolidated = array(); foreach ($chartData['data'] as $rowIndex => $dataRow) { $index = $dataRow[0];
$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);