Graphing Service

#start graph with the {|GRAPH|} command{|GRAPH|}
#indicates that we want a 'bar' type graph (b)
graph/t/b
#makes the title of the graph blank
/n/%20
#graph should be 380 pixels wide
/w/380
#graph should be 250 pixels high
/h/250
#data is made up of entire-datatype averages of all 'percent_score' type properties
/d/{|LOOP|DATATYPES.SHOW_DATATYPE.PROPERTIES(FILTER=type|eq|percent_score,SORT=ORDER_NUM)}
{AVG(PROPERTIES.VALUE).NUMBERFORMAT(2)}{LOOP.HASNEXT?,}
{/|LOOP|}
#indicates color scheme for graph
/c/803380
#sets the axis range from 0 to 100
/r/0,100
#formats the y axis with percentages
/f/xp
#apikey required for authentication
?apikey={CONFIG.PDF_API_KEY}
#adds labels to the bars
#this is in the query string to avoid character encoding issues
&l={|LOOP|DATATYPES.SHOW_DATATYPE.PROPERTIES(FILTER=type|eq|percent_score,SORT=ORDER_NUM)}
{PROPERTIES.NAME.SUBSTR(0,-14).FUSIONSAFE}{LOOP.HASNEXT?,}
{/|LOOP|}
{/|GRAPH|}
HighCharts
<div id='my-graph'>{|HIGHCHARTS|}
{
#vertical bar charts are of type 'column'
#our graph is 800x250 pixels
"chart": {
"type": "column",
"height": 250,
"width": 800
},
#the graph's title
"title": {
"text": "Average Scores",
"x": -20
},
#y axis settings
"yAxis": {
"title": {
"text": ""
},
"min": 0,
"max": 100
},
#with only one series, a legend is unnecessary
"legend": {
"enabled": false
},
#hide the highcharts label
"credits": {
"enabled": false
},
#don't animate our graph
"plotOptions": {
"column": {
"animation": false
}
},
"xAxis":
{
#the x axis labels - one for each property
"categories": [{|LOOP|DATATYPES.SHOW_DATATYPE.PROPERTIES(FILTER=type|eq|percent_score,SORT=ORDER_NUM)}
#HC_SAFE_STRING handles escaping quotes - names need quotes around them
"{PROPERTIES.NAME.SPLIT(:,1)?|EVALTAG(PROPERTIES.NAME.SPLIT(:,1).HC_SAFE_STRING)|:|EVALTAG(PROPERTIES.NAME.HC_SAFE_STRING)|}"{LOOP.HASNEXT?,}
{/|LOOP|}
]
},
#single series
"series": [
{
"name": "Average Score",
#our actual data - HC_SAFE_NUMBER handles null values
"data": [{|LOOP|DATATYPES.SHOW_DATATYPE.PROPERTIES(FILTER=type|eq|percent_score,SORT=ORDER_NUM)}
{AVG(PROPERTIES.VALUE).NUMBERFORMAT(2).HC_SAFE_NUMBER}{LOOP.HASNEXT?,}
{/|LOOP|}
]
}
]
}
{/|HIGHCHARTS|}
</div>
