@oanda/labs-crowd-view-widget 1.0.54 → 1.0.56
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 +452 -0
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +42 -58
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +33 -8
- 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 +28 -14
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +55 -15
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +171 -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 +51 -5
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +30 -7
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +27 -29
- 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/formatXAxisLabel.js +6 -5
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -1
- 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 +91 -21
- 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 +44 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/normalizeLocale.js +11 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/normalizeLocale.js.map +1 -0
- 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/dataUtils/processPriceCandles.js +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +41 -23
- 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/Chart/useResizeObserver.js +47 -0
- package/dist/main/CrowdViewWidget/components/Chart/useResizeObserver.js.map +1 -0
- 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 +31 -10
- package/dist/main/CrowdViewWidget/constants.js.map +1 -1
- package/dist/main/CrowdViewWidget/selectConfig.js +3 -9
- package/dist/main/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/main/translations/sources/en.json +10 -8
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +43 -58
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +32 -7
- 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 +28 -14
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +55 -15
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +163 -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 +50 -5
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +31 -8
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +28 -30
- 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/formatXAxisLabel.js +6 -5
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -1
- 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 +91 -21
- 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 +4 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/normalizeLocale.js +4 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/normalizeLocale.js.map +1 -0
- 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/dataUtils/processPriceCandles.js +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +42 -24
- 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/Chart/useResizeObserver.js +40 -0
- package/dist/module/CrowdViewWidget/components/Chart/useResizeObserver.js.map +1 -0
- 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 +31 -10
- package/dist/module/CrowdViewWidget/constants.js.map +1 -1
- package/dist/module/CrowdViewWidget/selectConfig.js +3 -9
- package/dist/module/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/module/translations/sources/en.json +10 -8
- 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 +6 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.d.ts +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.d.ts +1 -2
- 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/formatXAxisLabel.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getLabelData.d.ts +1 -16
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +6 -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 +4 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/normalizeLocale.d.ts +1 -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 +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/useResizeObserver.d.ts +5 -0
- package/dist/types/CrowdViewWidget/constants.d.ts +28 -15
- package/package.json +3 -3
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +78 -80
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +51 -14
- package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +11 -2
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +34 -19
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +71 -8
- package/src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts +207 -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 +91 -37
- package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +62 -30
- package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +22 -33
- package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +1 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.ts +14 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.ts +6 -4
- package/src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts +11 -35
- package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +157 -31
- package/src/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.ts +80 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.ts +37 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +4 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/normalizeLocale.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/dataUtils/processPriceCandles.ts +1 -1
- package/src/CrowdViewWidget/components/Chart/getOption.ts +47 -17
- package/src/CrowdViewWidget/components/Chart/types.ts +6 -0
- package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +12 -5
- package/src/CrowdViewWidget/components/Chart/useResizeObserver.ts +51 -0
- package/src/CrowdViewWidget/components/Legend/Legend.tsx +1 -1
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +18 -1
- package/src/CrowdViewWidget/constants.ts +34 -7
- package/src/CrowdViewWidget/selectConfig.ts +4 -12
- package/src/translations/sources/en.json +10 -8
- package/test/components/Chart/utils/chartUtils.test.ts +29 -6
- package/test/components/Chart/utils/handleLabelUpdate.test.ts +435 -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
- package/test/utils/processPriceCandles.test.ts +4 -4
|
@@ -8,6 +8,9 @@ const navigationConfig = [{
|
|
|
8
8
|
label: 'position_book'
|
|
9
9
|
}];
|
|
10
10
|
const instrumentSelectConfigOC = [{
|
|
11
|
+
id: InstrumentId.EUR_USD,
|
|
12
|
+
label: 'EUR/USD'
|
|
13
|
+
}, {
|
|
11
14
|
id: InstrumentId.EUR_AUD,
|
|
12
15
|
label: 'EUR/AUD'
|
|
13
16
|
}, {
|
|
@@ -16,9 +19,6 @@ const instrumentSelectConfigOC = [{
|
|
|
16
19
|
}, {
|
|
17
20
|
id: InstrumentId.EUR_JPY,
|
|
18
21
|
label: 'EUR/JPY'
|
|
19
|
-
}, {
|
|
20
|
-
id: InstrumentId.EUR_USD,
|
|
21
|
-
label: 'EUR/USD'
|
|
22
22
|
}, {
|
|
23
23
|
id: InstrumentId.EUR_CHF,
|
|
24
24
|
label: 'EUR/CHF'
|
|
@@ -63,12 +63,6 @@ const granularitySelectConfig = [{
|
|
|
63
63
|
}, {
|
|
64
64
|
id: Granularity.H4,
|
|
65
65
|
label: '4_hours'
|
|
66
|
-
}, {
|
|
67
|
-
id: Granularity.M5,
|
|
68
|
-
label: '5_minutes'
|
|
69
|
-
}, {
|
|
70
|
-
id: Granularity.M15,
|
|
71
|
-
label: '15_minutes'
|
|
72
66
|
}];
|
|
73
67
|
export { granularitySelectConfig, instrumentSelectConfig, instrumentSelectConfigOC, navigationConfig };
|
|
74
68
|
//# sourceMappingURL=selectConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectConfig.js","names":["BookType","Granularity","InstrumentId","navigationConfig","id","Order","label","Position","instrumentSelectConfigOC","EUR_AUD","EUR_GBP","EUR_JPY","
|
|
1
|
+
{"version":3,"file":"selectConfig.js","names":["BookType","Granularity","InstrumentId","navigationConfig","id","Order","label","Position","instrumentSelectConfigOC","EUR_USD","EUR_AUD","EUR_GBP","EUR_JPY","EUR_CHF","USD_CHF","USD_JPY","USD_CAD","GBP_USD","GBP_JPY","GBP_CHF","AUD_JPY","AUD_USD","NZD_USD","instrumentSelectConfig","XAU_USD","XAG_USD","granularitySelectConfig","H1","H4"],"sources":["../../../src/CrowdViewWidget/selectConfig.ts"],"sourcesContent":["import { BookType, Granularity } from '../gql/types/graphql';\nimport { InstrumentId } from './types';\n\nconst navigationConfig = [\n {\n id: BookType.Order,\n label: 'order_book',\n },\n {\n id: BookType.Position,\n label: 'position_book',\n },\n];\n\nconst instrumentSelectConfigOC = [\n {\n id: InstrumentId.EUR_USD,\n label: 'EUR/USD',\n },\n {\n id: InstrumentId.EUR_AUD,\n label: 'EUR/AUD',\n },\n {\n id: InstrumentId.EUR_GBP,\n label: 'EUR/GBP',\n },\n {\n id: InstrumentId.EUR_JPY,\n label: 'EUR/JPY',\n },\n {\n id: InstrumentId.EUR_CHF,\n label: 'EUR/CHF',\n },\n {\n id: InstrumentId.USD_CHF,\n label: 'USD/CHF',\n },\n {\n id: InstrumentId.USD_JPY,\n label: 'USD/JPY',\n },\n {\n id: InstrumentId.USD_CAD,\n label: 'USD/CAD',\n },\n {\n id: InstrumentId.GBP_USD,\n label: 'GBP/USD',\n },\n {\n id: InstrumentId.GBP_JPY,\n label: 'GBP/JPY',\n },\n {\n id: InstrumentId.GBP_CHF,\n label: 'GBP/CHF',\n },\n {\n id: InstrumentId.AUD_JPY,\n label: 'AUD/JPY',\n },\n {\n id: InstrumentId.AUD_USD,\n label: 'AUD/USD',\n },\n {\n id: InstrumentId.NZD_USD,\n label: 'NZD/USD',\n },\n];\n\nconst instrumentSelectConfig = [\n ...instrumentSelectConfigOC,\n {\n id: InstrumentId.XAU_USD,\n label: 'XAU/USD',\n },\n {\n id: InstrumentId.XAG_USD,\n label: 'XAG/USD',\n },\n];\n\nconst granularitySelectConfig = [\n {\n id: Granularity.H1,\n label: '1_hour',\n },\n {\n id: Granularity.H4,\n label: '4_hours',\n },\n];\n\nexport {\n granularitySelectConfig,\n instrumentSelectConfig,\n instrumentSelectConfigOC,\n navigationConfig,\n};\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,WAAW,QAAQ,sBAAsB;AAC5D,SAASC,YAAY,QAAQ,SAAS;AAEtC,MAAMC,gBAAgB,GAAG,CACvB;EACEC,EAAE,EAAEJ,QAAQ,CAACK,KAAK;EAClBC,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEJ,QAAQ,CAACO,QAAQ;EACrBD,KAAK,EAAE;AACT,CAAC,CACF;AAED,MAAME,wBAAwB,GAAG,CAC/B;EACEJ,EAAE,EAAEF,YAAY,CAACO,OAAO;EACxBH,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACQ,OAAO;EACxBJ,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACS,OAAO;EACxBL,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACU,OAAO;EACxBN,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACW,OAAO;EACxBP,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACY,OAAO;EACxBR,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACa,OAAO;EACxBT,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACc,OAAO;EACxBV,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACe,OAAO;EACxBX,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACgB,OAAO;EACxBZ,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACiB,OAAO;EACxBb,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACkB,OAAO;EACxBd,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACmB,OAAO;EACxBf,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACoB,OAAO;EACxBhB,KAAK,EAAE;AACT,CAAC,CACF;AAED,MAAMiB,sBAAsB,GAAG,CAC7B,GAAGf,wBAAwB,EAC3B;EACEJ,EAAE,EAAEF,YAAY,CAACsB,OAAO;EACxBlB,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEF,YAAY,CAACuB,OAAO;EACxBnB,KAAK,EAAE;AACT,CAAC,CACF;AAED,MAAMoB,uBAAuB,GAAG,CAC9B;EACEtB,EAAE,EAAEH,WAAW,CAAC0B,EAAE;EAClBrB,KAAK,EAAE;AACT,CAAC,EACD;EACEF,EAAE,EAAEH,WAAW,CAAC2B,EAAE;EAClBtB,KAAK,EAAE;AACT,CAAC,CACF;AAED,SACEoB,uBAAuB,EACvBH,sBAAsB,EACtBf,wBAAwB,EACxBL,gBAAgB","ignoreList":[]}
|
|
@@ -3,30 +3,32 @@
|
|
|
3
3
|
"15_minutes": "15 minutes",
|
|
4
4
|
"4_hours": "4 hours",
|
|
5
5
|
"5_minutes": "5 minutes",
|
|
6
|
-
"buy_overbalance": "Buy overbalance",
|
|
7
6
|
"buy": "Buy",
|
|
7
|
+
"buy_overbalance": "Buy overbalance",
|
|
8
8
|
"candle": "Candle",
|
|
9
|
-
"
|
|
9
|
+
"close": "Close",
|
|
10
10
|
"data_unavailable": "Data unavailable",
|
|
11
|
+
"even_market_demand": "Even market demand",
|
|
11
12
|
"granularity": "Granularity",
|
|
12
13
|
"high": "High",
|
|
13
14
|
"instrument": "Instrument",
|
|
14
|
-
"long_overbalance": "Long overbalance",
|
|
15
15
|
"long": "Long",
|
|
16
|
+
"long_overbalance": "Long overbalance",
|
|
16
17
|
"low": "Low",
|
|
17
18
|
"no_matching_results": "No matching results",
|
|
18
|
-
"
|
|
19
|
+
"open": "Open",
|
|
19
20
|
"order_book": "Order book",
|
|
20
21
|
"orders": "Orders",
|
|
21
22
|
"pagination_entries_range": "{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries",
|
|
22
23
|
"position_book": "Position book",
|
|
23
|
-
"
|
|
24
|
+
"price": "Price",
|
|
24
25
|
"price_range": "Price range",
|
|
25
26
|
"search": "Search",
|
|
26
|
-
"sell_overbalance": "Sell overbalance",
|
|
27
27
|
"sell": "Sell",
|
|
28
|
+
"sell_overbalance": "Sell overbalance",
|
|
28
29
|
"sentiment": "Sentiment",
|
|
29
|
-
"short_overbalance": "Short overbalance",
|
|
30
30
|
"short": "Short",
|
|
31
|
-
"
|
|
31
|
+
"short_overbalance": "Short overbalance",
|
|
32
|
+
"tap_chart_to_see_more_details": "Tap chart to see more details",
|
|
33
|
+
"trades": "Trades"
|
|
32
34
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ChartProps } from './types';
|
|
3
|
-
declare const Chart: ({ mainData, additionalData, isDesktop }: ChartProps) => React.JSX.Element;
|
|
3
|
+
declare const Chart: ({ mainData, additionalData, isDesktop, isLoading, }: ChartProps) => React.JSX.Element;
|
|
4
4
|
export { Chart };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { DataZoomComponentOption } from 'echarts';
|
|
2
|
-
|
|
2
|
+
interface GetDataZoomConfigParams {
|
|
3
|
+
isDesktop: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const getDataZoomConfig: ({ isDesktop, }: GetDataZoomConfigParams) => DataZoomComponentOption;
|
|
6
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { GraphicComponentOption } from 'echarts';
|
|
2
2
|
interface GetGridLinesParams {
|
|
3
3
|
isDark: boolean;
|
|
4
|
+
isDesktop: boolean;
|
|
4
5
|
}
|
|
5
|
-
export declare const getGridLines: ({ isDark, }: GetGridLinesParams) => GraphicComponentOption[];
|
|
6
|
+
export declare const getGridLines: ({ isDark, isDesktop, }: GetGridLinesParams) => GraphicComponentOption[];
|
|
6
7
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GraphicComponentOption } from 'echarts';
|
|
2
|
+
interface getLabelsConfigParams {
|
|
3
|
+
isDark: boolean;
|
|
4
|
+
isDesktop: boolean;
|
|
5
|
+
labelCallback: (key: string, params?: Record<string, unknown>) => string;
|
|
6
|
+
}
|
|
7
|
+
export declare const getLabelsConfig: ({ isDark, isDesktop, labelCallback, }: getLabelsConfigParams) => GraphicComponentOption[];
|
|
8
|
+
export {};
|
package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { CandlestickSeriesOption } from 'echarts';
|
|
2
2
|
import type { ChartStyles } from '../chartUtils/getChartStyles';
|
|
3
3
|
interface GetSeriesCandlestickConfigParams {
|
|
4
|
-
dates: string[];
|
|
5
|
-
isGreaterThanTwoWeeks: boolean;
|
|
6
4
|
styles: ChartStyles;
|
|
5
|
+
isLoading: boolean;
|
|
7
6
|
}
|
|
8
|
-
export declare const getSeriesCandlestickConfig: ({
|
|
7
|
+
export declare const getSeriesCandlestickConfig: ({ styles, isLoading, }: GetSeriesCandlestickConfigParams) => CandlestickSeriesOption;
|
|
9
8
|
export {};
|
package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ interface GetSeriesHeatmapConfigParams {
|
|
|
6
6
|
isDark: boolean;
|
|
7
7
|
sentimentThresholdMax: number;
|
|
8
8
|
sentimentThresholdMin: number;
|
|
9
|
+
isLoading: boolean;
|
|
9
10
|
}
|
|
10
|
-
export declare const getSeriesHeatmapConfig: ({ bucketWidth, buckets, isDark, sentimentThresholdMax, sentimentThresholdMin, }: GetSeriesHeatmapConfigParams) => CustomSeriesOption;
|
|
11
|
+
export declare const getSeriesHeatmapConfig: ({ bucketWidth, buckets, isDark, sentimentThresholdMax, sentimentThresholdMin, isLoading, }: GetSeriesHeatmapConfigParams) => CustomSeriesOption;
|
|
11
12
|
export {};
|
package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { LineSeriesOption } from 'echarts';
|
|
|
2
2
|
import type { ChartStyles } from '../chartUtils';
|
|
3
3
|
interface GetSeriesSentimentConfigParams {
|
|
4
4
|
styles: ChartStyles;
|
|
5
|
+
isLoading: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare const getSeriesSentimentConfig: ({ styles, }: GetSeriesSentimentConfigParams) => LineSeriesOption;
|
|
7
|
+
export declare const getSeriesSentimentConfig: ({ styles, isLoading, }: GetSeriesSentimentConfigParams) => LineSeriesOption;
|
|
7
8
|
export {};
|
|
@@ -11,6 +11,11 @@ interface GetTooltipConfigParams {
|
|
|
11
11
|
current: number;
|
|
12
12
|
};
|
|
13
13
|
tooltipLinesColor: string;
|
|
14
|
+
sentimentLongs: (number | null)[];
|
|
15
|
+
sentimentShorts: (number | null)[];
|
|
16
|
+
isDesktop: boolean;
|
|
17
|
+
isDark: boolean;
|
|
18
|
+
locale: string;
|
|
14
19
|
}
|
|
15
|
-
export declare const getTooltipConfig: ({ bookType, bucketWidth, buckets, displayPrecision, labelCallback, selectedPriceRef, tooltipLinesColor, }: GetTooltipConfigParams) => TooltipComponentOption;
|
|
20
|
+
export declare const getTooltipConfig: ({ bookType, bucketWidth, buckets, displayPrecision, labelCallback, selectedPriceRef, tooltipLinesColor, sentimentLongs, sentimentShorts, isDesktop, isDark, locale, }: GetTooltipConfigParams) => TooltipComponentOption;
|
|
16
21
|
export {};
|
|
@@ -2,6 +2,7 @@ import type { XAXisComponentOption } from 'echarts';
|
|
|
2
2
|
interface GetXAxisConfigParams {
|
|
3
3
|
dates: string[];
|
|
4
4
|
isGreaterThanTwoWeeks: boolean;
|
|
5
|
+
locale: string;
|
|
5
6
|
}
|
|
6
|
-
export declare const getXAxisConfig: ({ dates, isGreaterThanTwoWeeks, }: GetXAxisConfigParams) => XAXisComponentOption[];
|
|
7
|
+
export declare const getXAxisConfig: ({ dates, isGreaterThanTwoWeeks, locale, }: GetXAxisConfigParams) => XAXisComponentOption[];
|
|
7
8
|
export {};
|
|
@@ -3,7 +3,6 @@ interface GetYAxisConfigParams {
|
|
|
3
3
|
bucketWidth: number;
|
|
4
4
|
displayPrecision: number;
|
|
5
5
|
isDesktop: boolean;
|
|
6
|
-
labelCallback: (key: string, params?: Record<string, unknown>) => string;
|
|
7
6
|
}
|
|
8
|
-
export declare const getYAxisConfig: ({ bucketWidth, displayPrecision, isDesktop,
|
|
7
|
+
export declare const getYAxisConfig: ({ bucketWidth, displayPrecision, isDesktop, }: GetYAxisConfigParams) => YAXisComponentOption[];
|
|
9
8
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './getDataZoomConfig';
|
|
2
2
|
export * from './getGridConfig';
|
|
3
3
|
export * from './getGridLines';
|
|
4
|
+
export * from './getLabelsConfig';
|
|
4
5
|
export * from './getSeriesCandlestickConfig';
|
|
5
6
|
export * from './getSeriesHeatmapConfig';
|
|
6
7
|
export * from './getSeriesSentimentConfig';
|
package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatXAxisAdditionalLabel: (value: unknown, isGreaterThanTwoWeeks: boolean, locale: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const formatXAxisLabel: (value: unknown, isGreaterThanTwoWeeks: boolean) => string;
|
|
1
|
+
export declare const formatXAxisLabel: (value: unknown, isGreaterThanTwoWeeks: boolean, locale: string) => string;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
1
|
import type { GetLabelsDataProps } from '../types';
|
|
2
|
-
export declare const getLabelData: ({ dates, isGreaterThanTwoWeeks, }: GetLabelsDataProps) =>
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly xAxis: string;
|
|
5
|
-
readonly y: number;
|
|
6
|
-
readonly silent: true;
|
|
7
|
-
readonly emphasis: {
|
|
8
|
-
readonly disabled: true;
|
|
9
|
-
};
|
|
10
|
-
readonly label: {
|
|
11
|
-
readonly fontFamily: "Sofia W03";
|
|
12
|
-
readonly fontSize: 10;
|
|
13
|
-
readonly position: "bottom";
|
|
14
|
-
readonly align: "center";
|
|
15
|
-
readonly formatter: "{b}";
|
|
16
|
-
};
|
|
17
|
-
}[];
|
|
2
|
+
export declare const getLabelData: ({ dates, isGreaterThanTwoWeeks, }: GetLabelsDataProps) => string[];
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { BookType } from '../../../../gql/types/graphql';
|
|
2
2
|
import type { Bucket, TooltipParam } from '../types';
|
|
3
|
-
export declare const getTooltipFormatter: ({ params, buckets, bucketWidth, selectedPrice, bookType, labelCallback, }: {
|
|
3
|
+
export declare const getTooltipFormatter: ({ params, buckets, bucketWidth, selectedPrice, bookType, labelCallback, sentimentLongs, sentimentShorts, isDesktop, locale, isDark, }: {
|
|
4
4
|
params: TooltipParam[];
|
|
5
5
|
buckets: Bucket[][];
|
|
6
6
|
bucketWidth: number;
|
|
7
7
|
selectedPrice: number;
|
|
8
8
|
bookType: BookType;
|
|
9
9
|
labelCallback: (key: string) => string;
|
|
10
|
+
sentimentLongs: (number | null)[];
|
|
11
|
+
sentimentShorts: (number | null)[];
|
|
12
|
+
isDesktop: boolean;
|
|
13
|
+
locale: string;
|
|
14
|
+
isDark: boolean;
|
|
10
15
|
}) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EChartsType } from 'echarts';
|
|
2
|
+
import type { MutableRefObject } from 'react';
|
|
3
|
+
import type { ChartProps } from '../types';
|
|
4
|
+
export declare const handleLabelUpdate: (instance: EChartsType, mainData: ChartProps["mainData"], labelTimerRef: MutableRefObject<NodeJS.Timeout | null>, isGreaterThanTwoWeeksRef: MutableRefObject<boolean | null>, locale: string) => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { EChartsType } from 'echarts';
|
|
2
|
+
import type { MutableRefObject } from 'react';
|
|
3
|
+
export declare const handleTooltipUpdate: (instance: EChartsType, zoomTimerRef: MutableRefObject<NodeJS.Timeout | null>, tooltipVisibleRef: MutableRefObject<boolean>, canHover: boolean) => void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export * from './formatXAxisAdditionalLabel';
|
|
1
2
|
export * from './formatXAxisLabel';
|
|
2
3
|
export * from './getChartStyles';
|
|
3
4
|
export * from './getGradientColor';
|
|
4
5
|
export * from './getLabelData';
|
|
5
6
|
export * from './getRectColor';
|
|
6
7
|
export * from './getTooltipFormatter';
|
|
8
|
+
export * from './handleLabelUpdate';
|
|
9
|
+
export * from './handleTooltipUpdate';
|
|
7
10
|
export * from './isDifferenceGreaterThanTwoWeeks';
|
|
11
|
+
export * from './normalizeLocale';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizeLocale: (locale: string) => string;
|
|
@@ -34,6 +34,9 @@ export interface UseCrowdViewDataReturn {
|
|
|
34
34
|
mainData?: CrowdViewMainData | null;
|
|
35
35
|
additionalData?: CrowdViewAdditionalData | null;
|
|
36
36
|
loading: boolean;
|
|
37
|
+
priceCandlesLoading: boolean;
|
|
38
|
+
orderPositionLoading: boolean;
|
|
39
|
+
sentimentsLoading: boolean;
|
|
37
40
|
error: boolean;
|
|
38
41
|
}
|
|
39
42
|
interface GetOptionProps {
|
|
@@ -41,13 +44,16 @@ interface GetOptionProps {
|
|
|
41
44
|
additionalData: CrowdViewAdditionalData;
|
|
42
45
|
isDark: boolean;
|
|
43
46
|
isDesktop: boolean;
|
|
47
|
+
isLoading: boolean;
|
|
44
48
|
labelCallback: (key: string, params?: Record<string, unknown>) => string;
|
|
49
|
+
locale: string;
|
|
45
50
|
}
|
|
46
51
|
export type GetOptionType = (props: GetOptionProps) => EChartsOption;
|
|
47
52
|
export interface ChartProps {
|
|
48
53
|
mainData: CrowdViewMainData;
|
|
49
54
|
additionalData: CrowdViewAdditionalData;
|
|
50
55
|
isDesktop: boolean;
|
|
56
|
+
isLoading: boolean;
|
|
51
57
|
}
|
|
52
58
|
export interface ChartWithDataProps {
|
|
53
59
|
bookType: BookType;
|
|
@@ -1,35 +1,48 @@
|
|
|
1
1
|
import { InstrumentId } from './types';
|
|
2
2
|
export declare const BUCKET_CONFIG: {
|
|
3
|
-
readonly
|
|
3
|
+
readonly MULTIPLIER_5M: 1;
|
|
4
|
+
readonly MULTIPLIER_15M: 1;
|
|
5
|
+
readonly MULTIPLIER_1H: 2;
|
|
6
|
+
readonly MULTIPLIER_4H: 4;
|
|
4
7
|
readonly PRICE_MARGIN_MULTIPLIER: 2;
|
|
5
8
|
};
|
|
6
9
|
export declare const TIME_THRESHOLDS: {
|
|
7
10
|
readonly TWO_WEEKS_MS: number;
|
|
8
11
|
};
|
|
9
12
|
export declare const CHART_CONFIG: {
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
13
|
+
readonly HEIGHT_DESKTOP: number;
|
|
14
|
+
readonly HEIGHT_MOBILE: number;
|
|
15
|
+
readonly MAIN_HEIGHT_DESKTOP: number;
|
|
16
|
+
readonly MAIN_HEIGHT_MOBILE: number;
|
|
17
|
+
readonly MARGIN_BETWEEN: number;
|
|
18
|
+
readonly SENTIMENT_HEIGHT: number;
|
|
19
|
+
readonly WIDTH: number;
|
|
20
|
+
readonly X_LABEL_SIZE: number;
|
|
21
|
+
readonly Y_LABEL_SIZE_DESKTOP: number;
|
|
22
|
+
readonly Y_LABEL_SIZE_MOBILE: number;
|
|
23
|
+
readonly Y_SENTIMENT_LABEL_DESKTOP_SIZE: number;
|
|
24
|
+
readonly Y_SENTIMENT_LABEL_MOBILE_SIZE: number;
|
|
25
|
+
readonly INITIAL_START_ZOOM_DESKTOP: number;
|
|
26
|
+
readonly INITIAL_START_ZOOM_MOBILE: number;
|
|
27
|
+
readonly INITIAL_END_ZOOM: number;
|
|
28
|
+
readonly X_AXIS_DATE_PADDING: string;
|
|
29
|
+
readonly SENTIMENT_MIN: number;
|
|
30
|
+
readonly SENTIMENT_MAX: number;
|
|
31
|
+
readonly TOP_MARGIN_DESKTOP: number;
|
|
32
|
+
readonly TOP_MARGIN_MOBILE: number;
|
|
33
|
+
readonly MOBILE_TOOLTIP_HEIGHT: number;
|
|
34
|
+
readonly TOOLTIP_OFFSET: number;
|
|
24
35
|
};
|
|
25
36
|
export declare const COLOR_MAP: {
|
|
26
37
|
readonly dark: {
|
|
27
38
|
readonly long: readonly [string, string];
|
|
28
39
|
readonly short: readonly [string, string];
|
|
40
|
+
readonly backgroundColor: string;
|
|
29
41
|
};
|
|
30
42
|
readonly light: {
|
|
31
43
|
readonly long: readonly [string, string];
|
|
32
44
|
readonly short: readonly [string, string];
|
|
45
|
+
readonly backgroundColor: string;
|
|
33
46
|
};
|
|
34
47
|
};
|
|
35
48
|
export declare const INSTRUMENTS_CONFIG: Record<InstrumentId, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-crowd-view-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.56",
|
|
4
4
|
"description": "Labs Crowd View Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "OANDA",
|
|
14
14
|
"license": "UNLICENSED",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.238",
|
|
17
17
|
"@oanda/mono-i18n": "10.0.1",
|
|
18
18
|
"chroma-js": "^3.1.2",
|
|
19
19
|
"decimal.js": "^10.6.0",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@graphql-codegen/client-preset": "4.1.0",
|
|
25
25
|
"@types/chroma-js": "^3.1.2"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "e8ab708b3dac3a041e9ed7fda6458ca06571d6cf"
|
|
28
28
|
}
|
|
@@ -18,21 +18,18 @@ import {
|
|
|
18
18
|
} from 'echarts/components';
|
|
19
19
|
import * as echarts from 'echarts/core';
|
|
20
20
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
21
|
-
import React from 'react';
|
|
21
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
22
|
+
import { useMediaQuery } from 'usehooks-ts';
|
|
22
23
|
|
|
23
24
|
import { CHART_CONFIG } from '../../constants';
|
|
24
25
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
handleLabelUpdate,
|
|
27
|
+
handleTooltipUpdate,
|
|
27
28
|
isDifferenceGreaterThanTwoWeeks,
|
|
29
|
+
normalizeLocale,
|
|
28
30
|
} from './chartUtils';
|
|
29
31
|
import { getOption } from './getOption';
|
|
30
|
-
import type {
|
|
31
|
-
ChartProps,
|
|
32
|
-
DataZoomArray,
|
|
33
|
-
DataZoomEvent,
|
|
34
|
-
XAxisArray,
|
|
35
|
-
} from './types';
|
|
32
|
+
import type { ChartProps, DataZoomEvent } from './types';
|
|
36
33
|
|
|
37
34
|
echarts.use([
|
|
38
35
|
GridSimpleComponent,
|
|
@@ -51,87 +48,88 @@ echarts.use([
|
|
|
51
48
|
echarts.registerTheme('dark_theme', getChartTheme(Theme.Dark));
|
|
52
49
|
echarts.registerTheme('light_theme', getChartTheme(Theme.Light));
|
|
53
50
|
|
|
54
|
-
const Chart = ({
|
|
51
|
+
const Chart = ({
|
|
52
|
+
mainData,
|
|
53
|
+
additionalData,
|
|
54
|
+
isDesktop,
|
|
55
|
+
isLoading,
|
|
56
|
+
}: ChartProps) => {
|
|
55
57
|
const { isDark } = useLayoutProvider();
|
|
56
|
-
const { lang } = useLocale();
|
|
58
|
+
const { lang, locale } = useLocale();
|
|
59
|
+
const canHover = useMediaQuery('(hover: hover)');
|
|
60
|
+
const labelTimerRef = useRef<NodeJS.Timeout | null>(null);
|
|
61
|
+
const isGreaterThanTwoWeeksRef = useRef<boolean | null>(null);
|
|
62
|
+
const zoomTimerRef = useRef<NodeJS.Timeout | null>(null);
|
|
63
|
+
const tooltipVisibleRef = useRef<boolean>(true);
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
lazyUpdate={true}
|
|
64
|
-
option={getOption({
|
|
65
|
-
mainData,
|
|
66
|
-
additionalData,
|
|
67
|
-
isDark,
|
|
68
|
-
isDesktop,
|
|
69
|
-
labelCallback: lang,
|
|
70
|
-
})}
|
|
71
|
-
opts={{ renderer: 'canvas' }}
|
|
72
|
-
onEvents={{
|
|
73
|
-
datazoom: (params: DataZoomEvent, instance: EChartsType) => {
|
|
74
|
-
if (!params.batch?.[0]) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
65
|
+
const initialIsGreaterThanTwoWeeks = useMemo(() => {
|
|
66
|
+
const { dates } = mainData;
|
|
67
|
+
const initialStartZoom = isDesktop
|
|
68
|
+
? CHART_CONFIG.INITIAL_START_ZOOM_DESKTOP
|
|
69
|
+
: CHART_CONFIG.INITIAL_START_ZOOM_MOBILE;
|
|
77
70
|
|
|
78
|
-
|
|
71
|
+
const visibleXAxisData = dates.slice(
|
|
72
|
+
(dates.length * initialStartZoom) / 100,
|
|
73
|
+
(dates.length * CHART_CONFIG.INITIAL_END_ZOOM) / 100
|
|
74
|
+
);
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
dataZoom.length === 0 ||
|
|
84
|
-
!dataZoom[0] ||
|
|
85
|
-
typeof dataZoom[0].startValue !== 'number' ||
|
|
86
|
-
typeof dataZoom[0].endValue !== 'number'
|
|
87
|
-
) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
76
|
+
if (visibleXAxisData.length === 0) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
90
79
|
|
|
91
|
-
|
|
80
|
+
return isDifferenceGreaterThanTwoWeeks(
|
|
81
|
+
visibleXAxisData[0],
|
|
82
|
+
visibleXAxisData[visibleXAxisData.length - 1]
|
|
83
|
+
);
|
|
84
|
+
}, [mainData, isDesktop]);
|
|
92
85
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
isGreaterThanTwoWeeksRef.current = initialIsGreaterThanTwoWeeks;
|
|
88
|
+
}, [initialIsGreaterThanTwoWeeks]);
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
const chartOption = useMemo(
|
|
91
|
+
() =>
|
|
92
|
+
getOption({
|
|
93
|
+
mainData,
|
|
94
|
+
additionalData,
|
|
95
|
+
isDark,
|
|
96
|
+
isDesktop,
|
|
97
|
+
isLoading,
|
|
98
|
+
locale: normalizeLocale(locale),
|
|
99
|
+
labelCallback: lang,
|
|
100
|
+
}),
|
|
101
|
+
[mainData, additionalData, isDark, isDesktop, isLoading, lang, locale]
|
|
102
|
+
);
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
// Memoize event handler to prevent unnecessary re-renders
|
|
105
|
+
const handleDataZoom = useCallback(
|
|
106
|
+
(_params: DataZoomEvent, instance: EChartsType) => {
|
|
107
|
+
handleTooltipUpdate(instance, zoomTimerRef, tooltipVisibleRef, canHover);
|
|
108
|
+
handleLabelUpdate(
|
|
109
|
+
instance,
|
|
110
|
+
mainData,
|
|
111
|
+
labelTimerRef,
|
|
112
|
+
isGreaterThanTwoWeeksRef,
|
|
113
|
+
normalizeLocale(locale)
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
[mainData, canHover, locale]
|
|
117
|
+
);
|
|
106
118
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
isGreaterThanTwoWeeks,
|
|
111
|
-
});
|
|
119
|
+
const chartHeight = isDesktop
|
|
120
|
+
? CHART_CONFIG.HEIGHT_DESKTOP
|
|
121
|
+
: CHART_CONFIG.HEIGHT_MOBILE;
|
|
112
122
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
series: [
|
|
125
|
-
{
|
|
126
|
-
id: 'candlestick',
|
|
127
|
-
markPoint: {
|
|
128
|
-
data: labelsData,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
},
|
|
123
|
+
return (
|
|
124
|
+
<BaseChart
|
|
125
|
+
chartHeight={chartHeight}
|
|
126
|
+
echarts={echarts}
|
|
127
|
+
isDark={isDark}
|
|
128
|
+
lazyUpdate={true}
|
|
129
|
+
option={chartOption}
|
|
130
|
+
opts={{ renderer: 'canvas' }}
|
|
131
|
+
onEvents={{
|
|
132
|
+
datazoom: handleDataZoom,
|
|
135
133
|
}}
|
|
136
134
|
/>
|
|
137
135
|
);
|