API Docs for: 0.6.0
Show:

sgvizler.container Class

Defined in: src/container.js:2

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

Methods

getChartAttributes

(
  • elementID
)
Object private

Defined in src/container.js:128

Available since 0.2

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 String

    The ID for which the attributes should be collected.

Returns:

Object:

List of name--value pairs.

getQueryAttributes

(
  • elementID
)
Object private

Defined in src/container.js:104

Available since 0.2

Collects values designated for sgvizler in the given element---by element id.

See also property PREFIX.

Parameters:

  • elementID String

    The ID for which the attributes should be collected.

Returns:

Object:

List of name--value pairs.

loadDependenciesOnPage

(
  • [strFunctions]
)
private

Defined in src/container.js:170

Available since 0.6.0

Finds all sgvizler-containers on the page and loads their dependencies in one go.

Parameters:

  • [strFunctions] Array | String optional

    Array (or just a single string) of function names to get in addition to the functions specifies in sgvizler-containers.

Properties

PREFIX

String private final

Defined in src/container.js:49

Available since 0.2

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

Defined in src/container.js:63

Available since 0.2

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

Defined in src/container.js:77

Available since 0.2

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

Defined in src/container.js:90

Available since 0.2

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.