page-views



page-views

Generates a graph using Google's charting API representing the page views for every page in a space.

Parameters:
spaces: the space key of the space to get the pages from. (defaults to the current space)
type: the type of graph to display, "p" displays a 2d pie chart, "p3" displays a 3d pie chart. (default is "p3")
height: the height of the generated graph in pixels (defaults to 250)
width: the width of the generated graph in pixels (defaults to 100)
Macro has a body: Macro does not have a body
Body type: Use unprocessed macro body
Macro Output: Macro generates HTML markup
Macro Body:

#set($wiki = "{report-block}
{content-reporter:types=page|spaces=$!paramspaces}
{content-reporter}
{report-body:injected=true}
%page:title%,%track:view count%
{report-body}
{report-block}")
 #set($datasets = $action.helper.renderConfluenceMacro($wiki).split('\n'))
#set($values = "")
#set($labels = "")
#if($paramtype)
    #set($type = $paramtype)
#else
    #set($type = "p3")
#end
#if($paramheight)
    #set($height = $paramheight)
#else
    #set($height = 100)
#end
#if($paramwidth)
    #set($width = $paramwidth)
#else
    #set($width = 250)
#end
#foreach($dataset in $datasets)
#set($dataset = $dataset.replaceAll("<p>",  "").replaceAll("</p>",  ""))
    #set($comma = $dataset.indexOf(","))
    #if($comma > -1)
        #set($curLabel = $dataset.substring(0,$comma))
        #set($comma = $comma+1)
        #set($curValue = $dataset.substring($comma))
        #if($curValue.trim() != "0")
            #if($values != "")
               #set($values = $values + ",")
                #set($labels = $labels + "|")
            #end
            #set($labels = $labels + $curLabel.trim())
            #set($values = $values + $curValue.trim())
        #end
    #end
#end
<img class="googlechart" src="http://chart.apis.google.com/chart?cht=${type}&chd=t:${values}&chs=${width}x${height}&chl=${labels}"/>

Required Plugins:

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.