@oanda/labs-order-book-widget 1.0.62 → 1.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +484 -0
  2. package/dist/main/OrderBookWidget/OrderBookWidget.js +6 -3
  3. package/dist/main/OrderBookWidget/OrderBookWidget.js.map +1 -1
  4. package/dist/main/OrderBookWidget/Widget.js +12 -14
  5. package/dist/main/OrderBookWidget/Widget.js.map +1 -1
  6. package/dist/main/OrderBookWidget/components/Chart/Chart.js +49 -14
  7. package/dist/main/OrderBookWidget/components/Chart/Chart.js.map +1 -1
  8. package/dist/main/OrderBookWidget/components/Chart/constants.js +7 -3
  9. package/dist/main/OrderBookWidget/components/Chart/constants.js.map +1 -1
  10. package/dist/main/OrderBookWidget/components/Chart/formatters.js +14 -0
  11. package/dist/main/OrderBookWidget/components/Chart/formatters.js.map +1 -0
  12. package/dist/main/OrderBookWidget/components/Chart/getOption.js +274 -0
  13. package/dist/main/OrderBookWidget/components/Chart/getOption.js.map +1 -0
  14. package/dist/main/OrderBookWidget/components/Chart/types.js +6 -0
  15. package/dist/main/OrderBookWidget/components/Chart/types.js.map +1 -0
  16. package/dist/main/OrderBookWidget/config.js +15 -0
  17. package/dist/main/OrderBookWidget/config.js.map +1 -0
  18. package/dist/main/OrderBookWidget/render.js +31 -10
  19. package/dist/main/OrderBookWidget/render.js.map +1 -1
  20. package/dist/main/OrderBookWidget/types.js.map +1 -1
  21. package/dist/module/OrderBookWidget/OrderBookWidget.js +7 -4
  22. package/dist/module/OrderBookWidget/OrderBookWidget.js.map +1 -1
  23. package/dist/module/OrderBookWidget/Widget.js +13 -15
  24. package/dist/module/OrderBookWidget/Widget.js.map +1 -1
  25. package/dist/module/OrderBookWidget/components/Chart/Chart.js +47 -14
  26. package/dist/module/OrderBookWidget/components/Chart/Chart.js.map +1 -1
  27. package/dist/module/OrderBookWidget/components/Chart/constants.js +6 -2
  28. package/dist/module/OrderBookWidget/components/Chart/constants.js.map +1 -1
  29. package/dist/module/OrderBookWidget/components/Chart/formatters.js +8 -0
  30. package/dist/module/OrderBookWidget/components/Chart/formatters.js.map +1 -0
  31. package/dist/module/OrderBookWidget/components/Chart/getOption.js +266 -0
  32. package/dist/module/OrderBookWidget/components/Chart/getOption.js.map +1 -0
  33. package/dist/module/OrderBookWidget/components/Chart/types.js +2 -0
  34. package/dist/module/OrderBookWidget/components/Chart/types.js.map +1 -0
  35. package/dist/module/OrderBookWidget/config.js +10 -0
  36. package/dist/module/OrderBookWidget/config.js.map +1 -0
  37. package/dist/module/OrderBookWidget/render.js +31 -10
  38. package/dist/module/OrderBookWidget/render.js.map +1 -1
  39. package/dist/module/OrderBookWidget/types.js.map +1 -1
  40. package/dist/types/OrderBookWidget/OrderBookWidget.d.ts +1 -1
  41. package/dist/types/OrderBookWidget/components/Chart/Chart.d.ts +2 -6
  42. package/dist/types/OrderBookWidget/components/Chart/constants.d.ts +6 -2
  43. package/dist/types/OrderBookWidget/components/Chart/formatters.d.ts +3 -0
  44. package/dist/types/OrderBookWidget/components/Chart/getOption.d.ts +174 -0
  45. package/dist/types/OrderBookWidget/components/Chart/types.d.ts +18 -0
  46. package/dist/types/OrderBookWidget/config.d.ts +6 -0
  47. package/dist/types/OrderBookWidget/render.d.ts +1 -6
  48. package/dist/types/OrderBookWidget/types.d.ts +2 -0
  49. package/package.json +3 -3
  50. package/src/OrderBookWidget/OrderBookWidget.tsx +9 -6
  51. package/src/OrderBookWidget/Widget.tsx +12 -21
  52. package/src/OrderBookWidget/components/Chart/Chart.tsx +56 -18
  53. package/src/OrderBookWidget/components/Chart/constants.ts +7 -2
  54. package/src/OrderBookWidget/components/Chart/formatters.ts +11 -0
  55. package/src/OrderBookWidget/components/Chart/getOption.ts +296 -0
  56. package/src/OrderBookWidget/components/Chart/types.ts +29 -0
  57. package/src/OrderBookWidget/config.ts +11 -0
  58. package/src/OrderBookWidget/render.tsx +36 -18
  59. package/src/OrderBookWidget/types.ts +2 -0
  60. package/dist/main/OrderBookWidget/components/Chart/getOptions.js +0 -322
  61. package/dist/main/OrderBookWidget/components/Chart/getOptions.js.map +0 -1
  62. package/dist/module/OrderBookWidget/components/Chart/getOptions.js +0 -315
  63. package/dist/module/OrderBookWidget/components/Chart/getOptions.js.map +0 -1
  64. package/dist/types/OrderBookWidget/components/Chart/getOptions.d.ts +0 -6
  65. package/src/OrderBookWidget/components/Chart/getOptions.ts +0 -361
@@ -1,322 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getOptions = void 0;
7
- var _labsWidgetCommon = require("@oanda/labs-widget-common");
8
- var _constants = require("./constants");
9
- const getOptions = _ref => {
10
- let {
11
- data,
12
- price,
13
- bucketWidth
14
- } = _ref;
15
- return {
16
- toolbox: {
17
- itemSize: 18,
18
- itemGap: 14,
19
- bottom: 6,
20
- right: 6,
21
- showTitle: false,
22
- iconStyle: {
23
- borderColor: '#00214A'
24
- },
25
- emphasis: {
26
- iconStyle: {
27
- borderColor: '#008573'
28
- }
29
- },
30
- tooltip: {
31
- show: true,
32
- backgroundColor: '#00214A',
33
- formatter: val => val.title,
34
- position: 'top',
35
- confine: true,
36
- textStyle: {
37
- color: '#fff'
38
- }
39
- },
40
- feature: {
41
- myZoomIn: {
42
- show: true,
43
- title: 'Zoom in',
44
- icon: _labsWidgetCommon.chartSharedOptions.icons.zoomInIcon,
45
- onclick: (model, instance) => {
46
- const {
47
- startValue,
48
- endValue
49
- } = model.option.dataZoom[0];
50
- const halfZoomValue = 0.5 * _constants.ZOOM_BARS * bucketWidth;
51
- instance.dispatchAction({
52
- type: 'dataZoom',
53
- startValue: startValue + halfZoomValue,
54
- endValue: endValue - halfZoomValue
55
- });
56
- }
57
- },
58
- myZoomOut: {
59
- show: true,
60
- title: 'Zoom out',
61
- icon: _labsWidgetCommon.chartSharedOptions.icons.zoomOutIcon,
62
- onclick: (model, instance) => {
63
- const {
64
- startValue,
65
- endValue
66
- } = model.option.dataZoom[0];
67
- const halfZoomValue = 0.5 * _constants.ZOOM_BARS * bucketWidth;
68
- instance.dispatchAction({
69
- type: 'dataZoom',
70
- startValue: startValue - halfZoomValue,
71
- endValue: endValue + halfZoomValue
72
- });
73
- }
74
- },
75
- myResetZoom: {
76
- show: true,
77
- title: 'ResetZoom',
78
- icon: _labsWidgetCommon.chartSharedOptions.icons.resetZoomIcon,
79
- onclick: (model, instance) => {
80
- instance.dispatchAction({
81
- type: 'dataZoom',
82
- startValue: price - bucketWidth * _constants.INITIAL_BARS * 0.5,
83
- endValue: price + bucketWidth * _constants.INITIAL_BARS * 0.5
84
- });
85
- }
86
- }
87
- }
88
- },
89
- dataZoom: [{
90
- type: 'inside',
91
- realtime: true,
92
- startValue: price - bucketWidth * _constants.INITIAL_BARS * 0.5,
93
- endValue: price + bucketWidth * _constants.INITIAL_BARS * 0.5,
94
- yAxisIndex: 0
95
- }],
96
- dataset: {
97
- source: data
98
- },
99
- textStyle: {},
100
- tooltip: {
101
- trigger: 'axis',
102
- borderRadius: 0,
103
- shadowBlur: 24,
104
- shadowOffsetX: 0,
105
- shadowOffsetY: 6,
106
- shadowColor: 'rgba(0,0,0,0.1)',
107
- textStyle: {},
108
- formatter: params => {
109
- const values = params[0].data;
110
- return "Price: ".concat(values[0], "<br />Buy: ").concat(values[1], "%<br/>Sell: ").concat(Math.abs(values[2]), "%");
111
- },
112
- axisPointer: {
113
- axis: 'y'
114
- }
115
- },
116
- grid: [{
117
- top: '1px',
118
- left: '1px',
119
- right: '121px',
120
- bottom: '41px',
121
- show: true
122
- }, {
123
- bottom: '1px',
124
- right: '1px',
125
- width: '120px',
126
- height: '40px',
127
- show: true
128
- }, {
129
- top: '1px',
130
- left: '1px',
131
- right: '1px',
132
- bottom: '1px',
133
- show: true
134
- }],
135
- graphic: [{
136
- type: 'group',
137
- left: '8px',
138
- top: '8px',
139
- silent: true,
140
- children: [{
141
- type: 'rect',
142
- z: 100,
143
- left: 'center',
144
- top: 'middle',
145
- shape: {
146
- width: 60,
147
- height: 30
148
- },
149
- style: {
150
- fill: '#fff',
151
- shadowBlur: 8,
152
- shadowOffsetX: 0,
153
- shadowOffsetY: 1,
154
- shadowColor: 'rgba(0,0,0,0.1)'
155
- }
156
- }, {
157
- type: 'text',
158
- z: 100,
159
- left: 'center',
160
- top: 'middle',
161
- style: {
162
- width: 60,
163
- height: 30,
164
- text: 'Sell'
165
- }
166
- }]
167
- }, {
168
- type: 'group',
169
- right: '128px',
170
- top: '8px',
171
- silent: true,
172
- children: [{
173
- type: 'rect',
174
- z: 100,
175
- right: 'center',
176
- top: 'middle',
177
- shape: {
178
- width: 60,
179
- height: 30
180
- },
181
- style: {
182
- fill: '#fff',
183
- shadowBlur: 8,
184
- shadowOffsetX: 0,
185
- shadowOffsetY: 1,
186
- shadowColor: 'rgba(0,0,0,0.1)'
187
- }
188
- }, {
189
- type: 'text',
190
- z: 100,
191
- right: 'center',
192
- top: 'middle',
193
- style: {
194
- width: 60,
195
- height: 30,
196
- text: 'Buy'
197
- }
198
- }]
199
- }],
200
- yAxis: {
201
- type: 'value',
202
- position: 'right',
203
- axisLine: {
204
- show: false
205
- },
206
- axisTick: {
207
- show: false
208
- },
209
- splitLine: {
210
- lineStyle: {}
211
- },
212
- axisLabel: {
213
- padding: [0, 0, 0, 10],
214
- rich: {
215
- a: {
216
- padding: [0, 0, 16, 0]
217
- }
218
- },
219
- formatter: (value, index) => index ? "".concat(value) : "{a|".concat(value, "}")
220
- }
221
- },
222
- xAxis: {
223
- type: 'value',
224
- min: -1.1,
225
- max: 1.1,
226
- axisLine: {
227
- show: false
228
- },
229
- axisTick: {
230
- show: false
231
- },
232
- splitLine: {
233
- lineStyle: {}
234
- },
235
- axisLabel: {
236
- padding: [7, 0, 0, 0],
237
- showMinLabel: false,
238
- showMaxLabel: false,
239
- formatter: value => value === 0 ? '%' : "".concat(Math.abs(value), "%")
240
- }
241
- },
242
- series: [{
243
- type: 'custom',
244
- encode: {
245
- x: 1,
246
- y: 0,
247
- tooltip: 1
248
- },
249
- itemStyle: {
250
- color: '#00B89E'
251
- },
252
- renderItem: (params, api) => {
253
- const yValue = api.value(0);
254
- const xStart = api.coord([api.value(1), yValue]);
255
- const xEnd = api.coord([0, yValue]);
256
- const bucketWidthHeight = api.size ? api.size([0, bucketWidth])[1] : 0;
257
- const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;
258
- const rectShape = {
259
- x: xStart[0] + 0.5,
260
- y: xStart[1] - height / 2,
261
- width: xEnd[0] - xStart[0],
262
- height
263
- };
264
- return {
265
- type: 'rect',
266
- shape: rectShape,
267
- style: api.style()
268
- };
269
- }
270
- }, {
271
- type: 'custom',
272
- encode: {
273
- x: 1,
274
- y: 0,
275
- tooltip: 2
276
- },
277
- markLine: {
278
- animation: false,
279
- silent: true,
280
- precision: 4,
281
- symbol: ['none', 'triangle'],
282
- symbolRotate: 90,
283
- symbolSize: [20, 10],
284
- lineStyle: {
285
- color: '#008573',
286
- width: 1
287
- },
288
- label: {
289
- padding: [5, 15, 5, 15],
290
- color: '#fff',
291
- backgroundColor: '#008573'
292
- },
293
- data: [{
294
- yAxis: price
295
- }]
296
- },
297
- itemStyle: {
298
- color: '#E5226E'
299
- },
300
- renderItem: (params, api) => {
301
- const yValue = api.value(0);
302
- const xStart = api.coord([api.value(2), yValue]);
303
- const xEnd = api.coord([0, yValue]);
304
- const bucketWidthHeight = api.size ? api.size([0, bucketWidth])[1] : 0;
305
- const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;
306
- const rectShape = {
307
- x: xStart[0] - 0.5,
308
- y: xStart[1] - height / 2,
309
- width: xEnd[0] - xStart[0],
310
- height
311
- };
312
- return {
313
- type: 'rect',
314
- shape: rectShape,
315
- style: api.style()
316
- };
317
- }
318
- }]
319
- };
320
- };
321
- exports.getOptions = getOptions;
322
- //# sourceMappingURL=getOptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getOptions.js","names":["_labsWidgetCommon","require","_constants","getOptions","_ref","data","price","bucketWidth","toolbox","itemSize","itemGap","bottom","right","showTitle","iconStyle","borderColor","emphasis","tooltip","show","backgroundColor","formatter","val","title","position","confine","textStyle","color","feature","myZoomIn","icon","chartSharedOptions","icons","zoomInIcon","onclick","model","instance","startValue","endValue","option","dataZoom","halfZoomValue","ZOOM_BARS","dispatchAction","type","myZoomOut","zoomOutIcon","myResetZoom","resetZoomIcon","INITIAL_BARS","realtime","yAxisIndex","dataset","source","trigger","borderRadius","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor","params","values","concat","Math","abs","axisPointer","axis","grid","top","left","width","height","graphic","silent","children","z","shape","style","fill","text","yAxis","axisLine","axisTick","splitLine","lineStyle","axisLabel","padding","rich","a","value","index","xAxis","min","max","showMinLabel","showMaxLabel","series","encode","x","y","itemStyle","renderItem","api","yValue","xStart","coord","xEnd","bucketWidthHeight","size","rectShape","markLine","animation","precision","symbol","symbolRotate","symbolSize","label","exports"],"sources":["../../../../../src/OrderBookWidget/components/Chart/getOptions.ts"],"sourcesContent":["import { EChartsOption, Model, EChartsType } from 'echarts';\nimport { chartSharedOptions } from '@oanda/labs-widget-common';\nimport { ZOOM_BARS, INITIAL_BARS } from './constants';\n\nexport const getOptions = (\n {\n data,\n price,\n bucketWidth,\n } :\n {\n data: number[][],\n price: number,\n bucketWidth: number\n },\n): EChartsOption => (\n {\n toolbox: {\n itemSize: 18,\n itemGap: 14,\n bottom: 6,\n right: 6,\n showTitle: false,\n iconStyle: {\n borderColor: '#00214A',\n },\n emphasis: {\n iconStyle: {\n borderColor: '#008573',\n },\n },\n tooltip: {\n show: true,\n backgroundColor: '#00214A',\n formatter: (val) => val.title,\n position: 'top',\n confine: true,\n textStyle: {\n color: '#fff',\n },\n },\n feature: {\n myZoomIn: {\n show: true,\n title: 'Zoom in',\n icon: chartSharedOptions.icons.zoomInIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with minimal step\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue + halfZoomValue,\n endValue: endValue - halfZoomValue,\n });\n },\n },\n myZoomOut: {\n show: true,\n title: 'Zoom out',\n icon: chartSharedOptions.icons.zoomOutIcon,\n onclick: (model: Model, instance: EChartsType) => {\n const { startValue, endValue } = model.option.dataZoom[0];\n // @todo handle zoom with full chart range\n const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;\n\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: startValue - halfZoomValue,\n endValue: endValue + halfZoomValue,\n });\n },\n },\n myResetZoom: {\n show: true,\n title: 'ResetZoom',\n icon: chartSharedOptions.icons.resetZoomIcon,\n onclick: (model: Model, instance: EChartsType) => {\n instance.dispatchAction({\n type: 'dataZoom',\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n });\n },\n },\n },\n },\n dataZoom: [\n {\n type: 'inside',\n realtime: true,\n startValue: price - (bucketWidth * INITIAL_BARS * 0.5),\n endValue: price + (bucketWidth * INITIAL_BARS * 0.5),\n yAxisIndex: 0,\n // @todo\n // minSpan: 2,\n },\n ],\n dataset: {\n source: data,\n },\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n tooltip: {\n trigger: 'axis',\n borderRadius: 0,\n shadowBlur: 24,\n shadowOffsetX: 0,\n shadowOffsetY: 6,\n shadowColor: 'rgba(0,0,0,0.1)',\n textStyle: {\n // @todo, broken due dark mode\n // ...chartSharedOptions.textStyle,\n },\n formatter: (params) => {\n const values = (params as { data: number[] }[])[0].data;\n return `Price: ${values[0]}<br />Buy: ${values[1]}%<br/>Sell: ${Math.abs(values[2])}%`;\n },\n axisPointer: {\n axis: 'y',\n },\n },\n grid: [\n {\n top: '1px',\n left: '1px',\n right: '121px',\n bottom: '41px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n bottom: '1px',\n right: '1px',\n width: '120px',\n height: '40px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n {\n top: '1px',\n left: '1px',\n right: '1px',\n bottom: '1px',\n // @todo, broken due dark mode\n // borderColor: chartSharedOptions.colors.axis,\n show: true,\n },\n ],\n graphic: [\n {\n type: 'group',\n left: '8px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n left: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n left: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Sell',\n },\n },\n ],\n },\n {\n type: 'group',\n right: '128px',\n top: '8px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 60,\n height: 30,\n },\n style: {\n fill: '#fff',\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: 'rgba(0,0,0,0.1)',\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n width: 60,\n height: 30,\n // @todo\n text: 'Buy',\n },\n },\n ],\n },\n ],\n yAxis: {\n type: 'value',\n position: 'right',\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [0, 0, 0, 10],\n rich: {\n a: {\n padding: [0, 0, 16, 0],\n },\n },\n // @todo add decimal places\n formatter: (value, index) => (index ? `${value}` : `{a|${value}}`),\n },\n },\n xAxis: {\n type: 'value',\n // @todo\n min: -1.1,\n max: 1.1,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n lineStyle: {\n // @todo, broken due dark mode\n // color: chartSharedOptions.colors.axis,\n },\n },\n axisLabel: {\n padding: [7, 0, 0, 0],\n showMinLabel: false,\n showMaxLabel: false,\n formatter: (value) => (value === 0 ? '%' : `${Math.abs(value)}%`),\n },\n },\n series: [\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 1,\n },\n itemStyle: {\n color: '#00B89E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(1), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] + 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n },\n },\n {\n type: 'custom',\n encode: {\n x: 1,\n y: 0,\n tooltip: 2,\n },\n markLine: {\n animation: false,\n silent: true,\n // @todo confirm precision\n precision: 4,\n symbol: ['none', 'triangle'],\n symbolRotate: 90,\n symbolSize: [20, 10],\n lineStyle: {\n color: '#008573',\n width: 1,\n },\n label: {\n padding: [5, 15, 5, 15],\n color: '#fff',\n backgroundColor: '#008573',\n },\n data: [\n {\n yAxis: price,\n },\n ],\n },\n itemStyle: {\n color: '#E5226E',\n },\n renderItem: (params, api) => {\n const yValue = api.value(0);\n const xStart = api.coord([api.value(2), yValue]);\n const xEnd = api.coord([0, yValue]);\n const bucketWidthHeight = api.size ? (api.size([0, bucketWidth]) as number[])[1] : 0;\n const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;\n\n const rectShape = {\n x: xStart[0] - 0.5,\n y: xStart[1] - height / 2,\n width: xEnd[0] - xStart[0],\n height,\n };\n\n return {\n type: 'rect',\n shape: rectShape,\n style: api.style(),\n };\n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ZgC,KAAK,EAAEiC,SAAS;UAChBhC,KAAK,EAAEyB,GAAG,CAACzB,KAAK,CAAC;QACnB,CAAC;MACH;IACF,CAAC;EAEL,CAAC;AAAA,CACF;AAACwC,OAAA,CAAAjH,UAAA,GAAAA,UAAA"}
@@ -1,315 +0,0 @@
1
- import { chartSharedOptions } from '@oanda/labs-widget-common';
2
- import { ZOOM_BARS, INITIAL_BARS } from './constants';
3
- export const getOptions = _ref => {
4
- let {
5
- data,
6
- price,
7
- bucketWidth
8
- } = _ref;
9
- return {
10
- toolbox: {
11
- itemSize: 18,
12
- itemGap: 14,
13
- bottom: 6,
14
- right: 6,
15
- showTitle: false,
16
- iconStyle: {
17
- borderColor: '#00214A'
18
- },
19
- emphasis: {
20
- iconStyle: {
21
- borderColor: '#008573'
22
- }
23
- },
24
- tooltip: {
25
- show: true,
26
- backgroundColor: '#00214A',
27
- formatter: val => val.title,
28
- position: 'top',
29
- confine: true,
30
- textStyle: {
31
- color: '#fff'
32
- }
33
- },
34
- feature: {
35
- myZoomIn: {
36
- show: true,
37
- title: 'Zoom in',
38
- icon: chartSharedOptions.icons.zoomInIcon,
39
- onclick: (model, instance) => {
40
- const {
41
- startValue,
42
- endValue
43
- } = model.option.dataZoom[0];
44
- const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;
45
- instance.dispatchAction({
46
- type: 'dataZoom',
47
- startValue: startValue + halfZoomValue,
48
- endValue: endValue - halfZoomValue
49
- });
50
- }
51
- },
52
- myZoomOut: {
53
- show: true,
54
- title: 'Zoom out',
55
- icon: chartSharedOptions.icons.zoomOutIcon,
56
- onclick: (model, instance) => {
57
- const {
58
- startValue,
59
- endValue
60
- } = model.option.dataZoom[0];
61
- const halfZoomValue = 0.5 * ZOOM_BARS * bucketWidth;
62
- instance.dispatchAction({
63
- type: 'dataZoom',
64
- startValue: startValue - halfZoomValue,
65
- endValue: endValue + halfZoomValue
66
- });
67
- }
68
- },
69
- myResetZoom: {
70
- show: true,
71
- title: 'ResetZoom',
72
- icon: chartSharedOptions.icons.resetZoomIcon,
73
- onclick: (model, instance) => {
74
- instance.dispatchAction({
75
- type: 'dataZoom',
76
- startValue: price - bucketWidth * INITIAL_BARS * 0.5,
77
- endValue: price + bucketWidth * INITIAL_BARS * 0.5
78
- });
79
- }
80
- }
81
- }
82
- },
83
- dataZoom: [{
84
- type: 'inside',
85
- realtime: true,
86
- startValue: price - bucketWidth * INITIAL_BARS * 0.5,
87
- endValue: price + bucketWidth * INITIAL_BARS * 0.5,
88
- yAxisIndex: 0
89
- }],
90
- dataset: {
91
- source: data
92
- },
93
- textStyle: {},
94
- tooltip: {
95
- trigger: 'axis',
96
- borderRadius: 0,
97
- shadowBlur: 24,
98
- shadowOffsetX: 0,
99
- shadowOffsetY: 6,
100
- shadowColor: 'rgba(0,0,0,0.1)',
101
- textStyle: {},
102
- formatter: params => {
103
- const values = params[0].data;
104
- return "Price: ".concat(values[0], "<br />Buy: ").concat(values[1], "%<br/>Sell: ").concat(Math.abs(values[2]), "%");
105
- },
106
- axisPointer: {
107
- axis: 'y'
108
- }
109
- },
110
- grid: [{
111
- top: '1px',
112
- left: '1px',
113
- right: '121px',
114
- bottom: '41px',
115
- show: true
116
- }, {
117
- bottom: '1px',
118
- right: '1px',
119
- width: '120px',
120
- height: '40px',
121
- show: true
122
- }, {
123
- top: '1px',
124
- left: '1px',
125
- right: '1px',
126
- bottom: '1px',
127
- show: true
128
- }],
129
- graphic: [{
130
- type: 'group',
131
- left: '8px',
132
- top: '8px',
133
- silent: true,
134
- children: [{
135
- type: 'rect',
136
- z: 100,
137
- left: 'center',
138
- top: 'middle',
139
- shape: {
140
- width: 60,
141
- height: 30
142
- },
143
- style: {
144
- fill: '#fff',
145
- shadowBlur: 8,
146
- shadowOffsetX: 0,
147
- shadowOffsetY: 1,
148
- shadowColor: 'rgba(0,0,0,0.1)'
149
- }
150
- }, {
151
- type: 'text',
152
- z: 100,
153
- left: 'center',
154
- top: 'middle',
155
- style: {
156
- width: 60,
157
- height: 30,
158
- text: 'Sell'
159
- }
160
- }]
161
- }, {
162
- type: 'group',
163
- right: '128px',
164
- top: '8px',
165
- silent: true,
166
- children: [{
167
- type: 'rect',
168
- z: 100,
169
- right: 'center',
170
- top: 'middle',
171
- shape: {
172
- width: 60,
173
- height: 30
174
- },
175
- style: {
176
- fill: '#fff',
177
- shadowBlur: 8,
178
- shadowOffsetX: 0,
179
- shadowOffsetY: 1,
180
- shadowColor: 'rgba(0,0,0,0.1)'
181
- }
182
- }, {
183
- type: 'text',
184
- z: 100,
185
- right: 'center',
186
- top: 'middle',
187
- style: {
188
- width: 60,
189
- height: 30,
190
- text: 'Buy'
191
- }
192
- }]
193
- }],
194
- yAxis: {
195
- type: 'value',
196
- position: 'right',
197
- axisLine: {
198
- show: false
199
- },
200
- axisTick: {
201
- show: false
202
- },
203
- splitLine: {
204
- lineStyle: {}
205
- },
206
- axisLabel: {
207
- padding: [0, 0, 0, 10],
208
- rich: {
209
- a: {
210
- padding: [0, 0, 16, 0]
211
- }
212
- },
213
- formatter: (value, index) => index ? "".concat(value) : "{a|".concat(value, "}")
214
- }
215
- },
216
- xAxis: {
217
- type: 'value',
218
- min: -1.1,
219
- max: 1.1,
220
- axisLine: {
221
- show: false
222
- },
223
- axisTick: {
224
- show: false
225
- },
226
- splitLine: {
227
- lineStyle: {}
228
- },
229
- axisLabel: {
230
- padding: [7, 0, 0, 0],
231
- showMinLabel: false,
232
- showMaxLabel: false,
233
- formatter: value => value === 0 ? '%' : "".concat(Math.abs(value), "%")
234
- }
235
- },
236
- series: [{
237
- type: 'custom',
238
- encode: {
239
- x: 1,
240
- y: 0,
241
- tooltip: 1
242
- },
243
- itemStyle: {
244
- color: '#00B89E'
245
- },
246
- renderItem: (params, api) => {
247
- const yValue = api.value(0);
248
- const xStart = api.coord([api.value(1), yValue]);
249
- const xEnd = api.coord([0, yValue]);
250
- const bucketWidthHeight = api.size ? api.size([0, bucketWidth])[1] : 0;
251
- const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;
252
- const rectShape = {
253
- x: xStart[0] + 0.5,
254
- y: xStart[1] - height / 2,
255
- width: xEnd[0] - xStart[0],
256
- height
257
- };
258
- return {
259
- type: 'rect',
260
- shape: rectShape,
261
- style: api.style()
262
- };
263
- }
264
- }, {
265
- type: 'custom',
266
- encode: {
267
- x: 1,
268
- y: 0,
269
- tooltip: 2
270
- },
271
- markLine: {
272
- animation: false,
273
- silent: true,
274
- precision: 4,
275
- symbol: ['none', 'triangle'],
276
- symbolRotate: 90,
277
- symbolSize: [20, 10],
278
- lineStyle: {
279
- color: '#008573',
280
- width: 1
281
- },
282
- label: {
283
- padding: [5, 15, 5, 15],
284
- color: '#fff',
285
- backgroundColor: '#008573'
286
- },
287
- data: [{
288
- yAxis: price
289
- }]
290
- },
291
- itemStyle: {
292
- color: '#E5226E'
293
- },
294
- renderItem: (params, api) => {
295
- const yValue = api.value(0);
296
- const xStart = api.coord([api.value(2), yValue]);
297
- const xEnd = api.coord([0, yValue]);
298
- const bucketWidthHeight = api.size ? api.size([0, bucketWidth])[1] : 0;
299
- const height = bucketWidthHeight > 4 ? bucketWidthHeight * 0.8 : bucketWidthHeight;
300
- const rectShape = {
301
- x: xStart[0] - 0.5,
302
- y: xStart[1] - height / 2,
303
- width: xEnd[0] - xStart[0],
304
- height
305
- };
306
- return {
307
- type: 'rect',
308
- shape: rectShape,
309
- style: api.style()
310
- };
311
- }
312
- }]
313
- };
314
- };
315
- //# sourceMappingURL=getOptions.js.map