Class: Renderer

CIQ. Renderer


new Renderer()

Base class for Renderers. A renderer is used to draw a complex visualization based on one or more "series" of data. This is a reusable object. Once defined and attached to a chart, it shouldn’t have to be recreated every time a symbol changed. The series inside the renderers may change with a new symbol, but the linked renderer itself remains the vehicle for adding series.

Classes

Heatmap
Histogram
Lines
Shading

Methods


attachSeries(field, parameters)

Attach a series to the renderer. This assumes that the series data is already in the dataSet and simply connects it to the renderer with the specified parameters. See CIQ.ChartEngine#addSeries for details on how to create a series. See CIQ.ChartEngine.addSeries.

The color defined when attaching a series will supersede any color defined when a series was created. This allows you to attach the same series to multiple renderers, each rendering displaying the same series data in a different color if desired.

Parameters:
Name Type Description
field string

The name of the field. Name of the field in the dataSet to use for the series.

parameters object

Settings to control color and opacity of each series in the group. See CIQ.ChartEngine#addSeries for implementation examples.

Argument format can be:

  • a string containing the color
  • or a more granular object having the following members:

Properties
Name Type Argument Description
fill_color_up string <optional>

Color to use to fill the part when the Close is higher than the previous (#RRGGBB(AA) format or null to not draw)

border_color_up string <optional>

Color to use to draw the border when the Close is higher than the previous (#RRGGBB(AA) format or null to not draw)

opacity_up number <optional>

Opacity to use to fill the part when the Close is higher than the previous (0.0-1.0). Default: .4

fill_color_down string <optional>

Color to use to fill the part when the Close is lower than the previous (#RRGGBB(AA) format or null to not draw)

border_color_down string <optional>

Color to use to draw the border when the Close is lower than the previous (#RRGGBB(AA) format or null to not draw)

opacity_down number <optional>

Opacity to use to fill the part when the Close is lower than the previous (0.0-1.0) default: .4

color string <optional>

Color to use to fill the series if fill_color_up or fill_color_down is not specified (#RRGGBB(AA) format).

permanent boolean <optional>

For line renderers, whether the attached series can be removed by the user. By default the series will not be permanent. This flag (including the default) will supersede the permanent flag of the actual series. As such, a series will not be permanent unless you set this flag to 'true', even if the series being attached was flaged set as permanent when defined. This gives the renderer most control over the rendering process.

Returns:

Returns a copy of this for chaining

Type
CIQ.Renderer
Example
stxx.addSeries("NOK", {display:"NOK",width:4});

		var axis=new CIQ.ChartEngine.YAxis();
		axis.position="left";
		axis.textStyle="#FFBE00";

		var renderer=stxx.setSeriesRenderer(new CIQ.Renderer.Lines({params:{name:"lines", type:"mountain", yAxis:axis}}));

		renderer.removeAllSeries()
			.attachSeries("NOK", "#FFBE00")
			.attachSeries("SNE", "#FF9300")
			.ready();

construct(config)

Default constructor for a renderer. Override this if desired.

Parameters:
Name Type Description
config object

Configuration for the renderer

Properties
Name Type Argument Description
callback function <optional>

Callback function to perform activity post-drawing, for example, creating a legend. It will be called with a 'colors' argument, which will be an array of objects containing the colors used to draw the rendering. ( Example: cb(colors); ). See example for format.

id string <optional>

Handle to access the rendering in the future. If not provided, one will be generated.

params object <optional>

Parameters to control the renderer itself

Properties
Name Type Argument Description
name string <optional>

Name of the renderer. Default: 'Data'. This is used when displaying error message on screen

panel string <optional>

The name of the panel to put the rendering on, defaults to "chart"

overChart boolean <optional>

If set to true, will draw the rendering on top of the chart rather than as an underlay. By default rendering will be as underlay.

yAxis boolean <optional>

Optional Y-axis object to use for the series.

opacity number <optional>

Opacity of the rendering as a whole. Can be overridden by an opacity set for a series. Valid values are 0.0-1.0. Default: 1

Example
stxx.addSeries("NOK", {display:"NOK",width:4});
		stxx.addSeries("SNE", {display:"Sony",width:4});

		var axis=new CIQ.ChartEngine.YAxis();
		axis.position="left";
		axis.textStyle="#FFBE00";

		var renderer=stxx.setSeriesRenderer(new CIQ.Renderer.Lines({params:{name:"lines", type:"mountain", yAxis:axis}}));

		renderer.removeAllSeries()
			.attachSeries("NOK", "#FFBE00")
			.attachSeries("SNE", "#FF9300")
			.ready();

draw()

Perform drawing operations here.


performCalculations()

If your render manages a yAxis then the necessary calculations (high and low) should be made here


ready()

Call this to immediately render the visualization, at the end of a chain of commands.

Returns:

A copy of this for chaining

Type
CIQ.Renderer

removeAllSeries( [eraseData])

Removes all series from the renderer and the yAxis from the panel if it is not being used by any current renderers.

Parameters:
Name Type Argument Default Description
eraseData Boolean <optional>
false

Set to true to erase the actual series data in the CIQ.ChartEngine otherwise it will be retained

Returns:

A copy of this for chaining

Type
CIQ.Renderer

removeSeries(field [, preserveSeries])

Removes a series from the renderer. The yAxis and actual series data will also be removed if no longer used by any other renderers. When the last series is removed from the renderer, the chart it is attached to will remove the renderer.

Parameters:
Name Type Argument Default Description
field string

The field name of the series.

preserveSeries Boolean <optional>
false

Set to true to keep the series data in the CIQ.ChartEngine object.

Since:

  • • 2015-07-01 'preserveSeries' is now available
    • 3.0.0 series is now removed even if series parameter 'permanent' is set to true. The permanent parameter only prevents right click user interaction and not programatically requested removals.
    • 4.0.0 series data is now totally removed from masterData if no longer used by any other renderers.
Returns:

A copy of this for chaining

Type
CIQ.Renderer