@oanda/labs-crowd-view-widget 1.0.54 → 1.0.55
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 +224 -0
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +37 -56
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +20 -7
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +15 -9
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +6 -6
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +41 -13
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +159 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +7 -14
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +20 -2
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +13 -5
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +10 -3
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +20 -5
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +19 -28
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js +11 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +18 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +1 -20
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +21 -9
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +59 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +34 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js +33 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js +19 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js +11 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +33 -21
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +7 -4
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +11 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/main/CrowdViewWidget/constants.js +13 -5
- package/dist/main/CrowdViewWidget/constants.js.map +1 -1
- package/dist/main/CrowdViewWidget/selectConfig.js +0 -6
- package/dist/main/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/main/translations/sources/en.json +2 -1
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +38 -56
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +19 -6
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +15 -9
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +6 -6
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +41 -13
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +151 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +7 -14
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +20 -2
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +13 -5
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +10 -3
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +21 -6
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +19 -28
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +1 -20
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +21 -9
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +52 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +27 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +3 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js +12 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +34 -22
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +8 -5
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +11 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/module/CrowdViewWidget/constants.js +13 -5
- package/dist/module/CrowdViewWidget/constants.js.map +1 -1
- package/dist/module/CrowdViewWidget/selectConfig.js +0 -6
- package/dist/module/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/module/translations/sources/en.json +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.d.ts +5 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridLines.d.ts +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.d.ts +8 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +2 -3
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +3 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.d.ts +1 -3
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/index.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getLabelData.d.ts +1 -16
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +3 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.d.ts +4 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.d.ts +3 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/index.d.ts +3 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/index.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +5 -0
- package/dist/types/CrowdViewWidget/constants.d.ts +12 -4
- package/package.json +3 -3
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +70 -79
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +31 -13
- package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +11 -2
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +6 -6
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +48 -6
- package/src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts +191 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +7 -15
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts +22 -1
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts +13 -4
- package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +12 -1
- package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +55 -30
- package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +13 -30
- package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +1 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts +11 -35
- package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +40 -11
- package/src/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.ts +75 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.ts +37 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +3 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/index.ts +1 -0
- package/src/CrowdViewWidget/components/Chart/getOption.ts +41 -17
- package/src/CrowdViewWidget/components/Chart/types.ts +5 -0
- package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +12 -5
- package/src/CrowdViewWidget/components/Legend/Legend.tsx +1 -1
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +17 -1
- package/src/CrowdViewWidget/constants.ts +12 -4
- package/src/CrowdViewWidget/selectConfig.ts +0 -8
- package/src/translations/sources/en.json +2 -1
- package/test/components/Chart/utils/chartUtils.test.ts +13 -2
- package/test/components/Chart/utils/handleLabelUpdate.test.ts +419 -0
- package/test/components/Chart/utils/handleTooltipUpdate.test.ts +140 -0
- package/test/components/Legend.test.tsx +3 -3
- package/test/components/LegendBar.test.tsx +22 -20
|
@@ -13,14 +13,17 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
13
13
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
14
|
const getGridLines = _ref => {
|
|
15
15
|
let {
|
|
16
|
-
isDark
|
|
16
|
+
isDark,
|
|
17
|
+
isDesktop
|
|
17
18
|
} = _ref;
|
|
18
19
|
const {
|
|
19
20
|
WIDTH,
|
|
20
21
|
MAIN_HEIGHT,
|
|
21
|
-
X_LABEL_SIZE
|
|
22
|
-
Y_SENTIMENT_LABEL_SIZE
|
|
22
|
+
X_LABEL_SIZE
|
|
23
23
|
} = _constants.CHART_CONFIG;
|
|
24
|
+
const ySentimentLabelSize = isDesktop ? _constants.CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE : _constants.CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;
|
|
25
|
+
const yLabelSize = isDesktop ? _constants.CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : _constants.CHART_CONFIG.Y_LABEL_SIZE_MOBILE;
|
|
26
|
+
const topMargin = isDesktop ? 0 : _constants.CHART_CONFIG.TOP_MARGIN_MOBILE;
|
|
24
27
|
return [_objectSpread(_objectSpread({}, (0, _labsWidgetCommon.getLineCommons)(isDark)), {}, {
|
|
25
28
|
top: -2,
|
|
26
29
|
shape: {
|
|
@@ -28,7 +31,8 @@ const getGridLines = _ref => {
|
|
|
28
31
|
y1: 0,
|
|
29
32
|
x2: WIDTH,
|
|
30
33
|
y2: 0
|
|
31
|
-
}
|
|
34
|
+
},
|
|
35
|
+
z: 30
|
|
32
36
|
}), _objectSpread(_objectSpread({}, (0, _labsWidgetCommon.getLineCommons)(isDark)), {}, {
|
|
33
37
|
right: -2,
|
|
34
38
|
shape: {
|
|
@@ -36,7 +40,8 @@ const getGridLines = _ref => {
|
|
|
36
40
|
y1: 0,
|
|
37
41
|
x2: 0,
|
|
38
42
|
y2: MAIN_HEIGHT + X_LABEL_SIZE + 2
|
|
39
|
-
}
|
|
43
|
+
},
|
|
44
|
+
z: 30
|
|
40
45
|
}), _objectSpread(_objectSpread({}, (0, _labsWidgetCommon.getLineCommons)(isDark)), {}, {
|
|
41
46
|
bottom: -2,
|
|
42
47
|
shape: {
|
|
@@ -44,7 +49,8 @@ const getGridLines = _ref => {
|
|
|
44
49
|
y1: 0,
|
|
45
50
|
x2: WIDTH,
|
|
46
51
|
y2: 0
|
|
47
|
-
}
|
|
52
|
+
},
|
|
53
|
+
z: 30
|
|
48
54
|
}), _objectSpread(_objectSpread({}, (0, _labsWidgetCommon.getLineCommons)(isDark)), {}, {
|
|
49
55
|
left: -2,
|
|
50
56
|
shape: {
|
|
@@ -52,24 +58,46 @@ const getGridLines = _ref => {
|
|
|
52
58
|
y1: 0,
|
|
53
59
|
x2: 0,
|
|
54
60
|
y2: MAIN_HEIGHT + X_LABEL_SIZE + 2
|
|
55
|
-
}
|
|
61
|
+
},
|
|
62
|
+
z: 30
|
|
56
63
|
}), _objectSpread(_objectSpread({}, (0, _labsWidgetCommon.getLineCommons)(isDark)), {}, {
|
|
57
|
-
|
|
58
|
-
top: -2,
|
|
64
|
+
right: yLabelSize - 3,
|
|
65
|
+
top: topMargin - 2,
|
|
66
|
+
shape: {
|
|
67
|
+
x1: 0,
|
|
68
|
+
y1: 0,
|
|
69
|
+
x2: 0,
|
|
70
|
+
y2: MAIN_HEIGHT - topMargin
|
|
71
|
+
},
|
|
72
|
+
z: 30
|
|
73
|
+
}), _objectSpread(_objectSpread({}, (0, _labsWidgetCommon.getLineCommons)(isDark)), {}, {
|
|
74
|
+
left: ySentimentLabelSize - 2,
|
|
75
|
+
top: topMargin - 2,
|
|
59
76
|
shape: {
|
|
60
77
|
x1: 0,
|
|
61
78
|
y1: 0,
|
|
62
79
|
x2: 0,
|
|
63
|
-
y2: MAIN_HEIGHT
|
|
64
|
-
}
|
|
80
|
+
y2: MAIN_HEIGHT - topMargin
|
|
81
|
+
},
|
|
82
|
+
z: 30
|
|
83
|
+
}), _objectSpread(_objectSpread({}, (0, _labsWidgetCommon.getLineCommons)(isDark)), {}, {
|
|
84
|
+
bottom: X_LABEL_SIZE - 3,
|
|
85
|
+
shape: {
|
|
86
|
+
x1: 0,
|
|
87
|
+
y1: 0,
|
|
88
|
+
x2: WIDTH,
|
|
89
|
+
y2: 0
|
|
90
|
+
},
|
|
91
|
+
z: 30
|
|
65
92
|
}), _objectSpread(_objectSpread({}, (0, _labsWidgetCommon.getLineCommons)(isDark)), {}, {
|
|
66
|
-
top:
|
|
93
|
+
top: topMargin - 3,
|
|
67
94
|
shape: {
|
|
68
95
|
x1: 0,
|
|
69
96
|
y1: 0,
|
|
70
97
|
x2: WIDTH,
|
|
71
98
|
y2: 0
|
|
72
|
-
}
|
|
99
|
+
},
|
|
100
|
+
z: 30
|
|
73
101
|
})];
|
|
74
102
|
};
|
|
75
103
|
exports.getGridLines = getGridLines;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGridLines.js","names":["_labsWidgetCommon","require","_constants","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","getGridLines","_ref","isDark","WIDTH","MAIN_HEIGHT","X_LABEL_SIZE","
|
|
1
|
+
{"version":3,"file":"getGridLines.js","names":["_labsWidgetCommon","require","_constants","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","getGridLines","_ref","isDark","isDesktop","WIDTH","MAIN_HEIGHT","X_LABEL_SIZE","CHART_CONFIG","ySentimentLabelSize","Y_SENTIMENT_LABEL_DESKTOP_SIZE","Y_SENTIMENT_LABEL_MOBILE_SIZE","yLabelSize","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","topMargin","TOP_MARGIN_MOBILE","getLineCommons","top","shape","x1","y1","x2","y2","z","right","bottom","left","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts"],"sourcesContent":["import { getLineCommons } from '@oanda/labs-widget-common';\nimport type { GraphicComponentOption } from 'echarts';\n\nimport { CHART_CONFIG } from '../../../constants';\n\ninterface GetGridLinesParams {\n isDark: boolean;\n isDesktop: boolean;\n}\n\nexport const getGridLines = ({\n isDark,\n isDesktop,\n}: GetGridLinesParams): GraphicComponentOption[] => {\n const { WIDTH, MAIN_HEIGHT, X_LABEL_SIZE } = CHART_CONFIG;\n const ySentimentLabelSize = isDesktop\n ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE\n : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;\n\n const yLabelSize = isDesktop\n ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP\n : CHART_CONFIG.Y_LABEL_SIZE_MOBILE;\n\n const topMargin = isDesktop ? 0 : CHART_CONFIG.TOP_MARGIN_MOBILE;\n\n return [\n // Top\n {\n ...getLineCommons(isDark),\n top: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n z: 30,\n },\n // Right\n {\n ...getLineCommons(isDark),\n right: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT + X_LABEL_SIZE + 2,\n },\n z: 30,\n },\n // Bottom\n {\n ...getLineCommons(isDark),\n bottom: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n z: 30,\n },\n // Left\n {\n ...getLineCommons(isDark),\n left: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT + X_LABEL_SIZE + 2,\n },\n z: 30,\n },\n // Y Label\n {\n ...getLineCommons(isDark),\n right: yLabelSize - 3,\n top: topMargin - 2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT - topMargin,\n },\n z: 30,\n },\n // Y Sentiment Label\n {\n ...getLineCommons(isDark),\n left: ySentimentLabelSize - 2,\n top: topMargin - 2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT - topMargin,\n },\n z: 30,\n },\n // X Label\n {\n ...getLineCommons(isDark),\n bottom: X_LABEL_SIZE - 3,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n z: 30,\n },\n // X Mobile Label\n {\n ...getLineCommons(isDark),\n top: topMargin - 3,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n z: 30,\n },\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AAAkD,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAA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A,CAAAA,aAAA,KAIF,IAAAoC,gCAAc,EAACd,MAAM,CAAC;IACzBe,GAAG,EAAEH,SAAS,GAAG,CAAC;IAClBI,KAAK,EAAE;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEjB,KAAK;MACTkB,EAAE,EAAE;IACN,CAAC;IACDC,CAAC,EAAE;EAAE,GAER;AACH,CAAC;AAACI,OAAA,CAAA3B,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getLabelsConfig = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
9
|
+
var _constants = require("../../../constants");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const getLabelsConfig = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
isDark,
|
|
14
|
+
isDesktop,
|
|
15
|
+
labelCallback
|
|
16
|
+
} = _ref;
|
|
17
|
+
const ySentimentLabelSize = isDesktop ? _constants.CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE : _constants.CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;
|
|
18
|
+
const yMainLabelSize = isDesktop ? _constants.CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : _constants.CHART_CONFIG.Y_LABEL_SIZE_MOBILE;
|
|
19
|
+
const textColor = isDark ? _labsWidgetCommon.colorPalette.white : _labsWidgetCommon.colorPalette.black;
|
|
20
|
+
const labelBackgroundColor = isDark ? _labsWidgetCommon.colorPalette.darkGray : _labsWidgetCommon.colorPalette.white;
|
|
21
|
+
const backgroundColor = isDark ? _labsWidgetCommon.colorPalette.black : _labsWidgetCommon.colorPalette.white;
|
|
22
|
+
const shadowColor = (0, _chromaJs.default)(_labsWidgetCommon.colorPalette.black).alpha(0.1).hex();
|
|
23
|
+
const sentimentText = labelCallback('sentiment').toUpperCase();
|
|
24
|
+
const priceText = labelCallback('price').toUpperCase();
|
|
25
|
+
const sentimentEstimatedWidth = 10 * sentimentText.length * 0.65;
|
|
26
|
+
const priceEstimatedWidth = 10 * priceText.length * 0.65;
|
|
27
|
+
const sentimentVerticalOffset = sentimentEstimatedWidth / 2;
|
|
28
|
+
const priceVerticalOffset = priceEstimatedWidth / 2;
|
|
29
|
+
const topMargin = isDesktop ? _constants.CHART_CONFIG.TOP_MARGIN_DESKTOP : _constants.CHART_CONFIG.TOP_MARGIN_MOBILE;
|
|
30
|
+
return [{
|
|
31
|
+
type: 'group',
|
|
32
|
+
left: "".concat(ySentimentLabelSize + 5, "px'"),
|
|
33
|
+
top: "".concat(topMargin + 5, "px"),
|
|
34
|
+
silent: true,
|
|
35
|
+
children: [{
|
|
36
|
+
type: 'rect',
|
|
37
|
+
z: 100,
|
|
38
|
+
right: 'center',
|
|
39
|
+
top: 'middle',
|
|
40
|
+
shape: {
|
|
41
|
+
width: 50,
|
|
42
|
+
height: 24
|
|
43
|
+
},
|
|
44
|
+
style: {
|
|
45
|
+
fill: labelBackgroundColor,
|
|
46
|
+
shadowBlur: 8,
|
|
47
|
+
shadowOffsetX: 0,
|
|
48
|
+
shadowOffsetY: 1,
|
|
49
|
+
shadowColor: shadowColor
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
type: 'text',
|
|
53
|
+
z: 100,
|
|
54
|
+
right: 'center',
|
|
55
|
+
top: 'middle',
|
|
56
|
+
style: {
|
|
57
|
+
fontSize: 11,
|
|
58
|
+
fontFamily: 'Sofia W03',
|
|
59
|
+
fontWeight: 500,
|
|
60
|
+
fill: textColor,
|
|
61
|
+
width: 70,
|
|
62
|
+
height: 30,
|
|
63
|
+
text: labelCallback('short')
|
|
64
|
+
}
|
|
65
|
+
}]
|
|
66
|
+
}, {
|
|
67
|
+
type: 'group',
|
|
68
|
+
left: "".concat(ySentimentLabelSize + 5, "px'"),
|
|
69
|
+
top: "".concat(_constants.CHART_CONFIG.MAIN_HEIGHT - 24 - 5, "px"),
|
|
70
|
+
silent: true,
|
|
71
|
+
children: [{
|
|
72
|
+
type: 'rect',
|
|
73
|
+
z: 100,
|
|
74
|
+
right: 'center',
|
|
75
|
+
top: 'middle',
|
|
76
|
+
shape: {
|
|
77
|
+
width: 50,
|
|
78
|
+
height: 24
|
|
79
|
+
},
|
|
80
|
+
style: {
|
|
81
|
+
fill: labelBackgroundColor,
|
|
82
|
+
shadowBlur: 8,
|
|
83
|
+
shadowOffsetX: 0,
|
|
84
|
+
shadowOffsetY: 1,
|
|
85
|
+
shadowColor: shadowColor
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
type: 'text',
|
|
89
|
+
z: 100,
|
|
90
|
+
right: 'center',
|
|
91
|
+
top: 'middle',
|
|
92
|
+
style: {
|
|
93
|
+
fontSize: 11,
|
|
94
|
+
fontFamily: 'Sofia W03',
|
|
95
|
+
fontWeight: 500,
|
|
96
|
+
fill: textColor,
|
|
97
|
+
width: 70,
|
|
98
|
+
height: 30,
|
|
99
|
+
text: labelCallback('long')
|
|
100
|
+
}
|
|
101
|
+
}]
|
|
102
|
+
}, {
|
|
103
|
+
type: 'text',
|
|
104
|
+
z: 30,
|
|
105
|
+
rotation: isDesktop ? Math.PI / 2 : 0,
|
|
106
|
+
left: "5px",
|
|
107
|
+
top: isDesktop ? "".concat(topMargin + _constants.CHART_CONFIG.MAIN_HEIGHT / 2 - sentimentVerticalOffset, "px") : "".concat(topMargin - 18, "px"),
|
|
108
|
+
silent: true,
|
|
109
|
+
style: {
|
|
110
|
+
fontSize: 10,
|
|
111
|
+
fontFamily: 'Sofia W03',
|
|
112
|
+
fontWeight: 300,
|
|
113
|
+
fill: textColor,
|
|
114
|
+
text: sentimentText
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
type: 'text',
|
|
118
|
+
z: 30,
|
|
119
|
+
rotation: isDesktop ? -Math.PI / 2 : 0,
|
|
120
|
+
right: "5px",
|
|
121
|
+
top: isDesktop ? "".concat(topMargin + _constants.CHART_CONFIG.MAIN_HEIGHT / 2 - priceVerticalOffset, "px") : "".concat(topMargin - 18, "px"),
|
|
122
|
+
silent: true,
|
|
123
|
+
style: {
|
|
124
|
+
fontSize: 10,
|
|
125
|
+
fontFamily: 'Sofia W03',
|
|
126
|
+
fontWeight: 300,
|
|
127
|
+
fill: textColor,
|
|
128
|
+
text: priceText
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
type: 'rect',
|
|
132
|
+
z: 20,
|
|
133
|
+
right: '0px',
|
|
134
|
+
top: '0px',
|
|
135
|
+
shape: {
|
|
136
|
+
width: yMainLabelSize,
|
|
137
|
+
height: _constants.CHART_CONFIG.MAIN_HEIGHT
|
|
138
|
+
},
|
|
139
|
+
silent: true,
|
|
140
|
+
style: {
|
|
141
|
+
fill: backgroundColor
|
|
142
|
+
}
|
|
143
|
+
}, {
|
|
144
|
+
type: 'rect',
|
|
145
|
+
z: 20,
|
|
146
|
+
left: '0px',
|
|
147
|
+
top: '0px',
|
|
148
|
+
shape: {
|
|
149
|
+
width: ySentimentLabelSize,
|
|
150
|
+
height: _constants.CHART_CONFIG.MAIN_HEIGHT
|
|
151
|
+
},
|
|
152
|
+
silent: true,
|
|
153
|
+
style: {
|
|
154
|
+
fill: backgroundColor
|
|
155
|
+
}
|
|
156
|
+
}];
|
|
157
|
+
};
|
|
158
|
+
exports.getLabelsConfig = getLabelsConfig;
|
|
159
|
+
//# sourceMappingURL=getLabelsConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLabelsConfig.js","names":["_labsWidgetCommon","require","_chromaJs","_interopRequireDefault","_constants","e","__esModule","default","getLabelsConfig","_ref","isDark","isDesktop","labelCallback","ySentimentLabelSize","CHART_CONFIG","Y_SENTIMENT_LABEL_DESKTOP_SIZE","Y_SENTIMENT_LABEL_MOBILE_SIZE","yMainLabelSize","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","textColor","colorPalette","white","black","labelBackgroundColor","darkGray","backgroundColor","shadowColor","chroma","alpha","hex","sentimentText","toUpperCase","priceText","sentimentEstimatedWidth","length","priceEstimatedWidth","sentimentVerticalOffset","priceVerticalOffset","topMargin","TOP_MARGIN_DESKTOP","TOP_MARGIN_MOBILE","type","left","concat","top","silent","children","z","right","shape","width","height","style","fill","shadowBlur","shadowOffsetX","shadowOffsetY","fontSize","fontFamily","fontWeight","text","MAIN_HEIGHT","rotation","Math","PI","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport chroma from 'chroma-js';\nimport type { GraphicComponentOption } from 'echarts';\n\nimport { CHART_CONFIG } from '../../../constants';\n\ninterface getLabelsConfigParams {\n isDark: boolean;\n isDesktop: boolean;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n}\n\nexport const getLabelsConfig = ({\n isDark,\n isDesktop,\n labelCallback,\n}: getLabelsConfigParams): GraphicComponentOption[] => {\n const ySentimentLabelSize = isDesktop\n ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE\n : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;\n\n const yMainLabelSize = isDesktop\n ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP\n : CHART_CONFIG.Y_LABEL_SIZE_MOBILE;\n\n const textColor = isDark ? colorPalette.white : colorPalette.black;\n const labelBackgroundColor = isDark\n ? colorPalette.darkGray\n : colorPalette.white;\n const backgroundColor = isDark ? colorPalette.black : colorPalette.white;\n const shadowColor = chroma(colorPalette.black).alpha(0.1).hex();\n\n // Estimate text width for centering rotated text\n // Approximate: fontSize * characterCount * 0.65 (typical character width ratio)\n const sentimentText = labelCallback('sentiment').toUpperCase();\n const priceText = labelCallback('price').toUpperCase();\n const sentimentEstimatedWidth = 10 * sentimentText.length * 0.65;\n const priceEstimatedWidth = 10 * priceText.length * 0.65;\n const sentimentVerticalOffset = sentimentEstimatedWidth / 2;\n const priceVerticalOffset = priceEstimatedWidth / 2;\n\n const topMargin = isDesktop\n ? CHART_CONFIG.TOP_MARGIN_DESKTOP\n : CHART_CONFIG.TOP_MARGIN_MOBILE;\n\n return [\n {\n type: 'group',\n left: `${ySentimentLabelSize + 5}px'`,\n top: `${topMargin + 5}px`,\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 50,\n height: 24,\n },\n style: {\n fill: labelBackgroundColor,\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: shadowColor,\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n fontSize: 11,\n fontFamily: 'Sofia W03',\n fontWeight: 500,\n fill: textColor,\n width: 70,\n height: 30,\n text: labelCallback('short'),\n },\n },\n ],\n },\n {\n type: 'group',\n left: `${ySentimentLabelSize + 5}px'`,\n top: `${CHART_CONFIG.MAIN_HEIGHT - 24 - 5}px`,\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 50,\n height: 24,\n },\n style: {\n fill: labelBackgroundColor,\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: shadowColor,\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n fontSize: 11,\n fontFamily: 'Sofia W03',\n fontWeight: 500,\n fill: textColor,\n width: 70,\n height: 30,\n text: labelCallback('long'),\n },\n },\n ],\n },\n\n {\n type: 'text',\n z: 30,\n rotation: isDesktop ? Math.PI / 2 : 0,\n left: `5px`,\n top: isDesktop\n ? `${topMargin + CHART_CONFIG.MAIN_HEIGHT / 2 - sentimentVerticalOffset}px`\n : `${topMargin - 18}px`,\n silent: true,\n style: {\n fontSize: 10,\n fontFamily: 'Sofia W03',\n fontWeight: 300,\n fill: textColor,\n text: sentimentText,\n },\n },\n {\n type: 'text',\n z: 30,\n rotation: isDesktop ? -Math.PI / 2 : 0,\n right: `5px`,\n top: isDesktop\n ? `${topMargin + CHART_CONFIG.MAIN_HEIGHT / 2 - priceVerticalOffset}px`\n : `${topMargin - 18}px`,\n silent: true,\n style: {\n fontSize: 10,\n fontFamily: 'Sofia W03',\n fontWeight: 300,\n fill: textColor,\n text: priceText,\n },\n },\n {\n type: 'rect',\n z: 20,\n right: '0px',\n top: '0px',\n shape: {\n width: yMainLabelSize,\n height: CHART_CONFIG.MAIN_HEIGHT,\n },\n silent: true,\n style: {\n fill: backgroundColor,\n },\n },\n {\n type: 'rect',\n z: 20,\n left: '0px',\n top: '0px',\n shape: {\n width: ySentimentLabelSize,\n height: CHART_CONFIG.MAIN_HEIGHT,\n },\n silent: true,\n style: {\n fill: backgroundColor,\n },\n },\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AAAkD,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQ3C,MAAMG,eAAe,GAAGC,IAAA,IAIwB;EAAA,IAJvB;IAC9BC,MAAM;IACNC,SAAS;IACTC;EACqB,CAAC,GAAAH,IAAA;EACtB,MAAMI,mBAAmB,GAAGF,SAAS,GACjCG,uBAAY,CAACC,8BAA8B,GAC3CD,uBAAY,CAACE,6BAA6B;EAE9C,MAAMC,cAAc,GAAGN,SAAS,GAC5BG,uBAAY,CAACI,oBAAoB,GACjCJ,uBAAY,CAACK,mBAAmB;EAEpC,MAAMC,SAAS,GAAGV,MAAM,GAAGW,8B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EAAE,KAAK;IACVK,KAAK,EAAE;MACLC,KAAK,EAAElC,cAAc;MACrBmC,MAAM,EAAEtC,uBAAY,CAACgD;IACvB,CAAC;IACDhB,MAAM,EAAE,IAAI;IACZO,KAAK,EAAE;MACLC,IAAI,EAAE5B;IACR;EACF,CAAC,EACD;IACEgB,IAAI,EAAE,MAAM;IACZM,CAAC,EAAE,EAAE;IACLL,IAAI,EAAE,KAAK;IACXE,GAAG,EAAE,KAAK;IACVK,KAAK,EAAE;MACLC,KAAK,EAAEtC,mBAAmB;MAC1BuC,MAAM,EAAEtC,uBAAY,CAACgD;IACvB,CAAC;IACDhB,MAAM,EAAE,IAAI;IACZO,KAAK,EAAE;MACLC,IAAI,EAAE5B;IACR;EACF,CAAC,CACF;AACH,CAAC;AAACwC,OAAA,CAAA1D,eAAA,GAAAA,eAAA","ignoreList":[]}
|
package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js
CHANGED
|
@@ -5,27 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getSeriesCandlestickConfig = void 0;
|
|
7
7
|
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
8
|
-
var _chartUtils = require("../chartUtils");
|
|
9
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
9
|
const getSeriesCandlestickConfig = _ref => {
|
|
11
10
|
let {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
styles
|
|
11
|
+
styles,
|
|
12
|
+
isLoading
|
|
15
13
|
} = _ref;
|
|
16
14
|
const {
|
|
17
15
|
candleLongColor,
|
|
18
16
|
candleShortColor
|
|
19
17
|
} = styles;
|
|
20
|
-
const labelsData = (0, _chartUtils.getLabelData)({
|
|
21
|
-
dates,
|
|
22
|
-
isGreaterThanTwoWeeks
|
|
23
|
-
});
|
|
24
18
|
return {
|
|
19
|
+
animation: isLoading,
|
|
25
20
|
type: 'candlestick',
|
|
26
21
|
id: 'candlestick',
|
|
27
22
|
xAxisIndex: 0,
|
|
28
23
|
yAxisIndex: 0,
|
|
24
|
+
silent: true,
|
|
25
|
+
clip: true,
|
|
26
|
+
large: true,
|
|
29
27
|
encode: {
|
|
30
28
|
x: 'dates',
|
|
31
29
|
y: ['open', 'close', 'low', 'high']
|
|
@@ -42,12 +40,7 @@ const getSeriesCandlestickConfig = _ref => {
|
|
|
42
40
|
color0: candleShortColor
|
|
43
41
|
}
|
|
44
42
|
},
|
|
45
|
-
|
|
46
|
-
data: labelsData,
|
|
47
|
-
symbol: 'circle',
|
|
48
|
-
symbolSize: 0
|
|
49
|
-
},
|
|
50
|
-
z: 2
|
|
43
|
+
z: 3
|
|
51
44
|
};
|
|
52
45
|
};
|
|
53
46
|
exports.getSeriesCandlestickConfig = getSeriesCandlestickConfig;
|
package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSeriesCandlestickConfig.js","names":["_chromaJs","_interopRequireDefault","require","
|
|
1
|
+
{"version":3,"file":"getSeriesCandlestickConfig.js","names":["_chromaJs","_interopRequireDefault","require","e","__esModule","default","getSeriesCandlestickConfig","_ref","styles","isLoading","candleLongColor","candleShortColor","animation","type","id","xAxisIndex","yAxisIndex","silent","clip","large","encode","x","y","itemStyle","color","chroma","desaturate","css","color0","borderColor","borderColor0","emphasis","z","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts"],"sourcesContent":["import chroma from 'chroma-js';\nimport type { CandlestickSeriesOption } from 'echarts';\n\nimport type { ChartStyles } from '../chartUtils/getChartStyles';\n\ninterface GetSeriesCandlestickConfigParams {\n styles: ChartStyles;\n isLoading: boolean;\n}\n\nexport const getSeriesCandlestickConfig = ({\n styles,\n isLoading,\n}: GetSeriesCandlestickConfigParams): CandlestickSeriesOption => {\n const { candleLongColor, candleShortColor } = styles;\n\n return {\n animation: isLoading,\n type: 'candlestick',\n id: 'candlestick',\n xAxisIndex: 0,\n yAxisIndex: 0,\n silent: true,\n clip: true,\n large: true,\n encode: {\n x: 'dates',\n y: ['open', 'close', 'low', 'high'],\n },\n itemStyle: {\n color: chroma(candleLongColor).desaturate().css(),\n color0: chroma(candleShortColor).desaturate().css(),\n borderColor: candleLongColor,\n borderColor0: candleShortColor,\n },\n emphasis: {\n itemStyle: {\n color: candleLongColor,\n color0: candleShortColor,\n },\n },\n z: 3,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA+B,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAUxB,MAAMG,0BAA0B,GAAGC,IAAA,IAGuB;EAAA,IAHtB;IACzCC,MAAM;IACNC;EACgC,CAAC,GAAAF,IAAA;EACjC,MAAM;IAAEG,eAAe;IAAEC;EAAiB,CAAC,GAAGH,MAAM;EAEpD,OAAO;IACLI,SAAS,EAAEH,SAAS;IACpBI,IAAI,EAAE,aAAa;IACnBC,EAAE,EAAE,aAAa;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,CAAC;IACbC,MAAM,EAAE,IAAI;IACZC,IAAI,EAAE,IAAI;IACVC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE;MACNC,CAAC,EAAE,OAAO;MACVC,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;IACpC,CAAC;IACDC,SAAS,EAAE;MACTC,KAAK,EAAE,IAAAC,iBAAM,EAACf,eAAe,CAAC,CAACgB,UAAU,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC;MACjDC,MAAM,EAAE,IAAAH,iBAAM,EAACd,gBAAgB,CAAC,CAACe,UAAU,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC;MACnDE,WAAW,EAAEnB,eAAe;MAC5BoB,YAAY,EAAEnB;IAChB,CAAC;IACDoB,QAAQ,EAAE;MACRR,SAAS,EAAE;QACTC,KAAK,EAAEd,eAAe;QACtBkB,MAAM,EAAEjB;MACV;IACF,CAAC;IACDqB,CAAC,EAAE;EACL,CAAC;AACH,CAAC;AAACC,OAAA,CAAA3B,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -11,9 +11,11 @@ const getSeriesHeatmapConfig = _ref => {
|
|
|
11
11
|
buckets,
|
|
12
12
|
isDark,
|
|
13
13
|
sentimentThresholdMax,
|
|
14
|
-
sentimentThresholdMin
|
|
14
|
+
sentimentThresholdMin,
|
|
15
|
+
isLoading
|
|
15
16
|
} = _ref;
|
|
16
17
|
return {
|
|
18
|
+
animation: isLoading,
|
|
17
19
|
type: 'custom',
|
|
18
20
|
id: 'heatmap',
|
|
19
21
|
name: 'heatmap',
|
|
@@ -25,13 +27,17 @@ const getSeriesHeatmapConfig = _ref => {
|
|
|
25
27
|
},
|
|
26
28
|
dimensions: ['dates', 'bookPrices', 'bookIndexes'],
|
|
27
29
|
clip: true,
|
|
28
|
-
renderItem: (
|
|
30
|
+
renderItem: (params, api) => {
|
|
31
|
+
const animationDelay = 350 * params.dataIndexInside / params.dataInsideLength;
|
|
29
32
|
const xVal = api.value(0);
|
|
30
33
|
const bucketIndex = api.value(2);
|
|
31
34
|
if (bucketIndex == null) {
|
|
32
35
|
return null;
|
|
33
36
|
}
|
|
34
37
|
const metaValues = buckets[bucketIndex];
|
|
38
|
+
if (!metaValues) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
35
41
|
const [rectWidth, rectHeight] = api.size([0, bucketWidth]);
|
|
36
42
|
const items = metaValues.map(_ref2 => {
|
|
37
43
|
let {
|
|
@@ -40,6 +46,7 @@ const getSeriesHeatmapConfig = _ref => {
|
|
|
40
46
|
} = _ref2;
|
|
41
47
|
const start = api.coord([xVal, price]);
|
|
42
48
|
return {
|
|
49
|
+
silent: true,
|
|
43
50
|
shape: {
|
|
44
51
|
height: rectHeight,
|
|
45
52
|
width: rectWidth + 1,
|
|
@@ -49,12 +56,23 @@ const getSeriesHeatmapConfig = _ref => {
|
|
|
49
56
|
style: {
|
|
50
57
|
fill: (0, _chartUtils.getRectColor)(sentiment, isDark, sentimentThresholdMin, sentimentThresholdMax)
|
|
51
58
|
},
|
|
59
|
+
enterFrom: {
|
|
60
|
+
shape: {},
|
|
61
|
+
style: {
|
|
62
|
+
opacity: 0
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
enterAnimation: {
|
|
66
|
+
duration: 150,
|
|
67
|
+
delay: animationDelay
|
|
68
|
+
},
|
|
52
69
|
type: 'rect'
|
|
53
70
|
};
|
|
54
71
|
});
|
|
55
72
|
return {
|
|
56
73
|
children: items,
|
|
57
74
|
emphasisDisabled: true,
|
|
75
|
+
silent: true,
|
|
58
76
|
type: 'group'
|
|
59
77
|
};
|
|
60
78
|
},
|
package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSeriesHeatmapConfig.js","names":["_chartUtils","require","getSeriesHeatmapConfig","_ref","bucketWidth","buckets","isDark","sentimentThresholdMax","sentimentThresholdMin","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","clip","renderItem","
|
|
1
|
+
{"version":3,"file":"getSeriesHeatmapConfig.js","names":["_chartUtils","require","getSeriesHeatmapConfig","_ref","bucketWidth","buckets","isDark","sentimentThresholdMax","sentimentThresholdMin","isLoading","animation","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","clip","renderItem","params","api","animationDelay","dataIndexInside","dataInsideLength","xVal","value","bucketIndex","metaValues","rectWidth","rectHeight","size","items","map","_ref2","price","sentiment","start","coord","silent","shape","height","width","style","fill","getRectColor","enterFrom","opacity","enterAnimation","duration","delay","children","emphasisDisabled","z","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts"],"sourcesContent":["import type {\n CustomSeriesOption,\n CustomSeriesRenderItemAPI,\n CustomSeriesRenderItemParams,\n} from 'echarts';\n\nimport { getRectColor } from '../chartUtils';\nimport type { Bucket } from '../types';\n\ninterface GetSeriesHeatmapConfigParams {\n bucketWidth: number;\n buckets: Bucket[][];\n isDark: boolean;\n sentimentThresholdMax: number;\n sentimentThresholdMin: number;\n isLoading: boolean;\n}\n\nexport const getSeriesHeatmapConfig = ({\n bucketWidth,\n buckets,\n isDark,\n sentimentThresholdMax,\n sentimentThresholdMin,\n isLoading,\n}: GetSeriesHeatmapConfigParams): CustomSeriesOption => {\n return {\n animation: isLoading,\n type: 'custom',\n id: 'heatmap',\n name: 'heatmap',\n xAxisIndex: 0,\n yAxisIndex: 0,\n encode: {\n x: 'dates',\n y: 'bookPrices',\n },\n dimensions: ['dates', 'bookPrices', 'bookIndexes'],\n clip: true,\n renderItem: (\n params: CustomSeriesRenderItemParams,\n api: CustomSeriesRenderItemAPI\n ) => {\n const animationDelay =\n (350 * params.dataIndexInside) / params.dataInsideLength;\n const xVal = api.value(0);\n const bucketIndex = api.value(2) as number;\n\n if (bucketIndex == null) {\n return null;\n }\n\n const metaValues = buckets[bucketIndex];\n\n if (!metaValues) {\n return null;\n }\n\n const [rectWidth, rectHeight] = api.size!([0, bucketWidth]) as number[];\n\n const items = metaValues.map(({ price, sentiment }: Bucket) => {\n const start = api.coord([xVal, price]);\n\n return {\n silent: true,\n shape: {\n height: rectHeight,\n width: rectWidth + 1,\n x: start[0] - rectWidth / 2,\n y: start[1] - rectHeight,\n },\n style: {\n fill: getRectColor(\n sentiment,\n isDark,\n sentimentThresholdMin,\n sentimentThresholdMax\n ),\n },\n enterFrom: {\n shape: {},\n style: {\n opacity: 0,\n },\n },\n enterAnimation: {\n duration: 150,\n delay: animationDelay,\n },\n type: 'rect' as const,\n };\n });\n\n return {\n children: items,\n emphasisDisabled: true,\n silent: true,\n type: 'group' as const,\n };\n },\n z: 1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GAAG,CAACiB,KAAK,CAAC,CAACb,IAAI,EAAEU,KAAK,CAAC,CAAC;QAEtC,OAAO;UACLI,MAAM,EAAE,IAAI;UACZC,KAAK,EAAE;YACLC,MAAM,EAAEX,UAAU;YAClBY,KAAK,EAAEb,SAAS,GAAG,CAAC;YACpBd,CAAC,EAAEsB,KAAK,CAAC,CAAC,CAAC,GAAGR,SAAS,GAAG,CAAC;YAC3Bb,CAAC,EAAEqB,KAAK,CAAC,CAAC,CAAC,GAAGP;UAChB,CAAC;UACDa,KAAK,EAAE;YACLC,IAAI,EAAE,IAAAC,wBAAY,EAChBT,SAAS,EACThC,MAAM,EACNE,qBAAqB,EACrBD,qBACF;UACF,CAAC;UACDyC,SAAS,EAAE;YACTN,KAAK,EAAE,CAAC,CAAC;YACTG,KAAK,EAAE;cACLI,OAAO,EAAE;YACX;UACF,CAAC;UACDC,cAAc,EAAE;YACdC,QAAQ,EAAE,GAAG;YACbC,KAAK,EAAE5B;UACT,CAAC;UACDb,IAAI,EAAE;QACR,CAAC;MACH,CAAC,CAAC;MAEF,OAAO;QACL0C,QAAQ,EAAEnB,KAAK;QACfoB,gBAAgB,EAAE,IAAI;QACtBb,MAAM,EAAE,IAAI;QACZ9B,IAAI,EAAE;MACR,CAAC;IACH,CAAC;IACD4C,CAAC,EAAE;EACL,CAAC;AACH,CAAC;AAACC,OAAA,CAAAtD,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -7,9 +7,12 @@ exports.getSeriesSentimentConfig = void 0;
|
|
|
7
7
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
8
|
const getSeriesSentimentConfig = _ref => {
|
|
9
9
|
let {
|
|
10
|
-
styles
|
|
10
|
+
styles,
|
|
11
|
+
isLoading
|
|
11
12
|
} = _ref;
|
|
12
13
|
return {
|
|
14
|
+
animation: isLoading,
|
|
15
|
+
animationDelay: 350,
|
|
13
16
|
type: 'line',
|
|
14
17
|
id: 'sentiment',
|
|
15
18
|
name: 'sentiment',
|
|
@@ -17,9 +20,9 @@ const getSeriesSentimentConfig = _ref => {
|
|
|
17
20
|
yAxisIndex: 1,
|
|
18
21
|
encode: {
|
|
19
22
|
x: 'dates',
|
|
20
|
-
y: '
|
|
23
|
+
y: 'sentimentLongs'
|
|
21
24
|
},
|
|
22
|
-
dimensions: ['dates', '
|
|
25
|
+
dimensions: ['dates', 'sentimentLongs', 'sentimentShorts'],
|
|
23
26
|
lineStyle: {
|
|
24
27
|
width: styles.sentimentOutlineWidth,
|
|
25
28
|
opacity: 1,
|
|
@@ -29,7 +32,11 @@ const getSeriesSentimentConfig = _ref => {
|
|
|
29
32
|
emphasis: {
|
|
30
33
|
disabled: true
|
|
31
34
|
},
|
|
35
|
+
tooltip: {
|
|
36
|
+
show: false
|
|
37
|
+
},
|
|
32
38
|
markLine: {
|
|
39
|
+
animation: isLoading,
|
|
33
40
|
silent: true,
|
|
34
41
|
symbol: ['none', 'none'],
|
|
35
42
|
label: {
|
|
@@ -50,10 +57,11 @@ const getSeriesSentimentConfig = _ref => {
|
|
|
50
57
|
yAxis: 80
|
|
51
58
|
}]
|
|
52
59
|
},
|
|
53
|
-
stack: 'sentiment',
|
|
54
60
|
showSymbol: false,
|
|
55
61
|
symbol: 'none',
|
|
56
|
-
z:
|
|
62
|
+
z: 2,
|
|
63
|
+
connectNulls: true,
|
|
64
|
+
silent: true
|
|
57
65
|
};
|
|
58
66
|
};
|
|
59
67
|
exports.getSeriesSentimentConfig = getSeriesSentimentConfig;
|
package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSeriesSentimentConfig.js","names":["_labsWidgetCommon","require","getSeriesSentimentConfig","_ref","styles","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","lineStyle","width","sentimentOutlineWidth","opacity","shadowColor","sentimentOutlineColor","shadowBlur","emphasis","disabled","markLine","silent","symbol","label","
|
|
1
|
+
{"version":3,"file":"getSeriesSentimentConfig.js","names":["_labsWidgetCommon","require","getSeriesSentimentConfig","_ref","styles","isLoading","animation","animationDelay","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","lineStyle","width","sentimentOutlineWidth","opacity","shadowColor","sentimentOutlineColor","shadowBlur","emphasis","disabled","tooltip","show","markLine","silent","symbol","label","color","colorPalette","grayLight","data","yAxis","showSymbol","z","connectNulls","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport type { LineSeriesOption } from 'echarts';\n\nimport type { ChartStyles } from '../chartUtils';\n\ninterface GetSeriesSentimentConfigParams {\n styles: ChartStyles;\n isLoading: boolean;\n}\n\nexport const getSeriesSentimentConfig = ({\n styles,\n isLoading,\n}: GetSeriesSentimentConfigParams): LineSeriesOption => {\n return {\n animation: isLoading,\n animationDelay: 350,\n type: 'line',\n id: 'sentiment',\n name: 'sentiment',\n xAxisIndex: 1,\n yAxisIndex: 1,\n encode: {\n x: 'dates',\n y: 'sentimentLongs',\n },\n dimensions: ['dates', 'sentimentLongs', 'sentimentShorts'],\n lineStyle: {\n width: styles.sentimentOutlineWidth,\n opacity: 1,\n shadowColor: styles.sentimentOutlineColor,\n shadowBlur: 3,\n },\n emphasis: {\n disabled: true,\n },\n tooltip: {\n show: false,\n },\n markLine: {\n animation: isLoading,\n silent: true,\n symbol: ['none', 'none'],\n label: {\n show: false,\n },\n lineStyle: {\n color: colorPalette.grayLight,\n width: 1,\n },\n data: [\n {\n yAxis: 20,\n },\n {\n yAxis: 50,\n lineStyle: {\n width: 1,\n },\n },\n {\n yAxis: 80,\n },\n ],\n },\n showSymbol: false,\n symbol: 'none',\n z: 2,\n connectNulls: true,\n silent: true,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAUO,MAAMC,wBAAwB,GAAGC,IAAA,IAGgB;EAAA,I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A,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getTooltipConfig = void 0;
|
|
7
|
+
var _constants = require("../../../constants");
|
|
7
8
|
var _chartUtils = require("../chartUtils");
|
|
8
9
|
const getTooltipConfig = _ref => {
|
|
9
10
|
let {
|
|
@@ -13,7 +14,9 @@ const getTooltipConfig = _ref => {
|
|
|
13
14
|
displayPrecision,
|
|
14
15
|
labelCallback,
|
|
15
16
|
selectedPriceRef,
|
|
16
|
-
tooltipLinesColor
|
|
17
|
+
tooltipLinesColor,
|
|
18
|
+
sentimentLongs,
|
|
19
|
+
sentimentShorts
|
|
17
20
|
} = _ref;
|
|
18
21
|
return {
|
|
19
22
|
trigger: 'axis',
|
|
@@ -23,8 +26,11 @@ const getTooltipConfig = _ref => {
|
|
|
23
26
|
buckets,
|
|
24
27
|
labelCallback,
|
|
25
28
|
params: params,
|
|
26
|
-
selectedPrice: selectedPriceRef.current
|
|
29
|
+
selectedPrice: selectedPriceRef.current,
|
|
30
|
+
sentimentLongs,
|
|
31
|
+
sentimentShorts
|
|
27
32
|
}),
|
|
33
|
+
hideDelay: 0,
|
|
28
34
|
axisPointer: {
|
|
29
35
|
type: 'cross',
|
|
30
36
|
axis: 'x',
|
|
@@ -46,7 +52,8 @@ const getTooltipConfig = _ref => {
|
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
},
|
|
49
|
-
confine: true
|
|
55
|
+
confine: true,
|
|
56
|
+
position: point => [point[0] + _constants.CHART_CONFIG.TOOLTIP_OFFSET, point[1] + _constants.CHART_CONFIG.TOOLTIP_OFFSET]
|
|
50
57
|
};
|
|
51
58
|
};
|
|
52
59
|
exports.getTooltipConfig = getTooltipConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTooltipConfig.js","names":["
|
|
1
|
+
{"version":3,"file":"getTooltipConfig.js","names":["_constants","require","_chartUtils","getTooltipConfig","_ref","bookType","bucketWidth","buckets","displayPrecision","labelCallback","selectedPriceRef","tooltipLinesColor","sentimentLongs","sentimentShorts","trigger","formatter","params","getTooltipFormatter","selectedPrice","current","hideDelay","axisPointer","type","axis","lineStyle","color","crossStyle","label","padding","lineHeight","axisDimension","axisIndex","Number","value","concat","toFixed","confine","position","point","CHART_CONFIG","TOOLTIP_OFFSET","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts"],"sourcesContent":["import type { TooltipComponentOption } from 'echarts';\n\nimport type { BookType } from '../../../../gql/types/graphql';\nimport { CHART_CONFIG } from '../../../constants';\nimport { getTooltipFormatter } from '../chartUtils';\nimport type { Bucket, TooltipParam } from '../types';\n\ninterface GetTooltipConfigParams {\n bookType: BookType;\n bucketWidth: number;\n buckets: Bucket[][];\n displayPrecision: number;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n selectedPriceRef: { current: number };\n tooltipLinesColor: string;\n sentimentLongs: (number | null)[];\n sentimentShorts: (number | null)[];\n}\n\nexport const getTooltipConfig = ({\n bookType,\n bucketWidth,\n buckets,\n displayPrecision,\n labelCallback,\n selectedPriceRef,\n tooltipLinesColor,\n sentimentLongs,\n sentimentShorts,\n}: GetTooltipConfigParams): TooltipComponentOption => ({\n trigger: 'axis' as const,\n formatter: (params) =>\n getTooltipFormatter({\n bookType,\n bucketWidth,\n buckets,\n labelCallback,\n params: params as unknown as TooltipParam[],\n selectedPrice: selectedPriceRef.current,\n sentimentLongs,\n sentimentShorts,\n }),\n hideDelay: 0,\n axisPointer: {\n type: 'cross' as const,\n axis: 'x' as const,\n lineStyle: {\n color: tooltipLinesColor,\n },\n crossStyle: {\n color: tooltipLinesColor,\n },\n label: {\n padding: 0,\n lineHeight: 24,\n formatter: (params: {\n axisDimension?: string;\n axisIndex?: number;\n value: unknown;\n }) => {\n if (params.axisDimension === 'y' && params.axisIndex === 0) {\n selectedPriceRef.current = Number(params.value);\n return ` ${Number(params.value).toFixed(displayPrecision)} `;\n }\n return '';\n },\n },\n },\n confine: true,\n position: (point) => [\n point[0] + CHART_CONFIG.TOOLTIP_OFFSET,\n point[1] + CHART_CONFIG.TOOLTIP_OFFSET,\n ],\n});\n"],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAeO,MAAME,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IAC/BC,QAAQ;IACRC,WAAW;IACXC,OAAO;IACPC,gBAAgB;IAChBC,aAAa;IACbC,gBAAgB;IAChBC,iBAAiB;IACjBC,cAAc;IACdC;EACsB,CAAC,GAAAT,IAAA;EAAA,OAA8B;IACrDU,OAAO,EAAE,MAAe;IACxBC,SAAS,EAAGC,MAAM,IAChB,IAAAC,+BAAmB,EAAC;MAClBZ,QAAQ;MACRC,WAAW;MACXC,OAAO;MACPE,aAAa;MACbO,MAAM,EAAEA,MAAmC;MAC3CE,aAAa,EAAER,gBAAgB,CAACS,OAAO;MACvCP,cAAc;MACdC;IACF,CAAC,CAAC;IACJO,SAAS,EAAE,CAAC;IACZC,WAAW,EAAE;MACXC,IAAI,EAAE,OAAgB;MACtBC,IAAI,EAAE,GAAY;MAClBC,SAAS,EAAE;QACTC,KAAK,EAAEd;MACT,CAAC;MACDe,UAAU,EAAE;QACVD,KAAK,EAAEd;MACT,CAAC;MACDgB,KAAK,EAAE;QACLC,OAAO,EAAE,CAAC;QACVC,UAAU,EAAE,EAAE;QACdd,SAAS,EAAGC,MAIX,IAAK;UACJ,IAAIA,MAAM,CAACc,aAAa,KAAK,GAAG,IAAId,MAAM,CAACe,SAAS,KAAK,CAAC,EAAE;YAC1DrB,gBAAgB,CAACS,OAAO,GAAGa,MAAM,CAAChB,MAAM,CAACiB,KAAK,CAAC;YAC/C,WAAAC,MAAA,CAAWF,MAAM,CAAChB,MAAM,CAACiB,KAAK,CAAC,CAACE,OAAO,CAAC3B,gBAAgB,CAAC;UA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