Class: Shading

CIQ.Renderer. Shading


new Shading(config)

Creates a Shading renderer This is just like Lines renderer except it will allow shading between lines. Note: by default the renderer will display lines as underlays. As such, they will appear below the chart ticks and any other studies or drawings.

See CIQ.Renderer#construct for parameters required by all renderers

Parameters:
Name Type Description
config Object

Config for renderer

Properties
Name Type Argument Description
params object <optional>

Parameters to control the renderer itself

Properties
Name Type Argument Description
width number <optional>

Width of the rendered line

Common valid parameters for use by attachSeries.:
color - Specify the color for the line and shading in rgba, hex or by name.
pattern - Specify the pattern as an array. For instance [5,5] would be five pixels and then five empty pixels.
width - Specify the width of the line.

Version:
  • ChartIQ Advanced Package

Methods


requestNew(featureList)

Returns a new Shading renderer if the featureList calls for it FeatureList should contain "rangechannel" (draws high and low plots and shades between) Called by CIQ.Renderer.produce to create a renderer for the main series

Parameters:
Name Type Argument Description
featureList array

List of rendering terms requested by the user, parsed from the chartType

config.params object <optional>

Parameters used for the series to be created, used to create the renderer

Since:
  • 5.1.0
Returns:

A new instance of the Shading renderer, if the featureList matches

Type
CIQ.Renderer.Shading

setShading(scheme)

Sets the shading scheme of the renderer

Parameters:
Name Type Description
scheme array

single object or array of objects denoting shading

Properties
Name Type Argument Description
primary string <optional>

left series for comparison; if omitted, use chart.dataSegment[i].Close

secondary string <optional>

right series for comparison; if omitted, use first series in the seriesMap

color string <optional>

color in hex, rgb, rgba, etc to shade between primary and secondary

greater string <optional>

color in hex, rgb, rgba, etc to shade between primary and secondary if primary is greater in price than secondary

lesser string <optional>

color in hex, rgb, rgba, etc to shade between primary and secondary if primary is lesser in price than secondary Note: if scheme.greater or scheme.lesser are omitted, scheme.color is used. At a bare minimum, scheme.color is required. It is not required if scheme.greater and scheme.lesser are supplied. If scheme.primary is omitted, the shading will only occur if the series share the same axis as the chart.dataSegment[i].Close. If shading cannot occur for any reason, series lines will still be drawn.

Version:
  • ChartIQ Advanced Package
Example
renderer.setShading([
	{primary:'ibm', secondary:'ge', greater:'green', lesser:'red'}, // switches shading based on crossover of values
	{primary:'t', secondary:'intc', color:'blue'}, // color always blue between them regardless of which is higher or lower
	{secondary:'t', color:'yellow'}, // compares masterData with the named series
	{color:'yellow'} // automatically shades between master and the first series
]);