Source: site.view [edit]
Function name: activeUsageGraph
Arguments:
Description: Sample usage log for Active
Page type: webl
Render function:  
Module: global

Page source:

var weeks = [`2/24/08`, `3/02/08`, `3/09/08`, `3/16/08`];

// Total number of registered users (will always increase)
var numTotalUserAccounts = [8,10,11, 12];

// How many unique users used the system this week
var numUsersThisWeek = [7,8,4,5];

// Frequent users: who this week also used it last week?
var numFrequentUsersThisWeek = [4,6,3,2];

// Longterm users: who this week also had requests more than 30 days ago?
var numLongTermUsersThisWeek = [6,7,4,3];

var numQueries = [63,40,20,34];

// 
var percentInScope = [63,67,70,69];

var percentAccurate = [77,85,88,86];

var percentUptime = [100, 100, 99, 100];

var avgResponseTime = [5.6,6.0, 4.43, 3.4];
var avgInitialTime = [1.6,1.2, 1.3, 1.6];



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

var chartData = [.
   categories = weeks,

   stitle = "Registered Users",
   series = numTotalUserAccounts, 

   stitle2 = "Unique Users This Week",
   series2 = numUsersThisWeek,

   stitle3 = "Frequent Users This Week",
   series3 = numFrequentUsersThisWeek,

   stitle4 = "Longterm Users This Week",
   series4 = numLongTermUsersThisWeek,

   type = "LINE",
   title = "Usage Metrics (# Users/wk)",
   legend = "right",
   width=900,
   height=400
  .];

var html = `<h1>Active Usage Reports</h1><h2>Usage Metrics</h2><img src="` 
    + WubCall("chart", [chartData]) + `"></td>`;

chartData.stitle = "Avg Total Response Time";
chartData.series = avgResponseTime;
chartData.stitle2 = "Avg Initial Response Time";
chartData.series2 = avgInitialTime;
chartData.stitle3 = "";
chartData.series3 = [];
chartData.stitle4 = "";
chartData.series4 = [];
chartData.title = "Response Time (Secs)";
html = html + `<H2>System Performance Metrics</H2><img src="` 
    + WubCall("chart", [chartData]) + `">`;


chartData.stitle = "Coverage %";
chartData.series = percentInScope;
chartData.stitle2 = "Accuracy %";
chartData.series2 = percentAccurate;
chartData.stitle3 = "Uptime %";
chartData.series3 = percentUptime;
chartData.stitle4 = "";
chartData.series4 = [];
chartData.title = "System Peformance Metrics (percentage)";
html = html + `<H2>System Performance Metrics</H2><img src="` 
    + WubCall("chart", [chartData]) + `">`;

/************************************/


var domains = ["Restaurants", "Booking", "Movies", "Hotels", "Local Search", "Flights", "Weather", ""];

var numRequestsPerDomain = [342, 24, 203, 182, 623, 52, 121, 0];

chartData = [.
   categories = domains,

   stitle = "Requests per Domain",
   series = numRequestsPerDomain, 

   type = "BAR",
   title = "Requests per Domain",
   // legend = "right",
   width=900,
   height=400
  .];

html = html + `<H2>Domain Metrics</H2><img src="` 
    + WubCall("chart", [chartData]) + `">`;

NewPiece(html, "text/html");