Class: Chart

CIQ.ChartEngine. Chart


new Chart()

Defines an object used for rendering a chart and is automatically created by the CIQ.ChartEngine. Chart objects contain the data and config for each chart but they don't actually exist on the screen until a panel is attached. A chart object is attached to both the main chart panel and any related study panels so they can share the same chart data.

Example: stxx.panels['chart'].chart

Example: stxx.chart (convenience shortcut for accessing the main chart object - same as above)

Example stxx.panels['Aroon (14)'].chart

Members


allowScrollFuture :boolean

If set to false, the chart will be anchored on right side preventing white space to be created beyond the newest tick. If both CIQ.ChartEngine.Chart#allowScrollPast and CIQ.ChartEngine.Chart#allowScrollFuture are set to false, allowScrollFuture will take precedence if the candle is manually set to create space, but automated zoom operations (CIQ.ChartEngine#zoomOut) will maintain both scroll restrictions.

Type:
  • boolean
Default Value:
  • true

allowScrollPast :boolean

If set to false, the chart will be anchored on left side preventing white space to be created past the oldest tick. If both CIQ.ChartEngine.Chart#allowScrollPast and CIQ.ChartEngine.Chart#allowScrollFuture are set to false, allowScrollFuture will take precedence if the candle is manually set to create space, but automated zoom operations (CIQ.ChartEngine#zoomOut) will maintain both scroll restrictions.

The amount of white space allowed on the right will be limited by CIQ.ChartEngine#minimumLeftBars

Type:
  • boolean
Default Value:
  • true

barsHaveWidth :boolean

Whether chart's main renderer's bars have width, as opposed to a line-type chart whose "bars" are just a point on the chart. This is useful when the engine adjusts the chart for smooth scrolling and homing.

Type:
  • boolean
Since:
  • 5.1.0

baseline :object

Parameters used to control the baseline in baseline_delta charts

Type:
  • object

baseline[`actualLevel`] :number

actualLevel - This is computed automatically. Do not set.

Type:
  • number

baseline[`defaultLevel`] :number

defaultLevel - If set to a value, overrides the default behavior of baseline chart which is to set baseline to leftmost point visible on the chart.

Type:
  • number

baseline[`includeInDataSegment`] :boolean

includeInDataSegment - If set to true, forces a line chart (usually a baseline chart) to begin inside the chart, whereas normally the first point in a line chart is off the left edge of the screen.

Type:
  • boolean

baseline[`userLevel`] :boolean|number

userLevel - Value of the user-set baseline level. To prevent user from adjusting the baseline, set this property to false.

Type:
  • boolean | number

customChart :object

This structure is used to temporarily override the layout.chartType. It can also be used to override the coloring function used when drawing bars, candles, etc.

Expected format :

    customChart={chartType:myChartType, colorFunction: myColorFunction}

    myChartType is any valid chartType
    myColorFunction needs to support the following parameters: stx, quote, mode
    Example: myColorFunction(stx,quote,mode)

    Parameters:

    CIQ.ChartEngine stx    - A chart object
    {object} quote    - A properly formatted OHLC object.
    {string} mode    - Applicable on 'candle', 'hollow_candle' and 'volume_candle' charts only. Allowed values: "shadow", "outline", and "solid".
                        `shadow`- indicates the function is asking for the candle wick color
                        `outline` indicates the function is asking for the candle border color
                        `solid` indicates the function is asking for the candle fill color
                                    (Inside of candle. Not applicable on 'hollow_candle' or 'volume_candle')

    Returns:

    {string|object} Color to use for the bar, candle or line segment component. Set to null to skip bar or line segment.
    For colored line charts a color/pattern combination can be returned in an object of the follwing format: `{pattern:[3,3],color:"red"}`

You may omit either of the properties to default to existing settings. Note: After setting the chartType property, it is necessary to call stx.setMainSeriesRenderer() to change the chart rendering.

To restore the original chart settings, set this object to null (and call setMainSeriesRenderer() if necessary)

See Chart Styles and Types for more details.

Type:
  • object
Example
stxx.chart.customChart={colorFunction: function(stx, quote, mode){
		if(mode=="shadow" || mode=="outline") return "black";  //draw black wicks and borders
		else{
			if(quote.Close>100) return "green";
			else if(quote.DT.getHours()<12) return "yellow";
			else return "orange";
		}
		return null;
	  }
	};

dataSegment :array

Contains the segment of the data set that is displayed on the screen (view-window). See the Data Integration tutorial for details.

Type:
  • array

dataSet :array

Contains the current complete data set created by CIQ.ChartEngine#createDataSet, adjusted for periodicity and with calculated studies. See the Data Integration tutorial for details.

Type:
  • array

decimalPlaces :number

Maximum number of decimal places in data set. Computed automatically by calculateTradingDecimalPlaces

Type:
  • number

defaultChartStyleConfig :object

For chart types which have configuration settings (such as the aggregate charts renko, kagi, etc) contains those default settings. This object holds the settings for the current chart type only.

Type:
  • object
Since:
  • 3.0.0
Default Value:
  • {}

defaultPlotField :string

For line and mountain type charts set this to a value other than "Close" to have those chart types plot a different field.

Type:
  • string
Since:
  • 3.0.0
Default Value:
  • Close

dynamicYAxis :boolean

Flag for determining whether yAxes will automatically determine a width based on the text length of quotes in a dataSet. Works on all axis attached to a chart.

Type:
  • boolean
Since:
  • 5.1.1

gaplines :object

READ ONLY. Gap filling style for the chart (line/mountain chart types only). Set by using CIQ.ChartEngine#setGapLines.

Type:
  • object
Since:
  • 4.0.0

hideDrawings :boolean

Set to true to temporarily hide drawings

Type:
  • boolean

highLowBars :boolean

Whether chart's main renderer's bars plot more than one data field (OHLC charts). When this is true, will disable the use of CIQ.ChartEngine.Chart#defaultPlotField.

Type:
  • boolean
Since:
  • 5.1.0

includeOverlaysInMinMax :boolean

Set this to true to include the chart overlay/study values in the calculation to determine the high and low values for the chart. This may cause the chart to shrink vertically to ensure all study/overlay data is in view. Setting it to false, will maintain the current candle's height, but some of the study/overlay data may be out of the display range.

Type:
  • boolean
Since:

  • • 2016-12-01.4.13
    • 3.0.10 switched default to true
Default Value:
  • true

legendRenderer :function

Function used to render the Legend when multiple series are being displayed on the main chart panel. Update your prototype or a specific chart instance, if you want to use a different rendering method for legend. See CIQ.drawLegend for details and function signature.

Defaults to CIQ.drawLegend

Type:
  • function
Since:
  • 07/01/2015
Example
stxx.chart.legendRenderer = yourFunction; // must follow the function signature of CIQ.drawLegend;

lineApproximation :boolean

When candleWidth<1, setting to true will create approximation of a line chart to improve rendering performance.

Must allow for smaller candle sizes by lowering CIQ.ChartEngine#minimumCandleWidth and allow for larger dataset by increasing CIQ.ChartEngine#maxDataSetSize or setting it to 0.

Type:
  • boolean
Since:
  • 4.1.0
Default Value:
  • true

lineStyle :object

READ ONLY. Style for the main series renderer. Set by using CIQ.ChartEngine#setLineStyle.

Type:
  • object
Since:
  • 4.0.0

lockScroll :boolean

Set this to true to turn off auto-scrolling when fresh data comes in. By default, the chart will scroll backward whenever a new bar comes in, so as to maintain the chart's forward position on the screen. If lockScroll is true then fresh bars with advance the chart forward (and eventually off the right edge of the screen)

Note that setSpan({base:"today"}) will set an internal variable that accomplishes the same thing. This is a unique case.

Type:
  • boolean
Since:
  • 05-2016-10

masterData :array

The master data for this chart. This data is never modified by the chart engine itself and should not be altered directly. Use CIQ.ChartEngine#setMasterData , CIQ.ChartEngine#updateChartData to manipulate this object. See the Data Integration tutorial for details.

Type:
  • array

maxTicks :number

Will contain the maximum number of bars that can be displayed on the chart. This number is auto-computed by the ChartEngine when the user zooms or the size of the chart changes. Since charts can pan slightly off the edge of the screen, this number is width/candleWidth + 2 in order allow partial candles to be displayed on both edges.

Type:
  • number

scroll :number

Current number of ticks scrolled in from the end of the chart. Setting to zero would theoretically cause the chart to be scrolled completely to the left showing an empty canvas. Setting to 10 would display the last 10 candles on the chart. Setting to maxTicks would display a full screen on the chart (assuming enough data is available).

Type:
  • number

scrubbed :array

Contains a copy of the dataSet, scrubbed for null entries (gap dates). This is used by studies to avoid gaps being interpreted as "zero" values and throwing off calculations.

Type:
  • array

segmentImage :array

Contains data pertaining to variable width candles, used to determine location of bars on the screen

Type:
  • array

series :object

Contains information about the series that are associated with the chart. Series are additional data sets, such as used for comparison charts. Note that a series may have a different y-axis calculation than the price chart. See the "parameters" section of CIQ.ChartEngine#addSeries for details

Type:
  • object

seriesRenderers :object

Contains "renderers" that are used to create the visualizations for series.

Type:
  • object

standaloneBars :boolean

Whether chart's main renderer's bars represent a stand-alone entity as opposed to a vertex in a line-type chart. This is important when the engine tries to render the data points right off the chart; in a stand-alone bar, the points right off the chart need not be considered.

Type:
  • boolean
Since:
  • 5.1.0

symbol :string

The current symbol for the chart

Type:
  • string

symbolDisplay :string

Set this to presnet an alternate name for the symbol on the chart label and comparison legend. You can set stxx.chart.symbolDisplay='yourName'; right before calling newChart(). Alternatively, a good place to set it is in your fetch() function, if using CIQ.QuoteFeed. See example.

Type:
  • string
Example
// on your fetch initial load add the following
params.stx.chart.symbolDisplay='yourName for '+params.symbol;

symbolObject :object

The current symbolObject for the chart. Generally this is simply {symbol: symbol}. This is initialized by CIQ.ChartEngine#newChart.

Type:
  • object

tension :number

Set to a value between 0 and 1 to soften the curves on a line or mountain chart.

This only affects the primary chart series. For setting tension on additional series see CIQ.ChartEngine#addSeries

Type:
  • number

xAxis :CIQ.ChartEngine.XAxis

Contains the {@CIQ.ChartEngine.XAxis} object for the chart.

Type:

xaxis :array

Contains data entries for the full xaxis, including entries for "future" bars that are displayed on the chart. floatDate and headsUp use these values for display to the user. It is a superset of dataSegment.

Type:
  • array

xaxisFactor :number

Determines at which zoom level interior axis points are displayed. Value in pixels.

Type:
  • number
Default Value:
  • 30

yaxisPaddingLeft :number

How much padding to leave for the left y-axis. Default is enough for the axis. Set to zero to overlap y-axis onto chart.

Type:
  • number
Since:
  • 07/01/2015

yaxisPaddingRight :number

How much padding to leave for the right y-axis. Default is enough for the axis. Set to zero to overlap y-axis onto chart.

Type:
  • number
Since:
  • 07/01/2015