Plugin GraphsCharts, 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.
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.
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.
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:
@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.
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".
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.
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.
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.
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 --> January Unique Visitors
$valdata --> January Number of Visits
$valdata --> January Pages
$valdata --> January Hits
$valdata --> January Bandwidth
$valdata --> February Unique Visitors
$valdata --> 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.
Article written by Laurent Destailleur.