Bitrix Site Manager

CCountry::GetGraphArray

array
CCountry::GetGraphArray(
 array filter,
 array &legend
)

The method GetGraphArray returns data required to build the graph and the pie chart of the site attendance on country basis.

Parameters

Parameter Description
filter Array used to filter countries. The following keys are possible:
  • COUNTRY_ID - two-character country identifier;
  • DATE1 - minimum value of the time range;
  • DATE2 - maximum value of the time range.
legend Array containing summary figures on each country, and the line and sector colours for each country. The array has the following structure:
Array
(
    [country ID] => Array
        (
            [NAME] => name of the country
            [SESSIONS] => number of sessions within the time range
            [NEW_GUESTS] => number of new visitors within the time range
            [HITS] => number of hits within the time range
            [C_EVENTS] => number of events within the time range
            [TOTAL_SESSIONS] => total number of sessions
            [TOTAL_NEW_GUESTS] => total number of new visitors
            [TOTAL_HITS] => total number of hits
            [TOTAL_C_EVENTS] => total number of events
            [COLOR] => colour of the graph line and the pie chart sector
        )
    ...
)

Structure of the returned array

Array
(
    [date] => Array
        (
            [D] => day (1-31)
            [M] => month (1-12)
            [Y] => year
            [country ID] => Array
                (
                    [SESSIONS] => number of sessions per the country for the date
                    [NEW_GUESTS] => number of new visitors per the country for the date
                    [HITS] => number of hits per the country for the date
                    [C_EVENTS] => number of events per the country for the date
                )
            ...

        )
    ...
)

See Also

Example



<?
// filter data for UK for December 2005
$arFilter = Array(
    "COUNTRY_ID" => "uk",
    "DATE1"      => "01.12.2005",
    "DATE2"      => "31.12.2005"
    );

// obtain the array of data on daily basis
$arDays = CCountry::GetGraphArray($arFilter, $arLegend);

// print the data
while (list($date, $arr) = each($arrDays))
{
    echo "Date: ".$date."<br>";
    echo "Data: <pre>"; print_r($arr); echo "</pre>";    
}
?>