| AWStats logfile analyzer 8.0 Documentation |

# Plugin Graphs

Charts, graphs and maps can be generated by your plugin and make AWStats reports look nice. AWStats generates arrays of values, label names and titles so that your plugin only has to handle the final data and display it as you wish.
NOTE: Only one graphing plugin should be choose by a user at any given time, thus your plugin should generate as many graphs as possible. If more than one graphing plugin is enabled at any given time, multiple graphs will appear in the output for each graph type.
Below is a list of variables passed to the graphin hook and how you should use them.

- Title
- Type
- Block Label
- Val Label
- Val Color
- Val Max
- Val Total
- Val Average
- Val Data

Title

This is simply the title of the graph as it should be displayed to the end user. This could be "Hosts (Top 5)" or "Monthly History" or anything else. Of course, you don't have to show the title unless you want to.
Type

The type is important as your graphing plugin should determine what type of graph to output depending on the type AWStats is requesting. For information on types and the data order, check the Types and Data section.

Block Label

This is a label for each group of data, usually labels for the X axis such as the days of the week, months of the year, etc. Your plugin can use the scalar count of values in this array as the number of times a loop needs to iterate through an axis. For example:
`foreach my $j (1.. (scalar @$blocklabel)) { ... }`
Val Label

@vallabel contains a list of labels for each of the data sets such as "pages", "hits", etc. Use the scalar count of values when accessing the data matrix.
Val Color

This is an array of color values associated with each type of data as assigned by the configuration file or the defaults in AWStats. Each color is a web formatted RGB hex encoded value such as "FFFFFF" or "000000".
Val Max

This array contains the maximum individual numeric value for each of the types of data stored in the data array. The count is the same as the the color array.
Val Total

This array contains the total numeric value for each type of data stored in the data array. The count is the same as the the color array.
Val Average

This array contains the average numeric value for each type of data stored in the data array. The count is the same as the the color array.
Val Data

This array contains the actual data values for each type of data indexed by each data type for a block of data, then the next set of types for a block and so on. Thus if we were looking at the monthly graph, the data would be laid out thusly:
$valdata[0] --> January Unique Visitors
$valdata[1] --> January Number of Visits
$valdata[2] --> January Pages
$valdata[3] --> January Hits
$valdata[4] --> January Bandwidth
$valdata[5] --> February Unique Visitors
$valdata[6] --> February Number of Visits
....
Graph Types and Data

Below is a list of the different graph types and the order in which data appears in the associated arrays.

- month - a graph of each month for a given year

- Unique Visitors
- Visits
- Pages
- Hits
- Bandwidth

- daysofmonth - each day of the month

- Visits
- Pages
- Hits
- Bandwidth

- daysofweek - an averaged data set for each day of the week

- Pages
- Hits
- Bandwidth

- hours - an averaged data set for each hour of a day

- Pages
- Hits
- Bandwidth

- cluster - the top 5 clustered servers if the cluster option is enabled

- Pages

- filetypes - the top 5 file types reported on

- Pages

- httpstatus - the top 5 HTTP status codes

- Pages

- browsers - the top 5 browsers

- Pages

- oss - the top 5 operating systems

- Pages

- hosts - the top 5 hosts

- Pages

- countries_map - a list of all countries and their hit counts

- Hits

Article written by Laurent Destailleur.