Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

tradex-chart

tradex-app227GNU GPL30.157.9TypeScript support: included

TradeX-chart is a highly customizable stock trade chart with one dependency written in plain JavaScript; use it with any framework or backend.

chart, crypto, canvas, trading, cryptocurrency, technical analysis, technical indicators, talib, stock chart, finance, stock, stockchart, exchange, candlestick, k-line, timeline, klinechart

readme

README

TradeX-chart is a highly customizable stock trade chart with one dependency written in plain JavaScript; use it with any framework or backend.

Version Size LICENSE GitHub Discord

Table of Contents

Demo

Live Demo

Getting Started

Requirements

TradeX-chart targets browsers that support ECMAScript 2022.

Install

NPM

npm install tradex-chart

In Browser

<script src="tradex-chart.es.js"></script>

How to Use

Minimal working example:

<div id="myChartDiv"></div>

<script>

import {Chart, DOM} from 'tradex-chart'
import * as talib from "talib-web"

// minimal data state
let state = {
  "ohlcv": [
// [timestamp, open, high, low, close, volume]
    [1543579200000,4035.6,4072.78348726,3965,4055.6,2157.50135341],
    [1543582800000,4055.6,4100,4035,4059.1719252,1660.6115119],
    [1543586400000,4059.1,4076.6,4014.1,4060,1070.09946267],
    [1543590000000,4060.5,4060.5,3987.2,4049.2,1530.46774287],
    [1543593600000,4049.2,4092.7,4035,4089.6691106,922.84509291]
  ]
}

// minimal config
const config = {
  id: "TradeX_test",
  title: "BTC/USDT",
  width: 1000,
  height: 800,
  utils: {none: true},
  tools: {none: true},
  talib: talib,
  // see configuration.md#config regarding talib.wasm
  // `${window.location.origin}/talib.wasm`
  rangeLimit: 30,
}

const mount = document.getElementById('myChartDiv')
const chart = document.createElement("tradex-chart")

mount.appendChild(chart)
chart.start(config)

</script>

TypeScript

Types provided

Documentation

Documentation can be found here: Documentation

or built and run locally from the repository by running:

git clone https://github.com/tradex-app/TradeX-chart
cd ./tradex-chart/src/docs
npm run build

Editable Live Sandbox Examples

Editable sandbox examples can found on CodeSandbox.io

Framework Integration Examples

Features

Support

For the latest news on TradeX-chart, feedback, feature requests, and community, join us over on Discord or GitHub.

Contributing

Testing, bug reports and feature requests welcome

If you have any bugs, issues, or feature requests, please, before making a submission, first:

To submit an issue:

  • Fork the chart repostitory
  • Create your Feature Branch git checkout -b feature/AmazingFeature
  • Commit your Changes git commit -m 'Add some AmazingFeature'
  • Push to the Branch git push origin feature/AmazingFeature
  • Open a Pull Request

You can help speed up development by contributing with crypto or PayPal.


if (youEnjoyed) {
    starThisRepository();
}

Stargazers over time

Stargazers over time

changelog

Change Log

0.143.0

Indicator config dialogue

0.139.6

Fixed

  • Export chart snapshot - main pane position, divider line colour

0.139.5

Added

  • Export chart snapshot with watermark

0.139.4

Fixed

  • Divider width on global_resize
  • Menu y positioning on global_resize

0.139.3

Fixed

  • Menu x positioning on global_resize

0.139.2

Fixed

  • Divider styling

0.139.1

Fixed

  • Spurious import causing failure

0.139.0

Added

  • Chart Pane - collapse, expand

0.138.4

Updated

  • Indicator - Legend - controls

0.138.3

Updated

  • Chart Pane - Legend - controls - icons hover highlight

0.138.2

Updated

  • Chart Pane - Legend - controls - icons display

0.138.1

Fixed

  • Indicator AROON - legends - nicePrice()
  • Chart Pane Pairs - resize (divider)

0.138.0

Added

  • Indicator - AROON

Updated

  • Documentation

0.137.5

Fixed

  • Menu positioning on chart resize

Added

  • Tools - node
  • idSanitize()

0.137.4 - 2023-08-10

Fixed

  • Chart-Events - variables
  • Chart-Events & Chart-Trades - using wrong hit layer

0.137.3 - 2023-08-10

Fixed

  • Chart Trades - pixel perfect hit detection
  • Documentation

0.137.2 - 2023-08-08

Fixed

  • Chart Image Export - yAxis positioning

[0.137.1] - 2023-08-08

Added

  • Chart to image URL toImageURL()
  • Image download and data URL, image type options

0.137.0 - 2023.08-08

Added

  • Chart Image Snapshot Download
  • CEL - layer composition

0.136.0 - 2023-08-05

Added

  • High Low Marker

0.135.0 - 2023-08-02

Added

  • Overlay - News Events

Changed

  • Config - trades, events - moved into primary drawings moved into primary and secondary

[0.134.2] - 2023-08-01

Added

  • svgToImage()
  • isSVG()

0.134.1 - 2023-07-31

Fixed

  • Dialogue window (not implemented message) opening when it shouldn't

[0.134.0]/(https://github.com/tradex-app/TradeX-chart/commit/91c9b3b649f6b5972ec8d51caddbcf41a9eddc39) - 2023-07-31

Added

  • Trades - Overlay

0.133.0 - 2023-07-30

Added

  • Legends - show / hide all

0.132.3 - 2023-07-29

Fixed

  • Widgets - window
  • Streaming candle range auto increment
  • FireFox render SVG to canvas

0.132.2 - 2023-07-25

Fixed

  • addChartIndicator()

0.132.1 - 2023-07-22

Fixed

  • Config - range - center option

0.131.1 - 2023-07-21

Added

  • Merge Indicator data

Fixed

  • rangeStart

Changed

  • Timeline - navigation - hidden by default
  • State - mergeData - object requires "ohlcv" instead of "data"
  • Automatic indicator calculation on merge = true to enable

[0.130.0]

[0.129.0]

[0.128.1]

[0.127.1]

[0.127.0] - 2023-06-22

Added

  • Indicator - invokeConfig()
  • Indicator - settings()

[0.126.0] - 2023-06-21

Added

  • Indicator - visibility

Changed

  • Use shorter API path - chart.chartPanes instead of chart.MainPane.chartPanes

[0.125.0] - 2023-06-20

Added

  • Indicators - add via api
  • Indicators - remove via api or chart GUI
  • Indicators - re-order via api or chart GUI

Fixed

  • Price Y Axis scale smooth scaling with mouse pointer

[0.124.1] - 2023-06-17

Changed

  • Divider - drag - refactored from MainPane to chart pane resize()
  • Cursor - set, get refactored

FIXED

  • Divider - drag - display

[0.124.0] - 2023-06-17

Added

  • Indicators - remove via API and GUI

Changed

  • ChartPane - guard - no remove primary, no user destroy()

Fixed

  • Legend - properly remove icon events
  • Indicators - remove legend on destroy()

[0.123.0] - 2023-06-14

Changed

  • Chart View - remove via API and legend icon

Fixed

  • Cleaned up event unsubscribing
  • StateMachine - unsubscribe incorrect function reference
  • StateMachine configs now provide id
  • further id sanitation throughout TradeX

[0.122.0] - 2023-06-12

Added

  • Legend Controls - re-order chart panes
  • xMap()

Changed

  • Chart.js - now provides both onChart offChart
  • Reorganize canvas helper functions
  • IDs - standardized throughout TradeX component
  • console output moved to internal methods

Fixed

  • Property Naming clean up - ID -> id for standardization
  • Legends - refactored which() into onMouseClick()
  • Legend - title
  • Pane / View sizing issue
  • Divider - pointer over / enter

[0.121.11] - 2023-05-27

Added

  • chart padding, the space above and below the candle range can now be set via the config.

[0.121.10] - 2023-05-26

Added

  • Theme - setProperty, getProperty using path "candle.Type"
  • isTouch - touch device flag
  • Legends - set deselect on chart drag

[0.121.9] - 2023-05-24

Fixed

  • Pointer drag , and move events that start within the chart and cross outside of it.
  • Chart Cursor - crosshair, X and Y scale cursor positioning

[0.121.8] - 2023-05-22

Added

  • Mjolnir integration - touch device support
  • Keys - cursor up / down set chart zoom
  • Config Options - disable: time navigation, legend controls

Fixed

  • Mouse Left Zoom Lock - prevent unintended zoom on touch pads
  • timeline tick rendering
  • Chart Cursor - crosshair, X and Y scale cursor positioning

[0.121.7] - 2023-05-12

Fixed

  • Theme - list, hot swapping, modify values, delete
  • Divider - uses theme definition
  • Off Chart - separator (top border) uses theme definition
  • Candles - use current theme definition

[0.121.6] - 2023-05-12

Added

  • chart state export - chart.state.exportState()

[0.121.4] - 2023-05-12

Fixed

  • incorrect Rows size on chart starting with fixed size

[0.121.3] - 2023-05-11

Fixed

  • customElements.define() - define once

[0.121.2] - 2023-05-10

Fixed

  • replaced constructor.name comparisons with instanceof, to eliminate issue with minify changing class names

[0.121.1] - 2023-05-07

Added

  • Custom Indicators

Fixed

  • TALib - indicator history calculation on chart.start() now queued until talib is ready

[0.120.1] - 2023-04-26

Added

  • Indicator API
  • Indicators - calculate indicators on mergeData()

Fixed

  • edge case empty scaleGrads
  • min chart heightt - accounts for Utils bar
  • mergeData()

[0.120.1] - 2023-04-23

Added

  • Legends - optional labels

Fixed

  • Indicator - Bollinger Bands - legend

[0.120.0] - 2023-04-23

Added

  • Indicator - calculate back history on start if not provided in the config state
  • TALib - async ready status now implemented
  • TALib - function input output definitions to ensure correct data in / out
  • Indicators - can use TALib input output definitions

Fixed

  • Indicators - fixed range pointers for back history and live price stream
  • Indicators - BB, DMI, EMA, RSI, SMA - data length check on draw()

[0.119.0] - 2023-04-07

Added

  • User Defined Chart Alerts - invoked via API or config

[0.118.0] - 2023-04-10

Changed

  • Refactored onChart and offChart code out to chart parent class

Fixed

  • Y Scale grads sync to current range
  • Y Scale price line default width

[0.117.7] - 2023-04-06

Added

  • Event - STREAM_FIRSTVALUE

Fixed

  • X grid sync timeline on streaming

[0.117.6] - 2023-04-05

Changed

  • Timeline - now uses Graph to manage overlays

[0.117.5] - 2023-04-03

Changed

  • Scale - now uses Graph to manage overlays

[0.117.4] - 2023-04-01

Changed

  • Obsolete input Controller removed and replaced with Input class

Fixed

  • Update (draw() render()) on/offCharts on setDimensions() (resize)

[0.117.3] - 2023-03-31

Fixed

  • Time scale drag to zoom candle history range

[0.117.2] - 2023-03-30

Fixed

  • Centering on first stream candle of empty chart

[0.117.1] - 2023-03-30

Fixed

  • Stream - ensure tick values are numbers

[0.117.0] - 2023-03-27

Added

  • Watermark

[0.116.1] - 2023-03-26

Fixed

  • Stream - current candle / time frame count down calculation

[0.116.0] - 2023-03-26

Added

  • Stream - current candle / time frame count down option on Axis

[0.115.0] - 2023-03-23

Added

  • Utils Bar - enable / disable

[0.114.0] - 2023-03-23

Added

  • Tool Bar - enable / disable

[0.113.3] - 2023-03-22

Changed

  • Chart now expects Kline data for price stream
  • Chart exports class Overlay for external Overlays
  • Chart exports class Indicator for external Indicators
  • All Overlays now extend from class Overlay

Fixed

  • Components - views (web components) - resizing

[0.103.5] - 2022-09-23

Fixed

  • Stream - live candle positioning

[0.103.3] - 2022-09-22

Added

  • Scale - yAxis - dynamic gradation placement option added to the fixed option

Fixed

  • FIXED: Chart X Grid on zoom - now updates

[0.103.0] - 2022-09-14

Fixed

  • Stream - new candle creation time - now matches chart time frame

[0.103.0] - 2022-09-14

Added

  • Live Stream - stream candle

[0.102.0] - 2022-09-09

Added

  • Live Stream - Scale - Price Line indicator

[0.101.2] - 2022-08-25

Added

  • CHANGELOG.md

Changed

Fixed

  • Time Line cursor layer width

[0.101.0] - 2022-08-24

Added

  • Reactive Resize - chart can be hooked up to an event that watches for an element size change and force a chart resize, making it reactive.

Changed

Fixed

[0.100.2] - 2022-08-22

Added

Changed

Fixed

  • Divider / Splitter - prevent drag select while moving

[0.100.1] - 2022-08-22

Added

  • State Machine - Actions

Changed

Fixed

  • Divider / Splitter - minimum row height limit on resize

[0.100.0] - 2022-08-21

Added

  • Chart Rows - Chart and Off Chart - now resize on divider / splitter drag

Changed

Fixed