sgvizler.container Class
Draws charts specified in HTML containers, here we call them "sgvizler-containers".
Example of use: The following sgvizler-container will be
selected by sgvizler due to the use of designated
attributes. The result is a pie chart (draw with
google.visualization.PieChart
) showing the number of instance
per class in the endpoint at
http://sws.ifi.uio.no/sparql/ndp
.
<div id="ex1"
data-sgvizler-endpoint="http://sws.ifi.uio.no/sparql/npd"
data-sgvizler-query="SELECT ?class (count(?instance) AS ?noOfInstances)
WHERE{ ?instance a ?class }
GROUP BY ?class
ORDER BY ?class"
data-sgvizler-chart="google.visualization.PieChart"
style="width:800px; height:400px;"></div>
These container must have an id attribute (or else sgvizler will not know where to put the chart) and a query attribute (or else the container will be ignored by sgvizler).
Dependencies:
- sgvizler.util
- sgvizler.loader
- sgvizler.logger
- sgvizler.Query
- jQuery
Item Index
Properties
Methods
getChartAttributes
-
elementID
Collects values designated for sgvizler, and which are options to the chart function, in the given element---by element id.
See also property CHARTPREFIX.
Parameters:
-
elementID
StringThe ID for which the attributes should be collected.
Returns:
List of name--value pairs.
getQueryAttributes
-
elementID
Collects values designated for sgvizler in the given element---by element id.
See also property PREFIX.
Parameters:
-
elementID
StringThe ID for which the attributes should be collected.
Returns:
List of name--value pairs.
loadDependenciesOnPage
-
[strFunctions]
Finds all sgvizler-containers on the page and loads their dependencies in one go.
Properties
PREFIX
String
private
final
The prefix of attributes which values designated for
sgvizler should be given. Currently data-sgvizler-
.
Note that data-
prefixed attribute names is valid
HTML5.
PREFIXCHART
String
private
final
The prefix of attributes which values designated for
sgvizler and which are sent to the chart function
should be given. Currently
data-sgvizler-chart-options
.
VALUEASSIGN
String
private
final
In attributes where multiple values may be given the properties VALUEASSIGN and VALUESPILT decides how to parse the attribute value into multiple name--value pairs.
VALUESPILT
String
private
final
In attributes where multiple values may be given the properties VALUEASSIGN and VALUESPILT decides how to parse the attribute value into multiple name--value pairs.