webtrader-charts
The charting library extracted from Webtrader.
See Demo
How to use it
Use npm / yarn
npm install --save webtrader-charts
yarn 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
import wtcharts from 'webtrader-charts';
wtcharts.init({
appId: 11,
lang: 'en',
server: 'wss://ws.binaryws.com/websockets/v3'
});
const chart = wtcharts.chartWindow.addNewChart($parent, {
"type": "line",
"timePeriod": "1m",
"instrumentCode": "RDBULL",
"instrumentName": "Bull Market Index",
"showInstrumentName": true,
"showOverlays": false,
"showShare": false,
"indicators": [
{
"id": "cks",
"name": "Chande Kroll Stop",
"options": {
"period": 10,
"maxMinPeriod": 20,
"multiplier": 3,
"longStopStroke": "#00C176",
"shortStopStroke": "#FF003C",
"strokeWidth": 1,
"dashStyle": "Solid"
}
},
],
"overlays": [ ],
"timezoneOffset": 0,
});
chart.events.anyChange = () => {
console.warn(chart.data());
};
chart.actions.reflow();
chart.actions.refresh();
chart.actions.destroy();
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
node build.js
to get dictionary.json
file. - The language files
/src/i18/{lang}.json
files. - The library uses the generated
dictionary.json
file.