@oanda/labs-order-book-widget 1.0.218 → 1.0.219
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.
- package/CHANGELOG.md +864 -0
- package/dist/main/OrderBookWidget/components/Chart/Chart.js +15 -32
- package/dist/main/OrderBookWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/OrderBookWidget/components/Chart/getOption.js +85 -113
- package/dist/main/OrderBookWidget/components/Chart/getOption.js.map +1 -1
- package/dist/main/OrderBookWidget/components/Chart/types.js.map +1 -1
- package/dist/module/OrderBookWidget/components/Chart/Chart.js +15 -33
- package/dist/module/OrderBookWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/OrderBookWidget/components/Chart/getOption.js +84 -111
- package/dist/module/OrderBookWidget/components/Chart/getOption.js.map +1 -1
- package/dist/module/OrderBookWidget/components/Chart/types.js.map +1 -1
- package/dist/types/OrderBookWidget/components/Chart/getOption.d.ts +1 -188
- package/dist/types/OrderBookWidget/components/Chart/types.d.ts +0 -6
- package/package.json +5 -5
- package/src/OrderBookWidget/components/Chart/Chart.tsx +23 -50
- package/src/OrderBookWidget/components/Chart/getOption.ts +93 -124
- package/src/OrderBookWidget/components/Chart/types.ts +0 -7
|
@@ -1,115 +1,7 @@
|
|
|
1
1
|
import { colorPalette, getGridLines, getZoomControls } from '@oanda/labs-widget-common';
|
|
2
2
|
import { CHART_HEIGHT_DESKTOP, CHART_HEIGHT_MOBILE, CHART_WIDTH, INITIAL_BARS, X_LABEL_SIZE, Y_LABEL_SIZE_DESKTOP, Y_LABEL_SIZE_MOBILE, ZOOM_CONTROL_HEIGHT } from './constants';
|
|
3
3
|
import { tooltipFormatter } from './formatters';
|
|
4
|
-
export const
|
|
5
|
-
let {
|
|
6
|
-
isDark,
|
|
7
|
-
isOrderBook,
|
|
8
|
-
isDesktop,
|
|
9
|
-
lang
|
|
10
|
-
} = _ref;
|
|
11
|
-
const desktopGridLines = getGridLines({
|
|
12
|
-
isDark,
|
|
13
|
-
chartWidth: CHART_WIDTH,
|
|
14
|
-
chartHeight: isDesktop ? CHART_HEIGHT_DESKTOP : CHART_HEIGHT_MOBILE,
|
|
15
|
-
xLabelsSize: isDesktop ? X_LABEL_SIZE : X_LABEL_SIZE + ZOOM_CONTROL_HEIGHT,
|
|
16
|
-
yLabelSize: isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE,
|
|
17
|
-
bottomLeftBox: isDesktop,
|
|
18
|
-
marginBottom: isDesktop ? 0 : ZOOM_CONTROL_HEIGHT
|
|
19
|
-
});
|
|
20
|
-
return {
|
|
21
|
-
grid: [{
|
|
22
|
-
name: 'main-grid',
|
|
23
|
-
top: '48px',
|
|
24
|
-
left: '0px',
|
|
25
|
-
right: `${isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE}px`,
|
|
26
|
-
bottom: `${isDesktop ? X_LABEL_SIZE : X_LABEL_SIZE + ZOOM_CONTROL_HEIGHT}px`
|
|
27
|
-
}],
|
|
28
|
-
yAxis: {
|
|
29
|
-
axisLabel: {
|
|
30
|
-
margin: isDesktop ? 10 : 0
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
series: [{
|
|
34
|
-
type: 'custom',
|
|
35
|
-
name: 'current-price',
|
|
36
|
-
id: 'current-price',
|
|
37
|
-
markLine: {
|
|
38
|
-
label: {
|
|
39
|
-
padding: isDesktop ? [5, 15, 5, 15] : [5, 12, 5, 5]
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}],
|
|
43
|
-
graphic: [...desktopGridLines, {
|
|
44
|
-
type: 'group',
|
|
45
|
-
left: '8px',
|
|
46
|
-
top: '56px',
|
|
47
|
-
silent: true,
|
|
48
|
-
children: [{
|
|
49
|
-
type: 'rect',
|
|
50
|
-
z: 100,
|
|
51
|
-
left: 'center',
|
|
52
|
-
top: 'middle',
|
|
53
|
-
shape: {
|
|
54
|
-
width: 70,
|
|
55
|
-
height: 30
|
|
56
|
-
},
|
|
57
|
-
style: {
|
|
58
|
-
fill: isDark ? colorPalette.darkGray : colorPalette.white,
|
|
59
|
-
shadowBlur: 8,
|
|
60
|
-
shadowOffsetX: 0,
|
|
61
|
-
shadowOffsetY: 1,
|
|
62
|
-
shadowColor: 'rgba(0,0,0,0.1)'
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
|
-
type: 'text',
|
|
66
|
-
z: 100,
|
|
67
|
-
left: 'center',
|
|
68
|
-
top: 'middle',
|
|
69
|
-
style: {
|
|
70
|
-
fill: isDark ? colorPalette.white : colorPalette.black,
|
|
71
|
-
width: 70,
|
|
72
|
-
height: 30,
|
|
73
|
-
text: lang(isOrderBook ? 'sell' : 'short')
|
|
74
|
-
}
|
|
75
|
-
}]
|
|
76
|
-
}, {
|
|
77
|
-
type: 'group',
|
|
78
|
-
right: `${(isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) + 8}px'`,
|
|
79
|
-
top: '56px',
|
|
80
|
-
silent: true,
|
|
81
|
-
children: [{
|
|
82
|
-
type: 'rect',
|
|
83
|
-
z: 100,
|
|
84
|
-
right: 'center',
|
|
85
|
-
top: 'middle',
|
|
86
|
-
shape: {
|
|
87
|
-
width: 70,
|
|
88
|
-
height: 30
|
|
89
|
-
},
|
|
90
|
-
style: {
|
|
91
|
-
fill: isDark ? colorPalette.darkGray : colorPalette.white,
|
|
92
|
-
shadowBlur: 8,
|
|
93
|
-
shadowOffsetX: 0,
|
|
94
|
-
shadowOffsetY: 1,
|
|
95
|
-
shadowColor: 'rgba(0,0,0,0.1)'
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
type: 'text',
|
|
99
|
-
z: 100,
|
|
100
|
-
right: 'center',
|
|
101
|
-
top: 'middle',
|
|
102
|
-
style: {
|
|
103
|
-
fill: isDark ? colorPalette.white : colorPalette.black,
|
|
104
|
-
width: 70,
|
|
105
|
-
height: 30,
|
|
106
|
-
text: lang(isOrderBook ? 'buy' : 'long')
|
|
107
|
-
}
|
|
108
|
-
}]
|
|
109
|
-
}]
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
export const getOption = _ref2 => {
|
|
4
|
+
export const getOption = _ref => {
|
|
113
5
|
let {
|
|
114
6
|
data,
|
|
115
7
|
precision,
|
|
@@ -117,7 +9,7 @@ export const getOption = _ref2 => {
|
|
|
117
9
|
isOrderBook,
|
|
118
10
|
isDesktop,
|
|
119
11
|
lang
|
|
120
|
-
} =
|
|
12
|
+
} = _ref;
|
|
121
13
|
const buckets = data.orderPositionBooks[0]?.buckets || [];
|
|
122
14
|
const bucketWidth = data.orderPositionBooks[0]?.bucketWidth;
|
|
123
15
|
const price = data.orderPositionBooks[0]?.price;
|
|
@@ -128,17 +20,30 @@ export const getOption = _ref2 => {
|
|
|
128
20
|
const max = Math.max(...dataset.map(item => item[1]));
|
|
129
21
|
const min = Math.abs(Math.min(...dataset.map(item => item[2])));
|
|
130
22
|
const range = max > min ? max : min;
|
|
23
|
+
const gridLines = getGridLines({
|
|
24
|
+
isDark,
|
|
25
|
+
chartWidth: CHART_WIDTH,
|
|
26
|
+
chartHeight: isDesktop ? CHART_HEIGHT_DESKTOP : CHART_HEIGHT_MOBILE,
|
|
27
|
+
xLabelsSize: isDesktop ? X_LABEL_SIZE : X_LABEL_SIZE + ZOOM_CONTROL_HEIGHT,
|
|
28
|
+
yLabelSize: isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE,
|
|
29
|
+
bottomLeftBox: isDesktop,
|
|
30
|
+
marginBottom: isDesktop ? 0 : ZOOM_CONTROL_HEIGHT
|
|
31
|
+
});
|
|
131
32
|
return {
|
|
132
33
|
animation: false,
|
|
133
34
|
color: [colorPalette.bottleGreenLight, isDark ? colorPalette.orange : colorPalette.raspberryDark],
|
|
134
35
|
title: {
|
|
135
36
|
text: lang(isOrderBook ? 'open_orders' : 'open_positions').toUpperCase(),
|
|
136
37
|
padding: 20,
|
|
38
|
+
top: 0,
|
|
39
|
+
left: 0,
|
|
137
40
|
textStyle: {
|
|
138
41
|
fontSize: 14
|
|
139
42
|
}
|
|
140
43
|
},
|
|
141
44
|
toolbox: {
|
|
45
|
+
bottom: -4,
|
|
46
|
+
right: -4,
|
|
142
47
|
feature: getZoomControls({
|
|
143
48
|
resetStartValue: zoomInitialStartValue,
|
|
144
49
|
resetEndValue: zoomInitialEndValue
|
|
@@ -303,13 +208,81 @@ export const getOption = _ref2 => {
|
|
|
303
208
|
overflow: 'truncate',
|
|
304
209
|
width: isDesktop ? undefined : Y_LABEL_SIZE_MOBILE,
|
|
305
210
|
color: isDark ? colorPalette.black : colorPalette.white,
|
|
306
|
-
backgroundColor: isDark ? colorPalette.orange : colorPalette.bottleGreenDark
|
|
211
|
+
backgroundColor: isDark ? colorPalette.orange : colorPalette.bottleGreenDark,
|
|
212
|
+
padding: isDesktop ? [5, 15, 5, 15] : [5, 12, 5, 5]
|
|
307
213
|
},
|
|
308
214
|
data: [{
|
|
309
215
|
yAxis: price
|
|
310
216
|
}]
|
|
311
217
|
},
|
|
312
218
|
renderItem: () => null
|
|
219
|
+
}],
|
|
220
|
+
graphic: [...gridLines, {
|
|
221
|
+
type: 'group',
|
|
222
|
+
left: '8px',
|
|
223
|
+
top: '56px',
|
|
224
|
+
silent: true,
|
|
225
|
+
children: [{
|
|
226
|
+
type: 'rect',
|
|
227
|
+
z: 100,
|
|
228
|
+
left: 'center',
|
|
229
|
+
top: 'middle',
|
|
230
|
+
shape: {
|
|
231
|
+
width: 70,
|
|
232
|
+
height: 30
|
|
233
|
+
},
|
|
234
|
+
style: {
|
|
235
|
+
fill: isDark ? colorPalette.darkGray : colorPalette.white,
|
|
236
|
+
shadowBlur: 8,
|
|
237
|
+
shadowOffsetX: 0,
|
|
238
|
+
shadowOffsetY: 1,
|
|
239
|
+
shadowColor: 'rgba(0,0,0,0.1)'
|
|
240
|
+
}
|
|
241
|
+
}, {
|
|
242
|
+
type: 'text',
|
|
243
|
+
z: 100,
|
|
244
|
+
left: 'center',
|
|
245
|
+
top: 'middle',
|
|
246
|
+
style: {
|
|
247
|
+
fill: isDark ? colorPalette.white : colorPalette.black,
|
|
248
|
+
width: 70,
|
|
249
|
+
height: 30,
|
|
250
|
+
text: lang(isOrderBook ? 'sell' : 'short')
|
|
251
|
+
}
|
|
252
|
+
}]
|
|
253
|
+
}, {
|
|
254
|
+
type: 'group',
|
|
255
|
+
right: `${(isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) + 8}px'`,
|
|
256
|
+
top: '56px',
|
|
257
|
+
silent: true,
|
|
258
|
+
children: [{
|
|
259
|
+
type: 'rect',
|
|
260
|
+
z: 100,
|
|
261
|
+
right: 'center',
|
|
262
|
+
top: 'middle',
|
|
263
|
+
shape: {
|
|
264
|
+
width: 70,
|
|
265
|
+
height: 30
|
|
266
|
+
},
|
|
267
|
+
style: {
|
|
268
|
+
fill: isDark ? colorPalette.darkGray : colorPalette.white,
|
|
269
|
+
shadowBlur: 8,
|
|
270
|
+
shadowOffsetX: 0,
|
|
271
|
+
shadowOffsetY: 1,
|
|
272
|
+
shadowColor: 'rgba(0,0,0,0.1)'
|
|
273
|
+
}
|
|
274
|
+
}, {
|
|
275
|
+
type: 'text',
|
|
276
|
+
z: 100,
|
|
277
|
+
right: 'center',
|
|
278
|
+
top: 'middle',
|
|
279
|
+
style: {
|
|
280
|
+
fill: isDark ? colorPalette.white : colorPalette.black,
|
|
281
|
+
width: 70,
|
|
282
|
+
height: 30,
|
|
283
|
+
text: lang(isOrderBook ? 'buy' : 'long')
|
|
284
|
+
}
|
|
285
|
+
}]
|
|
313
286
|
}]
|
|
314
287
|
};
|
|
315
288
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["colorPalette","getGridLines","getZoomControls","CHART_HEIGHT_DESKTOP","CHART_HEIGHT_MOBILE","CHART_WIDTH","INITIAL_BARS","X_LABEL_SIZE","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","ZOOM_CONTROL_HEIGHT","tooltipFormatter","getResponsiveOption","_ref","isDark","isOrderBook","isDesktop","lang","desktopGridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","marginBottom","grid","name","top","left","right","bottom","yAxis","axisLabel","margin","series","type","id","markLine","label","padding","graphic","silent","children","z","shape","width","height","style","fill","darkGray","white","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor","black","text","getOption","_ref2","data","precision","buckets","orderPositionBooks","bucketWidth","price","bucketPrecision","toString","split","length","dataset","map","item","Number","longCountPercent","shortCountPercent","zoomInitialStartValue","zoomInitialEndValue","max","Math","min","abs","range","animation","color","bottleGreenLight","orange","raspberryDark","title","toUpperCase","textStyle","fontSize","toolbox","feature","resetStartValue","resetEndValue","dataZoom","realtime","startValue","endValue","yAxisIndex","minValueSpan","tooltip","trigger","axisPointer","axis","formatter","val","extraCssText","xAxis","floor","ceil","axisTick","show","axisLine","value","hideOverlap","alignMaxLabel","alignMinLabel","position","overflow","showMaxLabel","showMinLabel","toFixed","source","clip","encode","x","y","renderItem","params","api","yValue","xStart","coord","xEnd","bucketWidthHeight","size","rectShape","emphasis","visual","symbol","symbolOffset","symbolRotate","symbolSize","lineStyle","bottleGreenDark","distance","undefined","backgroundColor"],"sources":["../../../../../src/OrderBookWidget/components/Chart/getOption.ts"],"sourcesContent":["import {\n colorPalette,\n getGridLines,\n getZoomControls,\n} from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT_DESKTOP,\n CHART_HEIGHT_MOBILE,\n CHART_WIDTH,\n INITIAL_BARS,\n X_LABEL_SIZE,\n Y_LABEL_SIZE_DESKTOP,\n Y_LABEL_SIZE_MOBILE,\n ZOOM_CONTROL_HEIGHT,\n} from './constants';\nimport { tooltipFormatter } from './formatters';\nimport type { GetOptionType, GetResponsiveOptionsProps } from './types';\n\nexport const getResponsiveOption = ({\n isDark,\n isOrderBook,\n isDesktop,\n lang,\n}: GetResponsiveOptionsProps) => {\n const desktopGridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: isDesktop ? CHART_HEIGHT_DESKTOP : CHART_HEIGHT_MOBILE,\n xLabelsSize: isDesktop ? X_LABEL_SIZE : X_LABEL_SIZE + ZOOM_CONTROL_HEIGHT,\n yLabelSize: isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE,\n bottomLeftBox: isDesktop,\n marginBottom: isDesktop ? 0 : ZOOM_CONTROL_HEIGHT,\n });\n\n return {\n grid: [\n {\n name: 'main-grid',\n top: '48px',\n left: '0px',\n right: `${isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE}px`,\n bottom: `${isDesktop ? X_LABEL_SIZE : X_LABEL_SIZE + ZOOM_CONTROL_HEIGHT}px`,\n },\n ],\n yAxis: {\n axisLabel: {\n margin: isDesktop ? 10 : 0,\n },\n },\n series: [\n {\n type: 'custom',\n name: 'current-price',\n id: 'current-price',\n markLine: {\n label: {\n padding: isDesktop ? [5, 15, 5, 15] : [5, 12, 5, 5],\n },\n },\n },\n ],\n graphic: [\n ...desktopGridLines,\n {\n type: 'group',\n left: '8px',\n top: '56px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n left: 'center',\n top: 'middle',\n shape: {\n width: 70,\n height: 30,\n },\n style: {\n fill: isDark ? colorPalette.darkGray : colorPalette.white,\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 fill: isDark ? colorPalette.white : colorPalette.black,\n width: 70,\n height: 30,\n text: lang(isOrderBook ? 'sell' : 'short'),\n },\n },\n ],\n },\n {\n type: 'group',\n right: `${(isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) + 8}px'`,\n top: '56px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 70,\n height: 30,\n },\n style: {\n fill: isDark ? colorPalette.darkGray : colorPalette.white,\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 fill: isDark ? colorPalette.white : colorPalette.black,\n width: 70,\n height: 30,\n text: lang(isOrderBook ? 'buy' : 'long'),\n },\n },\n ],\n },\n ],\n };\n};\n\nexport const getOption: GetOptionType = ({\n data,\n precision,\n isDark,\n isOrderBook,\n isDesktop,\n lang,\n}) => {\n const buckets = data.orderPositionBooks[0]?.buckets || [];\n const bucketWidth = data.orderPositionBooks[0]?.bucketWidth!;\n const price = data.orderPositionBooks[0]?.price!;\n const bucketPrecision = bucketWidth.toString().split('.')[1].length || 0;\n\n const dataset = buckets.map((item) => [\n item!.price,\n Number(item!.longCountPercent),\n Number(item!.shortCountPercent) * -1,\n ]);\n\n const zoomInitialStartValue = price - bucketWidth * INITIAL_BARS * 0.5;\n const zoomInitialEndValue = price + bucketWidth * INITIAL_BARS * 0.5;\n\n const max = Math.max(...dataset.map((item) => item[1]));\n const min = Math.abs(Math.min(...dataset.map((item) => item[2])));\n\n const range = max > min ? max : min;\n\n return {\n animation: false,\n color: [\n colorPalette.bottleGreenLight,\n isDark ? colorPalette.orange : colorPalette.raspberryDark,\n ],\n title: {\n text: lang(isOrderBook ? 'open_orders' : 'open_positions').toUpperCase(),\n padding: 20,\n textStyle: {\n fontSize: 14,\n },\n },\n toolbox: {\n feature: getZoomControls({\n resetStartValue: zoomInitialStartValue,\n resetEndValue: zoomInitialEndValue,\n }),\n },\n dataZoom: [\n {\n type: 'inside',\n realtime: true,\n startValue: zoomInitialStartValue,\n endValue: zoomInitialEndValue,\n\n yAxisIndex: 0,\n minValueSpan: 10 * bucketWidth,\n },\n ],\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'y',\n },\n formatter: (val) =>\n tooltipFormatter({\n data: (val as { data: number[] }[])[0].data,\n precision: bucketPrecision,\n isOrderBook,\n lang,\n }),\n extraCssText: 'z-index: 1',\n },\n grid: [\n {\n name: 'main-grid',\n top: '48px',\n left: '0px',\n right: `${isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE}px`,\n bottom: `${isDesktop ? X_LABEL_SIZE : X_LABEL_SIZE + ZOOM_CONTROL_HEIGHT}px`,\n },\n ],\n xAxis: {\n type: 'value',\n min: Math.floor(range * -1.1),\n max: Math.ceil(range * 1.1),\n axisTick: { show: false },\n axisLine: { show: false },\n axisLabel: {\n padding: [7, 12, 0, 12],\n formatter: (value) => (value === 0 ? '%' : `${Math.abs(value)}%`),\n hideOverlap: true,\n alignMaxLabel: 'right',\n alignMinLabel: 'left',\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n overflow: 'truncate',\n width: (isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) - 10,\n margin: isDesktop ? 10 : 0,\n showMaxLabel: false,\n showMinLabel: false,\n padding: [0, 0, 0, 10],\n formatter: (value) => value.toFixed(bucketPrecision),\n },\n },\n dataset: {\n source: dataset,\n },\n series: [\n {\n type: 'custom',\n name: 'sell-short',\n id: 'sell-short',\n clip: true,\n encode: {\n x: 1,\n y: 0,\n tooltip: 1,\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\n ? (api.size([0, bucketWidth]) as number[])[1]\n : 0;\n const height =\n 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 emphasis: {\n style: {\n fill: colorPalette.bottleGreenLight,\n },\n },\n style: {\n fill: api.visual('color'),\n },\n };\n },\n },\n {\n type: 'custom',\n name: 'buy-long',\n id: 'buy-long',\n clip: true,\n encode: {\n x: 1,\n y: 0,\n tooltip: 2,\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\n ? (api.size([0, bucketWidth]) as number[])[1]\n : 0;\n const height =\n 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 emphasis: {\n style: {\n fill: isDark ? colorPalette.orange : colorPalette.raspberryDark,\n },\n },\n style: {\n fill: api.visual('color'),\n },\n };\n },\n },\n {\n type: 'custom',\n name: 'current-price',\n id: 'current-price',\n markLine: {\n animation: false,\n silent: true,\n precision,\n symbol: ['none', 'triangle'],\n symbolOffset: [0, [0, isDesktop ? 0 : -10]] as unknown as number,\n symbolRotate: 90,\n symbolSize: [20, 10],\n lineStyle: {\n color: isDark ? colorPalette.orange : colorPalette.bottleGreenDark,\n width: 1,\n },\n label: {\n distance: isDesktop ? 5 : -5,\n overflow: 'truncate',\n width: isDesktop ? undefined : Y_LABEL_SIZE_MOBILE,\n color: isDark ? colorPalette.black : colorPalette.white,\n backgroundColor: isDark\n ? colorPalette.orange\n : colorPalette.bottleGreenDark,\n },\n data: [\n {\n yAxis: price,\n },\n ],\n },\n renderItem: () => null,\n },\n ],\n };\n};\n"],"mappings":"AAAA,SACEA,YAAY,EACZC,YAAY,EACZC,eAAe,QACV,2BAA2B;AAElC,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,oBAAoB,EACpBC,mBAAmB,EACnBC,mBA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,CAACqF,MAAM,GAAGrF,YAAY,CAACiJ,eAAe;UAClEpG,KAAK,EAAE;QACT,CAAC;QACDP,KAAK,EAAE;UACL4G,QAAQ,EAAElI,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;UAC5BuG,QAAQ,EAAE,UAAU;UACpB1E,KAAK,EAAE7B,SAAS,GAAGmI,SAAS,GAAG1I,mBAAmB;UAClD0E,KAAK,EAAErE,MAAM,GAAGd,YAAY,CAACuD,KAAK,GAAGvD,YAAY,CAACkD,KAAK;UACvDkG,eAAe,EAAEtI,MAAM,GACnBd,YAAY,CAACqF,MAAM,GACnBrF,YAAY,CAACiJ;QACnB,CAAC;QACDtF,IAAI,EAAE,CACJ;UACE5B,KAAK,EAAEiC;QACT,CAAC;MAEL,CAAC;MACDgE,UAAU,EAAEA,CAAA,KAAM;IACpB,CAAC;EAEL,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["colorPalette","getGridLines","getZoomControls","CHART_HEIGHT_DESKTOP","CHART_HEIGHT_MOBILE","CHART_WIDTH","INITIAL_BARS","X_LABEL_SIZE","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","ZOOM_CONTROL_HEIGHT","tooltipFormatter","getOption","_ref","data","precision","isDark","isOrderBook","isDesktop","lang","buckets","orderPositionBooks","bucketWidth","price","bucketPrecision","toString","split","length","dataset","map","item","Number","longCountPercent","shortCountPercent","zoomInitialStartValue","zoomInitialEndValue","max","Math","min","abs","range","gridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","marginBottom","animation","color","bottleGreenLight","orange","raspberryDark","title","text","toUpperCase","padding","top","left","textStyle","fontSize","toolbox","bottom","right","feature","resetStartValue","resetEndValue","dataZoom","type","realtime","startValue","endValue","yAxisIndex","minValueSpan","tooltip","trigger","axisPointer","axis","formatter","val","extraCssText","grid","name","xAxis","floor","ceil","axisTick","show","axisLine","axisLabel","value","hideOverlap","alignMaxLabel","alignMinLabel","yAxis","position","overflow","width","margin","showMaxLabel","showMinLabel","toFixed","source","series","id","clip","encode","x","y","renderItem","params","api","yValue","xStart","coord","xEnd","bucketWidthHeight","size","height","rectShape","shape","emphasis","style","fill","visual","markLine","silent","symbol","symbolOffset","symbolRotate","symbolSize","lineStyle","bottleGreenDark","label","distance","undefined","black","white","backgroundColor","graphic","children","z","darkGray","shadowBlur","shadowOffsetX","shadowOffsetY","shadowColor"],"sources":["../../../../../src/OrderBookWidget/components/Chart/getOption.ts"],"sourcesContent":["import {\n colorPalette,\n getGridLines,\n getZoomControls,\n} from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT_DESKTOP,\n CHART_HEIGHT_MOBILE,\n CHART_WIDTH,\n INITIAL_BARS,\n X_LABEL_SIZE,\n Y_LABEL_SIZE_DESKTOP,\n Y_LABEL_SIZE_MOBILE,\n ZOOM_CONTROL_HEIGHT,\n} from './constants';\nimport { tooltipFormatter } from './formatters';\nimport type { GetOptionType } from './types';\n\nexport const getOption: GetOptionType = ({\n data,\n precision,\n isDark,\n isOrderBook,\n isDesktop,\n lang,\n}) => {\n const buckets = data.orderPositionBooks[0]?.buckets || [];\n const bucketWidth = data.orderPositionBooks[0]?.bucketWidth!;\n const price = data.orderPositionBooks[0]?.price!;\n const bucketPrecision = bucketWidth.toString().split('.')[1].length || 0;\n\n const dataset = buckets.map((item) => [\n item!.price,\n Number(item!.longCountPercent),\n Number(item!.shortCountPercent) * -1,\n ]);\n\n const zoomInitialStartValue = price - bucketWidth * INITIAL_BARS * 0.5;\n const zoomInitialEndValue = price + bucketWidth * INITIAL_BARS * 0.5;\n\n const max = Math.max(...dataset.map((item) => item[1]));\n const min = Math.abs(Math.min(...dataset.map((item) => item[2])));\n\n const range = max > min ? max : min;\n\n const gridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: isDesktop ? CHART_HEIGHT_DESKTOP : CHART_HEIGHT_MOBILE,\n xLabelsSize: isDesktop ? X_LABEL_SIZE : X_LABEL_SIZE + ZOOM_CONTROL_HEIGHT,\n yLabelSize: isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE,\n bottomLeftBox: isDesktop,\n marginBottom: isDesktop ? 0 : ZOOM_CONTROL_HEIGHT,\n });\n\n return {\n animation: false,\n color: [\n colorPalette.bottleGreenLight,\n isDark ? colorPalette.orange : colorPalette.raspberryDark,\n ],\n title: {\n text: lang(isOrderBook ? 'open_orders' : 'open_positions').toUpperCase(),\n padding: 20,\n top: 0,\n left: 0,\n textStyle: {\n fontSize: 14,\n },\n },\n toolbox: {\n bottom: -4,\n right: -4,\n feature: getZoomControls({\n resetStartValue: zoomInitialStartValue,\n resetEndValue: zoomInitialEndValue,\n }),\n },\n dataZoom: [\n {\n type: 'inside',\n realtime: true,\n startValue: zoomInitialStartValue,\n endValue: zoomInitialEndValue,\n\n yAxisIndex: 0,\n minValueSpan: 10 * bucketWidth,\n },\n ],\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'y',\n },\n formatter: (val) =>\n tooltipFormatter({\n data: (val as { data: number[] }[])[0].data,\n precision: bucketPrecision,\n isOrderBook,\n lang,\n }),\n extraCssText: 'z-index: 1',\n },\n grid: [\n {\n name: 'main-grid',\n top: '48px',\n left: '0px',\n right: `${isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE}px`,\n bottom: `${isDesktop ? X_LABEL_SIZE : X_LABEL_SIZE + ZOOM_CONTROL_HEIGHT}px`,\n },\n ],\n xAxis: {\n type: 'value',\n min: Math.floor(range * -1.1),\n max: Math.ceil(range * 1.1),\n axisTick: { show: false },\n axisLine: { show: false },\n axisLabel: {\n padding: [7, 12, 0, 12],\n formatter: (value) => (value === 0 ? '%' : `${Math.abs(value)}%`),\n hideOverlap: true,\n alignMaxLabel: 'right',\n alignMinLabel: 'left',\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n overflow: 'truncate',\n width: (isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) - 10,\n margin: isDesktop ? 10 : 0,\n showMaxLabel: false,\n showMinLabel: false,\n padding: [0, 0, 0, 10],\n formatter: (value) => value.toFixed(bucketPrecision),\n },\n },\n dataset: {\n source: dataset,\n },\n series: [\n {\n type: 'custom',\n name: 'sell-short',\n id: 'sell-short',\n clip: true,\n encode: {\n x: 1,\n y: 0,\n tooltip: 1,\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\n ? (api.size([0, bucketWidth]) as number[])[1]\n : 0;\n const height =\n 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 emphasis: {\n style: {\n fill: colorPalette.bottleGreenLight,\n },\n },\n style: {\n fill: api.visual('color'),\n },\n };\n },\n },\n {\n type: 'custom',\n name: 'buy-long',\n id: 'buy-long',\n clip: true,\n encode: {\n x: 1,\n y: 0,\n tooltip: 2,\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\n ? (api.size([0, bucketWidth]) as number[])[1]\n : 0;\n const height =\n 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 emphasis: {\n style: {\n fill: isDark ? colorPalette.orange : colorPalette.raspberryDark,\n },\n },\n style: {\n fill: api.visual('color'),\n },\n };\n },\n },\n {\n type: 'custom',\n name: 'current-price',\n id: 'current-price',\n markLine: {\n animation: false,\n silent: true,\n precision,\n symbol: ['none', 'triangle'],\n symbolOffset: [0, [0, isDesktop ? 0 : -10]] as unknown as number,\n symbolRotate: 90,\n symbolSize: [20, 10],\n lineStyle: {\n color: isDark ? colorPalette.orange : colorPalette.bottleGreenDark,\n width: 1,\n },\n label: {\n distance: isDesktop ? 5 : -5,\n overflow: 'truncate',\n width: isDesktop ? undefined : Y_LABEL_SIZE_MOBILE,\n color: isDark ? colorPalette.black : colorPalette.white,\n backgroundColor: isDark\n ? colorPalette.orange\n : colorPalette.bottleGreenDark,\n padding: isDesktop ? [5, 15, 5, 15] : [5, 12, 5, 5],\n },\n data: [\n {\n yAxis: price,\n },\n ],\n },\n renderItem: () => null,\n },\n ],\n graphic: [\n ...gridLines,\n {\n type: 'group',\n left: '8px',\n top: '56px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n left: 'center',\n top: 'middle',\n shape: {\n width: 70,\n height: 30,\n },\n style: {\n fill: isDark ? colorPalette.darkGray : colorPalette.white,\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 fill: isDark ? colorPalette.white : colorPalette.black,\n width: 70,\n height: 30,\n text: lang(isOrderBook ? 'sell' : 'short'),\n },\n },\n ],\n },\n {\n type: 'group',\n right: `${(isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) + 8}px'`,\n top: '56px',\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 70,\n height: 30,\n },\n style: {\n fill: isDark ? colorPalette.darkGray : colorPalette.white,\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 fill: isDark ? colorPalette.white : colorPalette.black,\n width: 70,\n height: 30,\n text: lang(isOrderBook ? 'buy' : 'long'),\n },\n },\n ],\n },\n ],\n };\n};\n"],"mappings":"AAAA,SACEA,YAAY,EACZC,YAAY,EACZC,eAAe,QACV,2BAA2B;AAElC,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,oBAAoB,EACpBC,mBAAmB,EACnBC,mBAAmB,QACd,aAAa;AACpB,SAASC,gBAAgB,QAAQ,cAAc;AAG/C,OAAO,MAAMC,SAAwB,GAAGC,IAAA,IAOlC;EAAA,IAPmC;IACvCC,IAAI;IACJC,SAAS;IACTC,MAAM;IACNC,WAAW;IACXC,SAAS;IACTC;EACF,CAAC,GAAAN,IAAA;EACC,MAAMO,OAAO,GAAGN,IAAI,CAACO,kBAAkB,CAAC,CAAC,CAAC,EAAED,OAAO,IAAI,EAAE;EACzD,MAAME,WAAW,GAAGR,IAAI,CAACO,kBAAkB,CAAC,CAAC,CAAC,EAAEC,WAAY;EAC5D,MAAMC,KAAK,GAAGT,IAAI,CAACO,kBAAkB,CAAC,CAAC,CAAC,EAAEE,KAAM;EAChD,MAAMC,eAAe,GAAGF,WAAW,CAACG,QAAQ,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAACC,MAAM,IAAI,CAAC;EAExE,MAAMC,OAAO,GAAGR,OAAO,CAACS,GAAG,CAAEC,IAAI,IAAK,CACpCA,IAAI,CAAEP,KAAK,EACXQ,MAAM,CAACD,IAAI,CAAEE,gBAAgB,CAAC,EAC9BD,MAAM,CAACD,IAAI,CAAEG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CACrC,CAAC;EAEF,MAAMC,qBAAqB,GAAGX,KAAK,GAAGD,WAAW,GAAGhB,YAAY,GAAG,GAAG;EACtE,MAAM6B,mBAAmB,GAAGZ,KAAK,GAAGD,WAAW,GAAGhB,YAAY,GAAG,GAAG;EAE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AE,QAAQ;QACfN,GAAG,EAAE,QAAQ;QACbiE,KAAK,EAAE;UACLC,IAAI,EAAE3G,MAAM,GAAGhB,YAAY,CAACyI,KAAK,GAAGzI,YAAY,CAACwI,KAAK;UACtDvC,KAAK,EAAE,EAAE;UACTqB,MAAM,EAAE,EAAE;UACVhE,IAAI,EAAEnC,IAAI,CAACF,WAAW,GAAG,KAAK,GAAG,MAAM;QACzC;MACF,CAAC;IAEL,CAAC;EAEL,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/OrderBookWidget/components/Chart/types.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts';\n\nimport type { GetOrderPositionBooksQuery } from '../../../gql/types/graphql';\n\nexport interface ChartProps {\n data: GetOrderPositionBooksQuery;\n isOrderBook: boolean;\n precision: number;\n}\n\nexport interface
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/OrderBookWidget/components/Chart/types.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts';\n\nimport type { GetOrderPositionBooksQuery } from '../../../gql/types/graphql';\n\nexport interface ChartProps {\n data: GetOrderPositionBooksQuery;\n isOrderBook: boolean;\n precision: number;\n}\n\nexport interface GetOptionProps {\n data: GetOrderPositionBooksQuery;\n precision: number;\n isDark: boolean;\n isOrderBook: boolean;\n isDesktop: boolean;\n lang: (label: string) => string;\n}\n\nexport type GetOptionType = (props: GetOptionProps) => EChartsOption;\n\nexport type TooltipFormatterType = (props: {\n data: number[];\n precision: number;\n isOrderBook: boolean;\n lang: (label: string) => string;\n}) => string;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,189 +1,2 @@
|
|
|
1
|
-
import type { GetOptionType
|
|
2
|
-
export declare const getResponsiveOption: ({ isDark, isOrderBook, isDesktop, lang, }: GetResponsiveOptionsProps) => {
|
|
3
|
-
grid: {
|
|
4
|
-
name: string;
|
|
5
|
-
top: string;
|
|
6
|
-
left: string;
|
|
7
|
-
right: string;
|
|
8
|
-
bottom: string;
|
|
9
|
-
}[];
|
|
10
|
-
yAxis: {
|
|
11
|
-
axisLabel: {
|
|
12
|
-
margin: number;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
series: {
|
|
16
|
-
type: string;
|
|
17
|
-
name: string;
|
|
18
|
-
id: string;
|
|
19
|
-
markLine: {
|
|
20
|
-
label: {
|
|
21
|
-
padding: number[];
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
}[];
|
|
25
|
-
graphic: ({
|
|
26
|
-
top: number | undefined;
|
|
27
|
-
bottom: number | undefined;
|
|
28
|
-
left: number | undefined;
|
|
29
|
-
right: number | undefined;
|
|
30
|
-
shape: {
|
|
31
|
-
x1: number;
|
|
32
|
-
y1: number;
|
|
33
|
-
x2: number;
|
|
34
|
-
y2: number;
|
|
35
|
-
};
|
|
36
|
-
type: string;
|
|
37
|
-
silent: boolean;
|
|
38
|
-
z: number;
|
|
39
|
-
style: {
|
|
40
|
-
stroke: string;
|
|
41
|
-
lineWidth: number;
|
|
42
|
-
};
|
|
43
|
-
} | {
|
|
44
|
-
top: number;
|
|
45
|
-
shape: {
|
|
46
|
-
x1: number;
|
|
47
|
-
y1: number;
|
|
48
|
-
x2: number;
|
|
49
|
-
y2: number;
|
|
50
|
-
};
|
|
51
|
-
type: string;
|
|
52
|
-
silent: boolean;
|
|
53
|
-
z: number;
|
|
54
|
-
style: {
|
|
55
|
-
stroke: string;
|
|
56
|
-
lineWidth: number;
|
|
57
|
-
};
|
|
58
|
-
} | {
|
|
59
|
-
right: number;
|
|
60
|
-
shape: {
|
|
61
|
-
x1: number;
|
|
62
|
-
y1: number;
|
|
63
|
-
x2: number;
|
|
64
|
-
y2: number;
|
|
65
|
-
};
|
|
66
|
-
type: string;
|
|
67
|
-
silent: boolean;
|
|
68
|
-
z: number;
|
|
69
|
-
style: {
|
|
70
|
-
stroke: string;
|
|
71
|
-
lineWidth: number;
|
|
72
|
-
};
|
|
73
|
-
} | {
|
|
74
|
-
bottom: number;
|
|
75
|
-
shape: {
|
|
76
|
-
x1: number;
|
|
77
|
-
y1: number;
|
|
78
|
-
x2: number;
|
|
79
|
-
y2: number;
|
|
80
|
-
};
|
|
81
|
-
type: string;
|
|
82
|
-
silent: boolean;
|
|
83
|
-
z: number;
|
|
84
|
-
style: {
|
|
85
|
-
stroke: string;
|
|
86
|
-
lineWidth: number;
|
|
87
|
-
};
|
|
88
|
-
} | {
|
|
89
|
-
left: number;
|
|
90
|
-
shape: {
|
|
91
|
-
x1: number;
|
|
92
|
-
y1: number;
|
|
93
|
-
x2: number;
|
|
94
|
-
y2: number;
|
|
95
|
-
};
|
|
96
|
-
type: string;
|
|
97
|
-
silent: boolean;
|
|
98
|
-
z: number;
|
|
99
|
-
style: {
|
|
100
|
-
stroke: string;
|
|
101
|
-
lineWidth: number;
|
|
102
|
-
};
|
|
103
|
-
} | {
|
|
104
|
-
type: string;
|
|
105
|
-
left: string;
|
|
106
|
-
top: string;
|
|
107
|
-
silent: boolean;
|
|
108
|
-
children: ({
|
|
109
|
-
type: string;
|
|
110
|
-
z: number;
|
|
111
|
-
left: string;
|
|
112
|
-
top: string;
|
|
113
|
-
shape: {
|
|
114
|
-
width: number;
|
|
115
|
-
height: number;
|
|
116
|
-
};
|
|
117
|
-
style: {
|
|
118
|
-
fill: string;
|
|
119
|
-
shadowBlur: number;
|
|
120
|
-
shadowOffsetX: number;
|
|
121
|
-
shadowOffsetY: number;
|
|
122
|
-
shadowColor: string;
|
|
123
|
-
width?: undefined;
|
|
124
|
-
height?: undefined;
|
|
125
|
-
text?: undefined;
|
|
126
|
-
};
|
|
127
|
-
} | {
|
|
128
|
-
type: string;
|
|
129
|
-
z: number;
|
|
130
|
-
left: string;
|
|
131
|
-
top: string;
|
|
132
|
-
style: {
|
|
133
|
-
fill: string;
|
|
134
|
-
width: number;
|
|
135
|
-
height: number;
|
|
136
|
-
text: string;
|
|
137
|
-
shadowBlur?: undefined;
|
|
138
|
-
shadowOffsetX?: undefined;
|
|
139
|
-
shadowOffsetY?: undefined;
|
|
140
|
-
shadowColor?: undefined;
|
|
141
|
-
};
|
|
142
|
-
shape?: undefined;
|
|
143
|
-
})[];
|
|
144
|
-
right?: undefined;
|
|
145
|
-
} | {
|
|
146
|
-
type: string;
|
|
147
|
-
right: string;
|
|
148
|
-
top: string;
|
|
149
|
-
silent: boolean;
|
|
150
|
-
children: ({
|
|
151
|
-
type: string;
|
|
152
|
-
z: number;
|
|
153
|
-
right: string;
|
|
154
|
-
top: string;
|
|
155
|
-
shape: {
|
|
156
|
-
width: number;
|
|
157
|
-
height: number;
|
|
158
|
-
};
|
|
159
|
-
style: {
|
|
160
|
-
fill: string;
|
|
161
|
-
shadowBlur: number;
|
|
162
|
-
shadowOffsetX: number;
|
|
163
|
-
shadowOffsetY: number;
|
|
164
|
-
shadowColor: string;
|
|
165
|
-
width?: undefined;
|
|
166
|
-
height?: undefined;
|
|
167
|
-
text?: undefined;
|
|
168
|
-
};
|
|
169
|
-
} | {
|
|
170
|
-
type: string;
|
|
171
|
-
z: number;
|
|
172
|
-
right: string;
|
|
173
|
-
top: string;
|
|
174
|
-
style: {
|
|
175
|
-
fill: string;
|
|
176
|
-
width: number;
|
|
177
|
-
height: number;
|
|
178
|
-
text: string;
|
|
179
|
-
shadowBlur?: undefined;
|
|
180
|
-
shadowOffsetX?: undefined;
|
|
181
|
-
shadowOffsetY?: undefined;
|
|
182
|
-
shadowColor?: undefined;
|
|
183
|
-
};
|
|
184
|
-
shape?: undefined;
|
|
185
|
-
})[];
|
|
186
|
-
left?: undefined;
|
|
187
|
-
})[];
|
|
188
|
-
};
|
|
1
|
+
import type { GetOptionType } from './types';
|
|
189
2
|
export declare const getOption: GetOptionType;
|
|
@@ -5,12 +5,6 @@ export interface ChartProps {
|
|
|
5
5
|
isOrderBook: boolean;
|
|
6
6
|
precision: number;
|
|
7
7
|
}
|
|
8
|
-
export interface GetResponsiveOptionsProps {
|
|
9
|
-
isDesktop: boolean;
|
|
10
|
-
isDark: boolean;
|
|
11
|
-
isOrderBook: boolean;
|
|
12
|
-
lang: (label: string) => string;
|
|
13
|
-
}
|
|
14
8
|
export interface GetOptionProps {
|
|
15
9
|
data: GetOrderPositionBooksQuery;
|
|
16
10
|
precision: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-order-book-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.219",
|
|
4
4
|
"description": "Labs Order Book Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"author": "OANDA",
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
15
|
+
"@oanda/labs-widget-common": "^1.0.219",
|
|
16
16
|
"@oanda/mono-i18n": "10.0.1",
|
|
17
|
-
"echarts": "
|
|
18
|
-
"echarts-for-react": "3.0.
|
|
17
|
+
"echarts": "6.0.0",
|
|
18
|
+
"echarts-for-react": "3.0.4",
|
|
19
19
|
"graphql": "16.8.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"@graphql-codegen/client-preset": "4.1.0",
|
|
24
24
|
"@graphql-codegen/typescript": "4.0.1"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "39a4ba7320ad2596a931ebc3b19cda09da14f9de"
|
|
27
27
|
}
|