Trading chart main class.

Hierarchy

  • TradingChart

Methods

addDataArray addDataPoint addHeatmap addSecondarySymbol addSymbolSearchResults changeTimeRange clearData clearEverything convertDateTimeToIndex convertIndexToDateTime createSaveString disposeAllHeatmaps drawingTools enableCandleAutoWidth enableDataPointLimit enableEffects enableMountainGradient enableShowToolbarButton enableXAxisRestrictions enableYAxisRestrictions getCurrentSymbol getData getDataPadding getDataPointArray getInternalChart getKagiInstance getOpenInterestData getPointAndFigureInstance getPointCount getRenkoInstance getSearchButton getSearchInput getSymbolSearchResultTable getTimeRange getTimeRangeSelection getVolumeData getZoomBandChart indicators layout loadCsvString loadPreviousSettings loadTemplate menuOptions offChartClicked offClearEverything offDataModified offPointerDown offPointerMove offPointerUp offXAxisRangeChanged offYAxisRangeChanged onChartClicked onClearEverything onDataModified onPointerDown onPointerMove onPointerUp onXAxisRangeChanged onYAxisRangeChanged remove restoreDefaultBackground restoreDefaultSettings saveAsTemplate setAxisAlignment setAxisColor setBackgroundColor setBackgroundImage setBorderColor setChartTitle setColorTheme setCurrency setData setDataPacking setDataPadding setDataPointLimit setLatestValueLabelType setLineColor setNegativeBodyColor setNegativeWickColor setOHLCCursorTracking setOpenInterestData setPanningButton setPercentScale setPositiveBodyColor setPositiveWickColor setPriceChartType setRectangleZoomingButton setResultTablePosition setSeriesBackgroundColor setSplitterColor setTimeRange setTransparentChart setVerticalPanning setVerticalZooming setVolumeData setWatermarkText setWheelZooming setXAxisLeftButtonInteraction setXAxisRightButtonInteraction setYAxisLeftButtonInteraction setYAxisRightButtonInteraction setZoomingSensitivity showChartBorder showChartTitle showFileSelection showHorizontalCursorLine showIndicatorButtons showSearchbar showSplitterLines showSymbolWatermark showThemeImage showToolbar showValueLabels showVerticalCursorLine showZoomBandChart updateLastDataPoint zoomToFit zoomToRange

Methods

  • Adds an array of data points to the end of the existing data, or to an empty chart. Allows scrolling data for real-time applications.

    Given DateTime values should be newer than the current newest DateTime value on the chart.

    Volume and Open Interest values are added only if the values has been assigned to all the new data points.

    Assigning data point array:

    const dataPoints = [
    { open: 30, high: 40, low: 20, close: 35, dateTime: new Date(2023, 10, 2), volume: 350 },
    { open: 35, high: 45, low: 25, close: 40, dateTime: new Date(2023, 10, 3), volume: 400 }
    ]
    tradingChart.addDataPoint(dataPoints)

    Scrolling real-time example showing maximum of 200 data points:

    tradingChart.addDataPoint(dataPoints, tradingChart.getPointCount() >= 200)
    

    Parameters

    • dataPoints: DataPoint[]

      Array of data point to add. Includes open, high, low, close and dateTime fields as well as optional volume and openInterest values.

    • scroll: boolean = false

      Set true to scroll data. Scrolling drops the oldest data points out of visible range, i.e. if five points are added, five oldest points are dropped out of range.

    Returns void

  • Adds a single data point to the end of the existing data, or to an empty chart. Allows scrolling data for real-time applications.

    Assigning data point using current time:

    tradingChart.addDataPoint({ open: 30, high: 40, low: 20, close: 35, dateTime: new Date(), volume: 350 })
    

    Scrolling real-time example showing maximum of 200 data points:

    tradingChart.addDataPoint({ open: 30, high: 40, low: 20, close: 35, dateTime: new Date(), volume: 350 }, tradingChart.getPointCount() >= 200)
    

    Parameters

    • dataPoint: DataPoint

      New data point to add. Includes open, high, low, close and dateTime fields as well as optional volume and openInterest values.

    • scroll: boolean = false

      Set true to scroll data. Scrolling drops the oldest data point out of visible range.

    Returns void

  • Adds a heatmap visualization to the chart.

    Parameters

    • startX: number

      Heatmap start X-position in axis values.

    • startY: number

      Heatmap start Y-position in axis values.

    • endX: number

      Heatmap end X-position in axis values.

    • endY: number

      Heatmap end Y-position in axis values.

    • dataValues: number[][]

      Matrix of data values.

    Returns Heatmap

    The heatmap object.

  • Adds a secondary symbol with given dataset to the main chart, allowing comparing two symbols.

    Parameters

    • dataset: DataPoint[]

      An array of OHLC-values. Uses the same date time values as the main dataset.

    • symbol: string

      Secondary Symbol, the name of the dataset.

    Returns IndicatorBase

    Added symbol as an object.

  • Adds Symbol search results to the chart, listing them below the search bar.

    Parameters

    • responseArray: string[][]

      Array of Symbol search results. Each row can contain Symbol, Name, Region, and Currency fields. Of these, Symbol is mandatory, others are optional. Example array: [ ['GOOG', 'Alphabet Inc - Class C', 'United States', 'USD'], ['GOOGL', 'Alphabet Inc - Class A', 'United States', 'USD'] ]

    Returns void

  • Programmatically changes the value of the time range selection element.

    Parameters

    • index: number

      Index of the selected value.

      0 = All

      1 = 10Y

      2 = 5Y

      3 = 3Y

      4 = 1Y

      5 = 6M

      6 = 3M

      7 = 1M

      8 = 10D

      9 = 5D

      10 = 1D

      11 = 12H

      12 = 3H

      13 = 1H

      14 = 30m

      15 = 10m

      16 = 1m

    Returns void

  • Clears current data set.

    Returns void

  • Cleans the chart by removing all added data, indicators, drawing tools, and heatmaps.

    Returns void

  • Converts the given DateTime value to respective index. If the DateTime is between two data points, returns the index of the closest point. Returns null if the DateTime is outside the current data range.

    Parameters

    • dateTime: Date

      DateTime to convert.

    Returns number

    Index, or null if conversion is not possible.

  • Converts the given index to respective DateTime string. Returns null if the index is outside the current data range.

    Parameters

    • index: number

      Index to convert.

    Returns string

    DateTime string, or null if conversion is not possible.

  • Creates a JSON based string from chart, indicator, and drawing tool settings. Can be used with loadPreviousSettings() to load the state of the chart later.

    Returns string

    Settings string.

  • Disposes all heatmaps from the chart.

    Returns void

  • When enabled, automatically adjusts candlestick and bar widths according to the zoom level.

    Parameters

    • autoWidthEnabled: boolean

      Set true to enable auto width feature.

    Returns void

  • Enables a limit to data points allowed on the chart. If this limit is exceeded, old points will be automatically dropped. This is useful in real-time applications, where old points can be dropped when out-scrolled, thus freeing memory and improving performance. Use setDataPointLimit() method to set the maximum number of data points.

    Parameters

    • enableLimit: boolean

      Set true to enable data point limit.

    Returns void

  • When enabled, adds a glow effect on most of the chart components.

    Parameters

    • enableEffect: boolean

      Set true to enable the glow effect.

    Returns void

  • When enabled, mountain price chart type uses gradient coloring for fill.

    Parameters

    • mountainGradient: boolean

      Set true to enable gradient coloring.

    Returns void

  • When enabled, allows showing and hiding the toolbar via a button on the left edge of the chart.

    Parameters

    • enableToolbarButton: any

      Set true to enable the ShowToolbar button.

    Returns void

  • When enabled, X-axis cannot be zoomed or panned outside the minimum and maximum values of the data set. Disabling this allows free zooming and panning. Note that other zoom/pan related settings may still restrict the zoomable/pannable range.

    Parameters

    • enableRestrictions: boolean

      Set true to enable X-axis restrictions.

    Returns void

  • When enabled, Y-axis cannot be zoomed or panned outside the minimum and maximum values of the data set. Disabling this allows free zooming and panning. Note that other zoom/pan related settings may still restrict the zoomable/pannable range.

    Parameters

    • enableRestrictions: boolean

      Set true to enable Y-axis restrictions.

    Returns void

  • Gets the current symbol loaded to the chart, for instance 'AAPL' or 'GOOG'.

    Returns string

    The current symbol.

  • Gets the current data set loaded to the chart as separate arrays or as a single XOHLC-type array.

    Parameters

    • singleArray: boolean = false

      When enabled, returns the data set as a single XOHLC-typed array. Does not contain DateTime values.

    Returns (string[] | number[])[]

    If singleArray is enabled, returns the XOHLC-array. If disabled, returns an array of arrays containing the following:

    -Date array, the dates are in string format.

    -Array of Open values.

    -Array of High values.

    -Array of Low values.

    -Array of Close values.

  • Gets the current data padding values.

    Returns number

    The current data padding

  • Gets the current dataset as an array of DataPoints.

    Returns DataPoint[]

    • DataPoint array.
  • Gets the internal LightningChart component. Note that TradingChart is built using this chart instance. Modifying it may therefore cause unwanted changes in TradingChart's behaviour, if not break its features altogether.

    Returns ChartXY<UIBackground>

    • The internal LightningChart component.
  • Gets the current Kagi chart instance. Useful when changing Kagi settings in code.

    Returns Kagi

    Kagi chart instance, or null if the current chart type is not Kagi.

  • Gets the Open Interest data currently loaded to the chart.

    Returns number[]

    The Open Interest data array.

  • Gets the current Point-and-Figure chart instance. Useful when changing Point-and-Figure settings in code.

    Returns PointAndFigure

    Point-and-Figure chart instance, or null if the current chart type is not Point-and-Figure.

  • Gets the total number of data points added to the chart.

    Returns number

    The point count.

  • Gets the current Renko chart instance. Useful when changing Renko settings in code.

    Returns Renko

    Renko chart instance, or null if the current chart type is not Renko.

  • Gets the search button within the search bar. Can be used to subscribe to various events when using the search bar with user-defined data provider.

    Returns HTMLButtonElement

    The search button.

  • Gets the search input component. Can be used to subscribe to various events when using the search bar with user-defined data provider.

    Returns HTMLInputElement

    The search input component.

  • Gets the table component used to display Symbol search results. Each result is a separate table row. Can be used to subscribe to various events when using the search bar with user-defined data provider.

    Returns HTMLTableElement

    Symbol search table component.

  • Gets the current time range of the chart. To get the current selected time range (time range button value), use getTimeRangeSelection() method.

    Returns Date[]

    Array containing two Date values: start time and end time.

  • Gets the current selected time range (time range button value). To get the exact time range start and end values, use getTimeRange() method.

    Returns number

    Selected time range button value as a number:

    0 = All

    1 = 10Y

    2 = 5Y

    3 = 3Y

    4 = 1Y

    5 = 6M

    6 = 3M

    7 = 1M

    8 = 10D

    9 = 5D

    10 = 1D

    11 = 12H

    12 = 3H

    13 = 1H

    14 = 30m

    15 = 10m

    16 = 1m

  • Gets the Volume data currently loaded to the chart.

    Returns number[]

    The Volume data array.

  • Gets the zoom band chart instance. Returns undefined if the main chart doesn't have a zoom band chart. Note that modifying the zoom band chart may break some of its functionalities since TradingChart is already using this instance.

    Returns ZoomBandChart

    • Zoom band chart instance or undefined if the main chart doesn't use one.
  • Access all indicators.

    Returns Indicators

    Object to access all indicators.

  • Calculate the chart layout again.

    This is used to inform charts that their position may have changed as a result of an Event that the charts are not aware of. For example, if the chart is positioned within a scrollable DIV.

     // Example syntax, trigger chart layout when it is scrolled.
    div.onscroll = () => chart.layout()

    Returns void

  • Reads the given csv-string and converts it into a data array, which is then added to the chart. Replaces existing data.

    Parameters

    • csvString: string

      csv-string to read.

    • datasetName: string = ''

      Name of the dataset, shown as the chart title. Optional.

    • delimiter: string = ","

      Character used to separate entries, comma by default.

    Returns void

  • Loads chart settings based on given JSON string.

    Parameters

    • loadString: string

      JSON string containing settings information.

    Returns boolean

    False if string cannot be parsed to JSON object. True if settings were successfully loaded.

  • Loads chart configurations from a template.

    Returns void

  • Contains various functions to configure the settings and color menus.

    tradingChart.menuOptions().showTitleInput(true)
    

    Returns {
        enableDrawingToolMenus: ((enableMenus) => void);
        showAllowHideToolbarCheckbox: ((showCheckbox) => void);
        showAngleInput: ((showInput) => void);
        showAxisColorInput: ((showInput) => void);
        showAxisOnRightCheckbox: ((showCheckbox) => void);
        showBackgroundColorInput: ((showInput) => void);
        showBorderColorInput: ((showInput) => void);
        showBottomPaddingInput: ((showInput) => void);
        showCandleAutoWidthCheckbox: ((showCheckbox) => void);
        showChartTitleInput: ((showInput) => void);
        showCurrencyInput: ((showInput) => void);
        showCursorTrackingDropdown: ((showDropdown) => void);
        showDataLimitInput: ((showInput) => void);
        showDataPackingCheckbox: ((showCheckbox) => void);
        showEnableLimitCheckbox: ((showCheckbox) => void);
        showFillStyleDropdown: ((showDropdown) => void);
        showGradientColorInput: ((showInput) => void);
        showGradientSpeedInput: ((showInput) => void);
        showHorizontalLineCheckbox: ((showCheckbox) => void);
        showLatestValueDropdown: ((showDropdown) => void);
        showLeftPaddingInput: ((showInput) => void);
        showLineColorInput: ((showInput) => void);
        showMountainGradientCheckbox: ((showCheckbox) => void);
        showNegativeBodyInput: ((showInput) => void);
        showNegativeWickInput: ((showInput) => void);
        showPanningDropdown: ((showDropdown) => void);
        showPercentScaleCheckbox: ((showCheckbox) => void);
        showPositiveBodyInput: ((showInput) => void);
        showPositiveWickInput: ((showInput) => void);
        showRadialXInput: ((showInput) => void);
        showRadialYInput: ((showInput) => void);
        showRectangleZoomDropdown: ((showDropdown) => void);
        showRestrictXCheckbox: ((showCheckbox) => void);
        showRestrictYCheckbox: ((showCheckbox) => void);
        showResultTableDropdown: ((showDropdown) => void);
        showRightPaddingInput: ((showInput) => void);
        showSensitivityInput: ((showInput) => void);
        showSeriesColorInput: ((showInput) => void);
        showShadowGlowCheckbox: ((showCheckbox) => void);
        showShowBorderCheckbox: ((showCheckbox) => void);
        showShowFileSelectionCheckbox: ((showCheckbox) => void);
        showShowImageCheckbox: ((showCheckbox) => void);
        showShowSplittersCheckbox: ((showCheckbox) => void);
        showShowTitleCheckbox: ((showCheckbox) => void);
        showShowWatermarkCheckbox: ((showCheckbox) => void);
        showSplitterColorInput: ((showInput) => void);
        showThemeDropdown: ((showDropdown) => void);
        showTopPaddingInput: ((showInput) => void);
        showValueLabelCheckbox: ((showCheckbox) => void);
        showVerticalLineCheckbox: ((showCheckbox) => void);
        showVerticalPanCheckbox: ((showCheckbox) => void);
        showVerticalZoomCheckbox: ((showCheckbox) => void);
        showWatermarkTextInput: ((showInput) => void);
        showWheelZoomDropdown: ((showDropdown) => void);
        showXAxisLeftActionDropdown: ((showDropdown) => void);
        showXAxisRightActionDropdown: ((showDropdown) => void);
        showYAxisLeftActionDropdown: ((showDropdown) => void);
        showYAxisRightActionDropdown: ((showDropdown) => void);
        showZoomBandCheckbox: ((showCheckbox) => void);
    }

    Functions to configure the menus.

    • enableDrawingToolMenus: ((enableMenus) => void)
        • When enabled, right-clicking drawing tool points opens their settings menu.

          Parameters

          • enableMenus: boolean

            Set true to enable menus.

          Returns void

    • showAllowHideToolbarCheckbox: ((showCheckbox) => void)
        • Shows or hides the Allow hiding toolbar checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showAngleInput: ((showInput) => void)
        • Shows or hides the Angle input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showAxisColorInput: ((showInput) => void)
        • Shows or hides the Axis color input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showAxisOnRightCheckbox: ((showCheckbox) => void)
        • Shows or hides the Price axis on right checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showBackgroundColorInput: ((showInput) => void)
        • Shows or hides the Background color input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showBorderColorInput: ((showInput) => void)
        • Shows or hides the Border color input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showBottomPaddingInput: ((showInput) => void)
        • Shows or hides the Bottom padding input in the settings menu.

          Parameters

          • showInput: boolean

          Returns void

    • showCandleAutoWidthCheckbox: ((showCheckbox) => void)
        • Shows or hides the Candle auto width checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showChartTitleInput: ((showInput) => void)
        • Shows or hides the Chart title input in the settings menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showCurrencyInput: ((showInput) => void)
        • Shows or hides the Currency input in the settings menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showCursorTrackingDropdown: ((showDropdown) => void)
        • Shows or hides the Cursor tracking dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showDataLimitInput: ((showInput) => void)
        • Shows or hides the Data limit input in the settings menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showDataPackingCheckbox: ((showCheckbox) => void)
        • Shows or hides the Data packing checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showEnableLimitCheckbox: ((showCheckbox) => void)
        • Shows or hides the Enable data limit checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showFillStyleDropdown: ((showDropdown) => void)
        • Shows or hides the Fill style dropdown in the color menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showGradientColorInput: ((showInput) => void)
        • Shows or hides the Gradient color input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showGradientSpeedInput: ((showInput) => void)
        • Shows or hides the Gradient speed input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showHorizontalLineCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show horizontal line checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showLatestValueDropdown: ((showDropdown) => void)
        • Shows or hides the latest value label type dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showLeftPaddingInput: ((showInput) => void)
        • Shows or hides the Left padding input in the settings menu.

          Parameters

          • showInput: boolean

          Returns void

    • showLineColorInput: ((showInput) => void)
        • Shows or hides the Line color input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showMountainGradientCheckbox: ((showCheckbox) => void)
        • Shows or hides the Mountain gradient checkbox in the color menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showNegativeBodyInput: ((showInput) => void)
        • Shows or hides the Negative body input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showNegativeWickInput: ((showInput) => void)
        • Shows or hides the Negative wick input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showPanningDropdown: ((showDropdown) => void)
        • Shows or hides the Panning dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showPercentScaleCheckbox: ((showCheckbox) => void)
        • Shows or hides the Percent scale checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showPositiveBodyInput: ((showInput) => void)
        • Shows or hides the Positive body input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showPositiveWickInput: ((showInput) => void)
        • Shows or hides the Positive wick input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showRadialXInput: ((showInput) => void)
        • Shows or hides the Radial center X input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showRadialYInput: ((showInput) => void)
        • Shows or hides the Radial center Y input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showRectangleZoomDropdown: ((showDropdown) => void)
        • Shows or hides the Rectangle zooming dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showRestrictXCheckbox: ((showCheckbox) => void)
        • Shows or hides the Restrict X-axis checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showRestrictYCheckbox: ((showCheckbox) => void)
        • Shows or hides the Restrict Y-axis checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showResultTableDropdown: ((showDropdown) => void)
        • Shows or hides the Result table position dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showRightPaddingInput: ((showInput) => void)
        • Shows or hides the Right padding input in the settings menu.

          Parameters

          • showInput: boolean

          Returns void

    • showSensitivityInput: ((showInput) => void)
        • Shows or hides the Zooming sensitivity input in the settings menu.

          Parameters

          • showInput: boolean

          Returns void

    • showSeriesColorInput: ((showInput) => void)
        • Shows or hides the Series area color input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showShadowGlowCheckbox: ((showCheckbox) => void)
        • Shows or hides the Shadow/Glow effect checkbox in the color menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showShowBorderCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show border checkbox in the color menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showShowFileSelectionCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show file selection checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showShowImageCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show image checkbox in the color menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showShowSplittersCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show splitter lines checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showShowTitleCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show chart title in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showShowWatermarkCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show watermark checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showSplitterColorInput: ((showInput) => void)
        • Shows or hides the Splitter color input in the color menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showThemeDropdown: ((showDropdown) => void)
        • Shows or hides the Theme dropdown in the color menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showTopPaddingInput: ((showInput) => void)
        • Shows or hides the Top padding input in the settings menu.

          Parameters

          • showInput: boolean

          Returns void

    • showValueLabelCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show value labels checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showVerticalLineCheckbox: ((showCheckbox) => void)
        • Shows or hides the Show vertical line checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showVerticalPanCheckbox: ((showCheckbox) => void)
        • Shows or hides the Vertical panning checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showVerticalZoomCheckbox: ((showCheckbox) => void)
        • Shows or hides the Vertical zooming checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

    • showWatermarkTextInput: ((showInput) => void)
        • Shows or hides the Watermark text input in the settings menu.

          Parameters

          • showInput: boolean

            Show/hide the input.

          Returns void

    • showWheelZoomDropdown: ((showDropdown) => void)
        • Shows or hides the Wheel zooming dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showXAxisLeftActionDropdown: ((showDropdown) => void)
        • Shows or hides the X-axis left button interaction dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showXAxisRightActionDropdown: ((showDropdown) => void)
        • Shows or hides the X-axis right button interaction dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showYAxisLeftActionDropdown: ((showDropdown) => void)
        • Shows or hides the Y-axis left button interaction dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showYAxisRightActionDropdown: ((showDropdown) => void)
        • Shows or hides the Y-axis right button interaction dropdown in the settings menu.

          Parameters

          • showDropdown: boolean

            Show/hide the dropdown.

          Returns void

    • showZoomBandCheckbox: ((showCheckbox) => void)
        • Shows or hides the Zoom band chart checkbox in the settings menu.

          Parameters

          • showCheckbox: boolean

            Show/hide the checkbox.

          Returns void

  • Unsubscribes from the ChartClicked event.

    Returns void

  • Unsubscribes from the ClearEverything event.

    Returns void

  • Unsubscribes from the DataModified event.

    Returns void

  • Unsubscribes from the PointerDown event.

    Returns void

  • Unsubscribes from the PointerMove event.

    Returns void

  • Unsubscribes from the PointerUp event.

    Returns void

  • Unsubscribes from the X-axis range changed event.

    Returns void

  • Unsubscribes from the Y-axis range changed event.

    Returns void

  • Event that triggers when the chart is clicked. Unlike other click events, this event triggers also above margins and menus.

    Parameters

    • handler: Handler<ChartClickedEvent>

      Event handler containing 'axisX' and 'axisY' parameters indicating the clicked point of the chart in axis coordinates. 'pixelsX' and 'pixelsY' parameters indicate the clicked point of the chart in screen coordinates (pixels). 'button' indicates the pressed mouse button.

    Returns void

  • Event that triggers when the chart contents are cleared either via Clear everything button in the user interface, or by calling clearEverything() in code.

    Parameters

    • handler: Handler<ClearEverythingEvent>

      Event handler.

    Returns void

  • Event that triggers when a new dataset has been added to the chart. Adding or removing data points also triggers the event.

    Parameters

    • handler: Handler<DataModifiedEvent>

      Event handler containing 'pointCount' parameter indicating the total number of data points after data modification.

    Returns void

  • Event that triggers when pointer (mouse) button is pressed down on the chart area.

    Parameters

    • handler: Handler<PointerDownEvent>

      Event handler containing 'axisX' and 'axisY' parameters indicating the clicked point of the chart in axis coordinates. 'pixelsX' and 'pixelsY' parameters indicate the clicked point of the chart in screen coordinates (pixels). 'button' indicates the pressed mouse button.

    Returns void

  • Event that triggers when pointer is moved over the chart area.

    Parameters

    • handler: Handler<PointerMoveEvent>

      Event handler containing 'axisX' and 'axisY' parameters indicating the current pointer position in axis coordinates. 'pixelsX' and 'pixelsY' parameters indicating the current pointer position in screen coordinates (pixels).

    Returns void

  • Event that triggers when pointer (mouse) button is released on the chart area.

    Parameters

    • handler: Handler<PointerUpEvent>

      Event handler containing 'axisX' and 'axisY' parameters indicating the release point in axis coordinates. 'pixelsX' and 'pixelsY' parameters indicate the release point in screen coordinates (pixels). 'button' indicates the released mouse button.

    Returns void

  • Event that triggers when X-axis range changes.

    Parameters

    • handler: Handler<AxisRangeChangedEvent>

      Event handler containing 'start' and 'end' parameters indicating the respective X-values of the new axis range.

    Returns void

  • Event that triggers when Y-axis range changes.

    Parameters

    • handler: Handler<AxisRangeChangedEvent>

      Event handler containing 'start' and 'end' parameters indicating the respective Y-values of the new axis range.

    Returns void

  • Removes and disposes the chart.

    Returns void

  • Restores the default background colors and settings.

    Returns void

  • Restores default chart and color settings. Doesn't affect indicators or drawing tools. Rows in the settings and color menus are also unaffected.

    Returns void

  • Saves current chart layout as a template including:

    -Chart settings

    -Color settings

    -Added technical indicators and their settings

    -Added drawing tools and their settings

    Template excludes:

    -Added trading data

    -Added heatmaps

    Parameters

    • fileName: string = '_'

      Name of the file.

    Returns void

  • Sets the alignment of the price axes.

    Note that changing axis alignment forces the chart to reload itself, which can cause loss of some information, for example drawing tools. For the same reason, when setAxisAlignment() is used in code, the alignment cannot be changed via chart setting menu.

    Axis alignment can also be set when creating the chart object, which can avoid the above issue:

    tradingChart({axisOnRight: true})
    

    Parameters

    • axesOnRight: boolean

      Set true to place the price axes on the right side of the chart. False places them on the left.

    Returns void

  • Sets the color for all the axes in the chart.

    Parameters

    • axisColor: string

      New axis color, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets the background color of the whole chart, meaning both margin area and series area. Note that series background area color is also controlled via setSeriesBackgroundColor() -method.

    Parameters

    • newColor: string

      New background color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets given image as a background of the chart.

    Parameters

    • imagePath: string

      Path or url of the image.

    Returns void

  • Sets the color of the border around the chart.

    Parameters

    • borderColor: string

      New border color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets the title of the chart. Note that title visibility is also controlled by showChartTitle() -method.

    Parameters

    • title: string

      New title for the chart

    Returns void

  • Sets the color theme of the chart. This overrides all manually set colors.

    Note that changing color theme forces the chart to reload itself, which can cause loss of some information, for example drawing tools. For the same reason, when setColorTheme() is used in code, the theme cannot be changed via color setting menu.

    Color theme can also be set when creating the chart object, which can avoid the above issue:

    tradingChart({colorTheme: Themes.darkGold})
    

    Parameters

    • colorTheme: Theme

      New color theme.

    Returns void

  • Manually sets the currency shown on the chart.

    Parameters

    • currency: string

      New currency.

    Returns void

  • Sets new trading data to the chart, replacing old data. Data is automatically sorted according to DateTime values.

    Parameters

    • dataPoints: DataPoint[]

      Array of new data points. Each point contains open, high, low, close and dateTime values, as well as optional volume and openInterest fields.

    Returns void

  • Sets whether OHLC-data should be packed when showing a large number of data values. Enabling packing improves performance, but may lose accuracy of the data.

    Parameters

    • packingEnabled: boolean

      Set true to enable packing.

    Returns void

  • Sets the amount of empty space in pixels left between the data and the chart edges. The top and bottom padding do not affect indicators in their own segments below the main chart.

    Parameters

    • topPadding: number

      The padding between the data and the top edge

    • rightPadding: number

      The padding between the data and the right edge

    • bottomPadding: number

      The padding between the data and the bottom edge

    • leftPadding: number

      The padding between the data and the left edge

    Returns void

  • Sets the maximum number of data points that can be shown on the chart. If the limit is exceeded, old points will be automatically dropped. Use enableDataPointLimit() method enable and disable this limit.

    Parameters

    • dataPointLimit: number

      Maximum number of data points in chart.

    Returns void

  • Sets the type of the label marking the latest price value. Doesn't affect other value labels such as indicators' labels.

    Parameters

    Returns void

  • Sets the color for Line and Mountain chart types. Affects also the Mountain fill color-

    Parameters

    • newColor: string

      New color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets the color for negative candle-sticks.

    Parameters

    • newColor: string

      New negative candle color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets the color for wicks (shadows) of negative candles.

    Parameters

    • newColor: string

      New negative wick color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets which value the cursor tracks, and is shown in the price axis label.

    Parameters

    Returns void

  • Sets new Open Interest data to the chart.

    Parameters

    • openInterestData: number[]

      New Open Interest data.

    Returns void

  • Sets the mouse button used for panning. Note that panning and rectangle zooming cannot be assigned to the same button.

    Parameters

    Returns void

  • Allows showing price value changes as percentages.

    Parameters

    • usePercentage: boolean

      Set true to show price changes as percentages.

    Returns void

  • Sets the color for positive candles.

    Parameters

    • newColor: string

      New positive candle color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets the color for wicks (shadows) of positive candles.

    Parameters

    • newColor: string

      New positive wick color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Set the type of the main price chart.

    Parameters

    Returns void

  • Sets the mouse button used for rectangle zooming. Note that rectangle zooming and panning cannot be assigned to the same button.

    Parameters

    Returns void

  • Sets the visibility and the position of the result table.

    Parameters

    Returns void

  • Sets the color of the background area where the data is drawn.

    Parameters

    • newColor: string

      New background color as string, should be in HEX format e.g. #FFFFFF.

    • fillStyle: FillStyle = FillStyle.Solid

      Optional background fill style. Default option is solid, single color fill.

    • gradientColor: string = ''

      Gradient color used when fillStyle is set to LinearGradient or RadialGradient. The gradient is formed between this and the given newColor parameter.

    • angle: number = Number.NaN

      Angle of the linear gradient in degrees (0-360).

    • gradientSpeed: number = Number.NaN

      Controls how fast the gradient turns from newColor to gradientColor. Value of 1 signifies even distribution between the two colors. Values smaller than 1 cause faster transition while values larger than 1 cause slower transition.

    • positionX: number = Number.NaN

      X-position of radial gradient's center. 0 = left edge, 1 = right edge.

    • positionY: number = Number.NaN

      Y-position of radial gradient's center. 0 = bottom of the chart, 1 = top of the chart.

    Returns void

  • Sets the color for all the splitter lines in the chart.

    Parameters

    • splitterColor: string

      New splitter color, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets the time range. Data values only within this range will be shown. If given time values are before or after the data range, automatically uses the first or the last data value respectively. If you need to show areas outside the data range, use ZoomToRange() method.

    Parameters

    • startTime: Date

      Start time.

    • endTime: Date

      End time.

    Returns void

  • Sets the chart to use transparent background.

    Parameters

    • transparentChart: boolean

      Use transparent background.

    Returns void

  • Enables or disables the vertical panning affecting Y-axis range.

    Parameters

    • verticalPanning: boolean

      Set true to enable vertical panning.

    Returns void

  • Enables or disables the vertical zooming affecting Y-axis range.

    Parameters

    • verticalZooming: boolean

      Set true to enable vertical zooming.

    Returns void

  • Sets new Volume data to the chart. Note that if the length of the Volume data array is different from the length of the current OHLC-data set, some indicators cannot be calculated correctly.

    Parameters

    • volumeData: number[]

      New Volume data.

    Returns void

  • Sets the text shown in the symbol watermark. showSymbolWatermark needs to be set true for the text to show up.

    Parameters

    • watermarkText: string

      New watermark text.

    Returns void

  • Sets how the chart is zoomed when mouse wheel is used. Wheel zooming is also affected by vertical zooming setting.

    Parameters

    Returns void

  • Sets the action happening when the X-axis is being dragged with the left mouse button.

    Parameters

    Returns void

  • Sets the action happening when the X-axis is being dragged with the right mouse button.

    Parameters

    Returns void

  • Sets the action happening when the Y-axis is being dragged with the left mouse button.

    Parameters

    Returns void

  • Sets the action happening when the Y-axis is being dragged with the right mouse button.

    Parameters

    Returns void

  • Sets the sensitivity of wheel zooming. Value 0 means no zooming while value 1 is the default zooming sensitivity.

    Parameters

    • sensitivity: number

      Zooming sensitivity.

    Returns void

  • Shows or hides the border around the chart.

    Parameters

    • showBorder: boolean

      Set true to show the border.

    Returns void

  • Shows or hides the chart title.

    Parameters

    • showTitle: boolean

      Set true to show the title.

    Returns void

  • Shows or hides the csv-file section button.

    Parameters

    • showFileSelection: boolean

      When enabled shows the file selection button.

    Returns void

  • Shows or hides the horizontal cursor line and its label.

    Parameters

    • showLine: boolean

      Set true to show the line.

    Returns void

  • Shows or hides the indicator specific settings and delete buttons.

    Parameters

    • showButtons: boolean

      Set true to show buttons.

    Returns void

  • Shows or hides the search bar for symbols.

    Parameters

    • showSearchbar: boolean

      When enabled shows the symbol search bar.

    Returns void

  • When enabled, shows splitter lines between the chart segments. The splitters can also be dragged to resize the segments.

    Parameters

    • showSplitterLines: boolean

      Shows splitter lines when true.

    Returns void

  • Shows or hides the symbol watermark written on top of the price chart.

    Parameters

    • showSymbolWatermark: boolean

      Set true to show the watermark.

    Returns void

  • Shows or hides the background image. Works with Cyber Space and Turquoise Hexagon themes.

    Parameters

    • showThemeImage: boolean

      Set true to show the image.

    Returns void

  • Shows or hides the whole toolbar on the left side the chart.

    Parameters

    • showToolbar: any

      Set false to hide the bar, true to show it.

    Returns void

  • Shows or hides all value labels. When enabled, indicator specific settings apply. When disabled, hides all labels regardless of the indicators' settings.

    Parameters

    • showValueLabels: boolean

      Show value labels.

    Returns void

  • Shows or hides the vertical cursor line and its label.

    Parameters

    • showLine: boolean

      Set true to show the line.

    Returns void

  • When enabled, shows a small zoom band chart depicting the whole X-axis range of the main chart. Appears directly below the main chart.

    Parameters

    • showZoomBandChart: boolean

      Enable zoom band chart.

    Returns void

  • Updates the last (newest) data point of the current set displayed in the chart. Does not update the time stamp of the point, only OHLC-values as well as optional Volume and Open Interest values.

    Parameters

    • open: number

      Open value for the last data point.

    • high: number

      High value for the last data point.

    • low: number

      Low value for the last data point.

    • close: number

      Close value for the last data point.

    • volume: number = NaN

      Volume value for the last data point. Is optional.

    • openInterest: number = NaN

      Open Interest value for the last data point. Is optional.

    Returns void

  • Zooms the chart so that all data is visible on the chart.

    Returns void

  • Zooms horizontally to given time range. Price axis (vertical direction) remains unaffected. If X-axis restrictions are enabled (enableXAxisRestrictions), automatically uses the first or the last data value respectively even if the given time values are before or after the data range.

    Parameters

    • startTime: Date

      Start time

    • endTime: Date

      End time

    Returns void