Class: BaseRenderer

Oracle.BDD.Portlets.Visualization.Renderers. BaseRenderer

new BaseRenderer()

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.

Oracle.BDD.Portlets.Visualization.Renderers.DonutPieChart = Oracle.BDD.Portlets.Visualization.Renderers.BaseRenderer.extend({
		
   init: function(queryConfig) {
      
      var queryConfig = this.getQueryConfig("eql");	
      this.executeQuery(queryConfig, true, this.renderVisualization);

  },
	
  renderVisualization: function(queryResults) {
  
     // rendering code here
     
  }
});
Source:

Extends

  • Ext.Container

Methods

displayError(err, clear)

Displays the provided error message in the portlet container.
Parameters:
Name Type Description
err string Error message to display. Optional. Displays default error message if none of provided.
clear boolean Indicates if canvas should be cleared
Source:

displayMessage(msg, clear)

Displays the provided message in the portlet container.
Parameters:
Name Type Description
msg string Message to display
clear boolean Indicates if canvas should be cleared
Source:

executeQuery(queryConfig, mask, callback, callbackArgs, errorCallback, errorCallbackArgs)

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
Source:

getCanvas(config, force) → {Canvas}

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 \ element:

var canvas = getCanvas({
   margins: {left: 50, right: 50, top: 100, bottom: 100},
   tagName: 'div'
})
Parameters:
Name Type Description
config Object Canvas configuration object. Optional.
force boolean Forces the re-initialization even if canvas has been rendered. Optional.
Source:
Returns:
The canvas
Type
Canvas

getColorManager(config) → {ColorManager}

Parameters:
Name Type Description
config Object Color Manager configuration object. Optional.
Source:
Returns:
The default ColorMamanger
Color Manager configuration example: 

var colorMgr = getColorManager({
   library: ["#6B486B", "#718BAE", "#ABBE23"],
   scaleDomain: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
});
Type
ColorManager

getQueryConfig(queryName) → {QueryConfig}

Parameters:
Name Type Description
queryName string The queryName.
Source:
Returns:
The QueryConfig
Type
QueryConfig

(abstract) init()

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
     
  }
Source:

refine(queryConfig, tokenName, value, callback, callbackArgs, errorCallback, errorCallbackArgs)

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
Source:

truncateText(svgElmt, width, padding)

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.
Parameters:
Name Type Description
svgElmt SVGElement The SVG element containing the text to truncate
width Number The width to constrain the text to
padding Number Padding to apply. Optional.
Source:

valuesToEql(values, type, isSingleAssign)

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 String The datatype of the attribute
isSingleAssign boolean
Source: