webtrader-charts
The charting library extracted from Webtrader. See Demo
How to use it
Use npm / yarn
npm install --save webtrader-chartsyarn add webtrader-charts
You need to provide these dependences jquery
, moment
and highstock#5.0.x
.
Take a look at webpack.config.js -> externals
.
Basic usage
; // init must be called before anything else. wtcharts; // supported langauges are [ 'ar', 'ja', 'en', 'de', 'es', 'fr', 'id', 'it', 'pl', 'pt', 'ru', 'th', 'vi', 'zh_cn', 'zh_tw'] const chart = wtchartschartWindow; // Will be called every time user makes a change chartevents { console; // Pass chart.data() to addNewChart() to restore a chart. }; chartactions; // Resizes the chart, call it when container is resized. chartactions; // Refreshes the entire chart. chartactions; // Destroys the chart. returns a promise. chartactions; // Unsubcribe from the tick stream.
Supporting mobile (Exprimental)
Pass enableMobileView: true
to make chart mobile friendly. This option disables the navigator and shrinks the scrollbar.
In mobile devices it is recommended to reduce count: 200
, this will improve performance but do not use a smaller value because some indicators might not work properly.
Displaying trade results (Exprimental)
Note: This is an exprimental api, it might change in future releases.
// epoch is in milliseconds for all draw methods. chartdarw; // draws a vertical orange line at epoch. chartdraw; // dashed vertical line at epoch. chartdraw; // empty orange circle at epoch chartdraw; // filled orange circle at epoch chartdraw; // draws a green horizontal barrier line
How to extend it
- Clone the repo
- Change
webpack.config.js
to write the output into/example
folder. yarn install
on both main project and/example
folder.yarn watch
on main project.yarn watch
on/example
folder.- Open
localhost:8080
building translations
- Run
yarn build-translation
to getdictionary.json
file. - The language files
/src/i18/{lang}.json
files. - The library uses the generated
dictionary.json
file.
deploying to gh-pages
yarn deploy-example
to deploy the/example
folder.yarn deploy-hard
to deploy latest version embedded in binary-static (for testing)yarn deploy-soft
same asyarn deploy-hard
(use it the second time you are deploying).app-id
foraminroosta.github.io/binary-static
is7770