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 STX.Renderer#construct for parameters required by all renderers
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object | Config for renderer Properties
|
Methods
-
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.
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 ]);