Source: site.view [edit]
Function name: popularRender
Arguments: data
Description: Render function for Popular command
Page type: webl
Render function:  
Module: global

Page source:

var MaxSeries = 15;
var series = [];
var categories = [];

every f in data do
   if (f.count > 0) and Size(series) < MaxSeries then
      categories = categories + [f.name + " (" + ToString(f.count) + ")"];
      series = series + [f.count]
   end
end;

var chartData = [.
   series = series, categories = categories,
   type = "PIE3DEXPL",
   title = "",
   stitle = "Number of Calls",
   legend = "right",
   width=450,
   height=400
  .];

var refresh = (Wub_GetFunctionInfo("popular").cacherefreshrate ? "");
var html = `<h1>Most Popular Commands</h1><img src="` 
    + WubCall("chart", [chartData]) + `">`;

if refresh != "" then 
   html = html + `<p><small>Statistics refreshed every ` + refresh + `</small>`
end;

NewPiece(html, "text/html");