Oracle.BDD.Portlets.Visualization.Renderers.BaseRenderer is the JavaScript
class from which all Custom Visualization renderer classes must extend.
Subclasses of the BaseRenderer must implement the init() function which
servers as the starting point for querying and visualizing data.
The init component is expected to call the executeQuery() function, supplying
it with a queryConfig object acquired with the
{{this.getQueryConfig(queryName)}} function.
Additionally, the executeQuery() function is supplied with a callback
function which takes an Oracle.BDD.Portlets.Visualization.Model.QueryResult
object as its first argument. This function is responsible for the initial
rendering of the visualization using the returned data.
In this example, Oracle.BDD.Portlets.Visualization.Renderers.DonutPieChart
renderer class is defined. It contains the required init() function
implementation that is called when the renderer is first initialized.
In the init() function, the query named "eql" is executed and the results are
passed to the renderVisualization function. The renderVisualization is then
responsible for rendering the visualization with the provided data.
Executes a query against the Dgraph, updates the
renderer's data records and then executes the provided
callback.
Parameters:
Name
Type
Description
queryConfig
QueryConfig
|
string
A QueryConfig object defining the
query to execute or the name of eql query to
execute
mask
boolean
boolean indicating if the load mask
should display until query response is
received.
callback
function
The callback function to execute
after data are updated. Optional.
callbackArgs
primative
|
Object
|
Array.<Object>
An array, object, or primative to
pass through to the callback function as
argument
errorCallback
function
The callback function to execute
in the case of an error response from query.
If not specified, the default error message is
rendered to the canvas. Optional.
errorCallbackArgs
primative
|
Object
|
Array.<Object>
An array, object, or
primative to pass through to the error
callback function as argument
Returns the singleton
Oracle.BDD.Portlets.Visualization.Model.Canvas object
representing the drawing space on which the visualization
is rendered. If the canvas has already rendered, then a
reference to the existing canvas obj is return (and the
config argument is ignored); otherwise a newly
initialized canvas object is returned.
The Canvas configuration object has two properties that
may be configured:
margins: Set the margins of the canvas tagName: By
For example, to set margins and configure the canvas root
to be a
element instead of the default \
wrapped in an \
Parameters:
Name
Type
Description
config
Object
Canvas configuration object. Optional.
force
boolean
Forces the re-initialization even if
canvas has been rendered. Optional.
Utility function to return a value or array of values as
a String formatted for use within an EQL WHERE or HAVING
clause. For example, the values array ["blue', "red",
"green"] returns as {"blue', "red", "green"}.
Parameters:
Name
Type
Description
values
Object
|
Array.<Object>
Value or values to convert
type
Token
The token of the attribute that provided
the values
Required implementation. All subclasses of the
BaseRenderer must implement this function. This function
is called when the renderer is first initialized and
serves as the starting point for the renderer to executes
its initial query for data and define how to respond to
its results. This is accomplished by including a call to
executeQuery in the implementation.
For example:
init: function() {
var queryConfig = this.getQueryConfig("eql");
this.executeQuery(queryConfig, true, this.renderVisualization);
},
renderVisualization: function(queryResults) {
// rendering code here
}
Convenience method to add a refinement and execute the
query in one call. See #addRefinement and
#executeQuery
Parameters:
Name
Type
Description
queryConfig
QueryConfig
A QueryConfig object defining the
query to execute
tokenName
string
The name of the attribute token the
attribute of which the refinement is to apply
value
string
|
Number
|
Array.<Object>
The value(s) to refine by
callback
function
The callback function to execute
after data are updated. Optional.
callbackArgs
primative
|
Object
|
Array.<Object>
An array, object, or primative to
pass through to the callback function as
argument
errorCallback
function
The callback function to execute
in the case of an error response from query.
If not specified, the default error message is
rendered to the canvas. Optional.
errorCallbackArgs
primative
|
Object
|
Array.<Object>
An array, object, or
primative to pass through to the error
callback function as argument
Utility function to truncate text that exceeds the
provided width and appends ellipses to the text. This
would normally be accomplished with CSS (text-overflow:
ellipsis;), but SVG elements do not support this.