new MarketDepth(config)
Creates a market depth renderer.
See CIQ.Renderer#construct for parameters required by all renderers
This renderer has three unique config options: step, mountain, and volume, all of which are independent of each other.
stepIf set, will draw the connections between the data points as steps rather than curved lines.mountainIf set, will shade in the area under the plots rather than just drawing the line.volumeIf set, will draw a histogram at each data point for which there is volume.
This renderer does not allow panning interaction with the chart.
Requires Active Trader plugin. See CIQ.ChartEngine#updateCurrentMarketData for data requirements
See CIQ.ChartEngine#drawMarketDepth for color parameters and usage examples.
Here is sample JSFiddle illustrating how to render a stand-alone Market Depth chart:
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object | Config for renderer Properties
|
- Version:
-
- ChartIQ Active Trader Package
- Since:
-
- 6.1.0
- 6.3.0 Added
headsUpparameter.
Methods
-
displayPrice(stx, context, style, price, spread)
-
Displays the current price and the spread on the top center section of the chart.
This function may be overridden to customize the price display. To suppress the display simply override this function to do noting but return.
Note: Only called if 'Last' price is included on data object.
Parameters:
Name Type Description stxCIQ.ChartEngine Chart engine object
contextexternal:CanvasRenderingContext2D HTML5 canvas context
styleobject css style to display price (font and lineHeight)
pricestring last price
spreadstring bid-ask distance
- Version:
-
- ChartIQ Active Trader Package
- Since:
-
6.3.0
Examples
This is the default function
CIQ.Renderer.MarketDepth.displayPrice = function (stx, context, style, price, spread) { var width = stx.chart.width; context.textAlign = "center"; context.fillStyle = style.color; context.save(); context.font = style.fontStyle + " " + style.fontVariant + " " + style.fontWeight + " " + style.fontSize + "/" + style.lineHeight + " " + style.fontFamily.replace(/"/g, ""); context.fillText(price, width / 2, 30); context.restore(); if (spread.length) context.fillText(stx.translateIf("Spread") + ": " + spread, width / 2, 60); };This example disables the display of the price box
CIQ.Renderer.MarketDepth.displayPrice = function (stx, context, style, price, spread) { return; };
