$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);
$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]; $arConsolidated[$index] += $dataRow[1]; }
$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); } } /* print_r($arX); print_r($arrayX); print_r($arY); print_r($arrayY); EchoGraphData($arrayX, $MinX, $MaxX, $arrayY, $MinY, $MaxY, $arX, $arY); die(); */ if (($arFind["filter_by"] == "month" || $arFind["filter_by"] == "weekday") && LANGUAGE_ID != "en") { $arrTTF_FONT["X"] = array("FONT_PATH" => "/bitrix/modules/sale/ttf/verdana.ttf", "FONT_SIZE" => 8, "FONT_SHIFT" => 12); } DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle, "FFFFFF", "B1B1B1", "000000", 15, 2, $arrTTF_FONT); //DrawCoordinatGrid($arrayX, $arrayY, $width, $height, $ImageHandle); /****************************************************** data plot *******************************************************/ /* print_r($arY); echo "<br>"; print_r($MinX); echo "<br>"; print_r($MaxX); echo "<br>"; print_r($MinY); echo "<br>"; print_r($MaxY);
$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);