-
<static, readonly> version :string
-
Gets chart version.
Type:
-
-
An array of chart panels.
Type:
-
-
The chart panels container.
Type:
-
<readonly> container :jQuery
-
The chart's parent container.
Type:
-
-
The cross hair object.
Type:
-
-
The cross hair type.
Type:
-
-
The data manager (manages data series).
Type:
-
-
The date scale.
Type:
-
<readonly> firstVisibleIndex :number
-
Gets index of first visible record.
Type:
-
firstVisibleRecord :number
-
The first visible record.
Type:
-
-
The array of chart indicators.
Type:
-
instrument :Instrument
-
The instrument.
Type:
Example
chart.instrument = {
symbol: 'GOOG',
company: 'Google Inc.'
exchange: 'NSDQ'
};
-
isInFullWindowMode :boolean
-
Determines whether chart is in 'full window' mode.
Type:
- See:
-
-
keyboardEventsEnabled :boolean
-
The flag that indicates whether keyboard events should be processed.
Type:
- Default Value:
-
Example
chart.keyboardEventsEnabled = true; // enable keyboard events
chart.keyboardEventsEnabled = false; // disable keyboard events.
-
<readonly> lastVisibleIndex :number
-
Gets index of last visible record.
Type:
-
lastVisibleRecord :number
-
The last visible record.
Type:
-
locale :string
-
The locale string (e.g. 'en-US').
Type:
- Default Value:
-
- See:
-
Example
chart.locale = 'uk-UA';
-
-
The main chart panel.
Type:
-
-
The price style.
Type:
- See:
-
Example
chart.priceStyle = StockChartX.PriceStyle.BAR; // set 'bars' price style.
-
<readonly> recordCount :number
-
The number of records on the chart.
Type:
-
-
The currently selected object.
Type:
-
showDrawings :boolean
-
The flag that indicates whether drawings should be drawn.
Type:
- Default Value:
-
-
-
The size of chart.
Type:
-
theme :Object
-
The chart theme.
Type:
-
timeInterval
-
The bars time interval in milliseconds.
- See:
-
Example
chart.timeInterval = StockChartX.TimeSpan.MILLISECONDS_IN_DAY; // set 1 day time interval
chart.timeInterval = StockChartX.TimeSpan.MILLISECONDS_IN_HOUR * 4; // set 4 hours time interval
-
-
The value scale.
Type:
-
addChartPanel(index, heightRatio, shrinkMainPanel)
-
Adds new chart panel.
Parameters:
Name |
Type |
Argument |
Description |
index |
Number
|
<optional>
|
The index to insert panel at. |
heightRatio |
Number
|
<optional>
|
The height ratio of new panel. The value in range (0..1). |
shrinkMainPanel |
Boolean
|
<optional>
|
True to shrink main panel, false to shrink all panels. |
Returns:
The newly created chart panel.
-
Type
-
StockChartX.ChartPanel
Example
chart.addChartPanel(); // Add new chart panel.
chart.addChartPanel(2); // Insert new chart panel at index 2.
-
addIndicators(indicators)
-
Adds one or more indicators.
Parameters:
- See:
-
Returns:
Added indicators.
-
Type
-
StockChartX.Indicator
|
Array.<StockChartX.Indicator>
Examples
Add bollinger bands indicator
var bollingerBandsIndicator = chart.addIndicators(BollingerBands);
Add RSI and Bollinger bands indicators.
var indicators = chart.addIndicators([RelativeStrengthIndex, BollingerBands]);
Configure and add indicator.
var rsi = new StockChartX.TAIndicator({taIndicator: RelativeStrengthIndex});
rsi.setParameterValue(StockChartX.IndicatorParam.PERIODS, 20);
chart.addIndicators(rsi);
-
addValueScale(valueScale)
-
Adds new value scale.
Parameters:
Returns:
StockChartX.ValueScale
-
appendBars(bars)
-
Appends values from single bar or an array of bars into the corresponding data series.
Parameters:
Name |
Type |
Description |
bars |
Bar
|
Array.<Bar>
|
The single bar or an array of bars. |
Example
// Append 1 bar
chart.appendBars({
date: new Date(),
open: 100.0,
high: 101.0,
low: 99.0,
close: 100.5,
volume: 200
});
// Append 2 bars
chart.appendBars({
[
{
date: new Date(),
open: 100.0,
high: 101.0,
low: 99.0,
close: 100.5,
volume: 200
},
{
date: new Date(),
open: 100.5,
high: 101.0,
low: 100.0,
close: 100.2,
volume: 300
}
]
});
-
barDataSeries()
-
Returns bar data series.
Returns:
An object with date, open, high, low, close, volume properties.
-
Type
-
StockChartX.BarDataSeries
Example
var obj = chart.barDataSeries();
var dates = obj.date; // Date data series
var opens = obj.open; // Open data series
var highs = obj.high; // High data series
var lows = obj.low; // Low data series
var closes = obj.close; // Close data series
var volumes = obj.volume; // Volume data series
-
cancelUserDrawing()
-
Cancels user drawing.
- See:
-
Example
chart.cancelUserDrawing();
-
clearDataSeries(dataSeries)
-
Removes all values from a given data series. Clears all values in all data series if parameter is omitted.
Parameters:
Name |
Type |
Argument |
Description |
dataSeries |
String
|
StockChartX.DataSeries
|
<optional>
|
The data series name or data series object. |
-
dateRange(startDate, endDate)
-
Updates visible range to show values in a given date range.
Parameters:
Name |
Type |
Argument |
Description |
startDate |
Date
|
<optional>
|
The start date. |
endDate |
Date
|
<optional>
|
The end date. |
-
draw()
-
Draws chart.
-
findDataSeries(suffix)
-
Finds data series with a given suffix.
Parameters:
Name |
Type |
Description |
suffix |
String
|
The data series suffix. |
Returns:
-
Type
-
StockChartX.DataSeries
Example
var dataSeries = chart.findDataSeries(StockChartX.OPEN_DATA_SERIES_SUFFIX);
-
findPanelAt(y)
-
Returns chart panel at a given Y coordinate.
Parameters:
Name |
Type |
Description |
y |
number
|
The Y coordinate. |
Returns:
-
Type
-
StockChartX.ChartPanel
-
getBounds()
-
Returns chart bounds rectangle.
Returns:
-
Type
-
StockChartX.Rect
-
getCommonDataSeries()
-
Returns bar data series.
- Deprecated:
-
Returns:
-
Type
-
StockChartX.BarDataSeries
-
getDataSeries(name)
-
Returns data series with a given name.
Parameters:
Name |
Type |
Description |
name |
String
|
The data series name. |
Returns:
-
Type
-
StockChartX.DataSeries
Example
var dataSeries = chart.getDataSeries("OpenInterest");
-
layout()
-
Layouts chart elements.
-
loadDrawingsState(state)
-
Loads drawings.
Parameters:
Name |
Type |
Description |
state |
String
|
Object
|
The drawings state serialized by saveDrawingsState function. |
- See:
-
Example
var state = chart.saveDrawingsState();
chart.loadDrawingsState(state);
-
-
Loads indicators state.
Parameters:
Name |
Type |
Description |
state |
String
|
Object
|
The indicators state serialized by saveIndicatorsState function. |
- See:
-
Example
<caption>Save and load indicators state</caption
var state = chart.saveIndicatorsState();
chart.loadIndicatorsState(state);
-
loadState(state)
-
Loads chart state.
Parameters:
Name |
Type |
Description |
state |
String
|
Object
|
The chart state serialized by saveState function. |
- See:
-
Example
var state = chart.saveState();
chart.loadState(state);
-
recordRange(firstRecord, lastRecord)
-
Updates visible range to show records in a given range.
Parameters:
Name |
Type |
Argument |
Description |
firstRecord |
number
|
|
The first record to show. Or number of last records to show if second argument is omitted. |
lastRecord |
number
|
<optional>
|
The last record to show. |
-
removeDataSeries(dataSeries)
-
Removes given data series. Removes all data series if parameter is omitted.
Parameters:
Name |
Type |
Argument |
Description |
dataSeries |
String
|
StockChartX.DataSeries
|
<optional>
|
The data series object or data series name. |
Example
chart.removeDataSeries('OpenInterest'); // Removes 'OpenInterest' data series.
chart.removeDataSeries(); // Removes all data series.
-
removeDrawings()
-
Removes all drawings.
- See:
-
Example
chart.removeDrawings();
-
removeIndicators(indicators, removePanelIfNoPlots)
-
Removes one or more indicators.
Parameters:
Name |
Type |
Argument |
Description |
indicators |
StockChartX.Indicator
|
Array.<StockChartX.Indicator>
|
<optional>
|
Indicator(s) to remove. All indicators are removed if omitted. |
removePanelIfNoPlots |
boolean
|
<optional>
|
The flag that indicates if panel should be removed if there are no plots on it any more. True by default. |
- See:
-
Examples
Remove all indicators from the chart.
chart.removeIndicators();
Remove RSI indicator
// Assume that rsi indicator was added already.
// var rsi = chart.addIndicators(RelativeStrengthIndex);
chart.removeIndicators(rsi);
Remove all indicators
chart.removeIndicators();
-
saveDrawingsState()
-
Saves all drawings.
- See:
-
Returns:
The array of drawing states.
-
Type
-
Array.<Object>
Example
var state = chart.saveDrawingsState();
-
saveImage(saveCallback)
-
Saves chart as image.
Parameters:
Name |
Type |
Argument |
Description |
saveCallback |
CanvasImageCallback
|
<optional>
|
The callback for custom saving. |
-
-
Saves indicators state.
- See:
-
Returns:
An array of indicator states.
-
Type
-
Array.<Object>
Example
var state = chart.saveIndicatorsState();
-
saveState()
-
Saves chart state (including indicators and drawings).
- See:
-
Returns:
The chart state.
-
Type
-
Object
Example
var state = chart.saveState();
-
-
Scrolls chart on a given number of pixels.
Parameters:
Name |
Type |
Description |
pixels |
number
|
The number of pixels to scroll. |
-
-
Scrolls chart on a given number of records.
Parameters:
Name |
Type |
Description |
records |
number
|
The number of records to scroll. |
-
selectObject(obj)
-
Selects new chart object. E.g. drawing.
Parameters:
Returns:
True if selection is changed, false otherwise.
-
Type
-
boolean
-
setNeedsAutoScale()
-
Marks that all value scales need to be auto-scaled on next layout.
-
setNeedsAutoScaleAll()
-
Marks that auto-scaling needs to be performed on next layout (affects all scales, including date scale).
-
startUserDrawing(drawing)
-
Starts new user drawing.
Parameters:
- See:
-
Example
var line = new StockChartX.LineSegmentDrawing();
chart.startUserDrawing(line);
-
toggleFullWindow()
-
Enters/Exits full window mode.
-
trimDataSeries(maxLength)
-
Trims all data series to a given maximum length.
Parameters:
Name |
Type |
Description |
maxLength |
number
|
The new maximum length of data series. |
-
update()
-
Layouts and draws chart.
-
updateIndicators()
-
Updates all indicators. It needs to be called after data series values are changed.
- See:
-
Example
chart.updateIndicators();
-
zoomOnPixels(pixels)
-
Zooms chart on a given number of pixels.
Parameters:
Name |
Type |
Description |
pixels |
number
|
The number of pixels to zoom. |
-
zoomOnRecords(records)
-
Zooms chart on a given number of records.
Parameters:
Name |
Type |
Description |
records |
number
|
The number of records to zoom. |