@oanda/labs-crowd-view-widget 1.0.53 → 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 +444 -0
- package/dist/main/CrowdViewWidget/Main.js +4 -2
- package/dist/main/CrowdViewWidget/Main.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +41 -83
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +23 -17
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +24 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +30 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/{utils → chartOptions}/getGridLines.js +30 -49
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
- 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 +47 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +83 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +68 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +60 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +31 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +57 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +66 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js +127 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -0
- 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 +18 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.js +4 -4
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +14 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +23 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +14 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +120 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
- 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 +116 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +15 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -0
- package/dist/main/CrowdViewWidget/{utils/instrumentUtils.js → components/Chart/dataUtils/getInstrumentConfigForDivision.js} +3 -3
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.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/getTimeSpanForGranularity.js +18 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.js +19 -8
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +115 -0
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/index.js +11 -11
- package/dist/main/CrowdViewWidget/components/Chart/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +15 -12
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js +15 -12
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +15 -16
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/main/CrowdViewWidget/constants.js +20 -14
- 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 +3 -1
- package/dist/module/CrowdViewWidget/Main.js +4 -2
- package/dist/module/CrowdViewWidget/Main.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +43 -84
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +22 -16
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +17 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +23 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/{utils → chartOptions}/getGridLines.js +30 -49
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
- 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 +39 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +76 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +61 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +53 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +24 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +50 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +59 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +12 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -0
- 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 +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.js +4 -4
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +6 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +16 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +7 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +113 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
- 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 +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +8 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -0
- package/dist/module/CrowdViewWidget/{utils/instrumentUtils.js → components/Chart/dataUtils/getInstrumentConfigForDivision.js} +3 -3
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.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/getTimeSpanForGranularity.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js +8 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +108 -0
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/index.js +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/index.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 +15 -12
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +15 -16
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/module/CrowdViewWidget/constants.js +18 -13
- 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 +3 -1
- package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridLines.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.d.ts +8 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +8 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts +12 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts +8 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +18 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/index.d.ts +11 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.d.ts +2 -2
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getLabelData.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getRectColor.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +12 -0
- 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 +10 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.d.ts +1 -0
- package/dist/types/CrowdViewWidget/{utils/instrumentUtils.d.ts → components/Chart/dataUtils/getInstrumentConfigForDivision.d.ts} +2 -2
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.d.ts +3 -2
- package/dist/types/CrowdViewWidget/components/Chart/index.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +5 -0
- package/dist/types/CrowdViewWidget/components/Legend/Legend.d.ts +1 -4
- package/dist/types/CrowdViewWidget/components/Legend/LegendBar.d.ts +1 -3
- package/dist/types/CrowdViewWidget/constants.d.ts +13 -9
- package/package.json +3 -3
- package/src/CrowdViewWidget/Main.tsx +3 -2
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +76 -109
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +33 -28
- package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +22 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +29 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +126 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts +191 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +44 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts +103 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts +72 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +74 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.ts +32 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +68 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +60 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +11 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.ts +16 -0
- package/src/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.ts +9 -6
- package/src/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.ts +16 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts +18 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts +27 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +212 -0
- 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 +10 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.ts +13 -0
- package/src/CrowdViewWidget/{utils/instrumentUtils.ts → components/Chart/dataUtils/getInstrumentConfigForDivision.ts} +2 -2
- package/src/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.ts +14 -0
- package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.ts +3 -2
- package/src/CrowdViewWidget/components/Chart/getOption.ts +138 -0
- package/src/CrowdViewWidget/components/Chart/index.ts +1 -1
- package/src/CrowdViewWidget/components/Chart/types.ts +5 -0
- package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +14 -7
- package/src/CrowdViewWidget/components/Legend/Legend.tsx +24 -22
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +29 -26
- package/src/CrowdViewWidget/constants.ts +30 -19
- package/src/CrowdViewWidget/selectConfig.ts +0 -8
- package/src/translations/sources/en.json +3 -1
- package/test/components/Chart/utils/chartUtils.test.ts +20 -9
- package/test/components/Chart/utils/getChartStyles.test.ts +10 -10
- package/test/components/Chart/utils/handleLabelUpdate.test.ts +419 -0
- package/test/components/Chart/utils/handleTooltipUpdate.test.ts +140 -0
- package/test/components/Chart/utils/processSentiments.test.ts +1 -1
- package/test/components/Legend.test.tsx +15 -23
- package/test/components/LegendBar.test.tsx +45 -63
- package/test/utils/instrumentUtils.test.ts +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js +0 -399
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -126
- package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/validateData.js.map +0 -1
- package/dist/main/CrowdViewWidget/utils/instrumentUtils.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js +0 -391
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -113
- package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js +0 -7
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/validateData.js.map +0 -1
- package/dist/module/CrowdViewWidget/utils/instrumentUtils.js.map +0 -1
- package/dist/types/CrowdViewWidget/components/Chart/utils/chartUtils.d.ts +0 -30
- package/dist/types/CrowdViewWidget/components/Chart/utils/getGridLines.d.ts +0 -97
- package/src/CrowdViewWidget/components/Chart/chartOptions.ts +0 -449
- package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +0 -228
- package/src/CrowdViewWidget/components/Chart/utils/getGridLines.ts +0 -148
- /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.js +0 -0
- /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.js +0 -0
- /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.js +0 -0
- /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +0 -0
- /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.js +0 -0
- /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.js +0 -0
- /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.js +0 -0
- /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.d.ts +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.d.ts +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.d.ts +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.d.ts +0 -0
- /package/dist/types/CrowdViewWidget/components/Chart/{chartOptions.d.ts → getOption.d.ts} +0 -0
- /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.ts +0 -0
- /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.ts +0 -0
- /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.ts +0 -0
- /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.ts +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { EChartsType } from 'echarts';
|
|
2
|
+
import type { MutableRefObject } from 'react';
|
|
3
|
+
|
|
4
|
+
export const handleTooltipUpdate = (
|
|
5
|
+
instance: EChartsType,
|
|
6
|
+
zoomTimerRef: MutableRefObject<NodeJS.Timeout | null>,
|
|
7
|
+
tooltipVisibleRef: MutableRefObject<boolean>,
|
|
8
|
+
canHover: boolean
|
|
9
|
+
): void => {
|
|
10
|
+
if (!canHover) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (tooltipVisibleRef.current) {
|
|
15
|
+
instance.setOption({
|
|
16
|
+
tooltip: {
|
|
17
|
+
show: false,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
tooltipVisibleRef.current = false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (zoomTimerRef.current) {
|
|
24
|
+
clearTimeout(zoomTimerRef.current);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
zoomTimerRef.current = setTimeout(() => {
|
|
28
|
+
if (!tooltipVisibleRef.current) {
|
|
29
|
+
instance.setOption({
|
|
30
|
+
tooltip: {
|
|
31
|
+
show: true,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
tooltipVisibleRef.current = true;
|
|
35
|
+
}
|
|
36
|
+
}, 100);
|
|
37
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './formatXAxisAdditionalLabel';
|
|
2
|
+
export * from './formatXAxisLabel';
|
|
3
|
+
export * from './getChartStyles';
|
|
4
|
+
export * from './getGradientColor';
|
|
5
|
+
export * from './getLabelData';
|
|
6
|
+
export * from './getRectColor';
|
|
7
|
+
export * from './getTooltipFormatter';
|
|
8
|
+
export * from './handleLabelUpdate';
|
|
9
|
+
export * from './handleTooltipUpdate';
|
|
10
|
+
export * from './isDifferenceGreaterThanTwoWeeks';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TIME_THRESHOLDS } from '../../../constants';
|
|
2
|
+
|
|
3
|
+
export const isDifferenceGreaterThanTwoWeeks = (
|
|
4
|
+
startDate: string,
|
|
5
|
+
endDate: string
|
|
6
|
+
) => {
|
|
7
|
+
const date1 = new Date(startDate);
|
|
8
|
+
const date2 = new Date(endDate);
|
|
9
|
+
|
|
10
|
+
const differenceInMs = Math.abs(date2.getTime() - date1.getTime());
|
|
11
|
+
|
|
12
|
+
return differenceInMs < TIME_THRESHOLDS.TWO_WEEKS_MS;
|
|
13
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Division } from '
|
|
1
|
+
import { Division } from '../../../../gql/types/graphql';
|
|
2
2
|
import {
|
|
3
3
|
instrumentSelectConfig,
|
|
4
4
|
instrumentSelectConfigOC,
|
|
5
|
-
} from '
|
|
5
|
+
} from '../../../selectConfig';
|
|
6
6
|
|
|
7
7
|
export const getInstrumentConfigForDivision = (division: Division) => {
|
|
8
8
|
return division === Division.Oc
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Granularity } from '../../../../gql/types/graphql';
|
|
2
|
+
import { BUCKET_CONFIG } from '../../../constants';
|
|
3
|
+
|
|
4
|
+
export const getMultiplayerForTimeSpan = (granularity: Granularity): number => {
|
|
5
|
+
const timeSpanMultiplierMap: Record<Granularity, number> = {
|
|
6
|
+
[Granularity.M5]: BUCKET_CONFIG.MULTIPLIER_5M,
|
|
7
|
+
[Granularity.M15]: BUCKET_CONFIG.MULTIPLIER_15M,
|
|
8
|
+
[Granularity.H1]: BUCKET_CONFIG.MULTIPLIER_1H,
|
|
9
|
+
[Granularity.H4]: BUCKET_CONFIG.MULTIPLIER_4H,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return timeSpanMultiplierMap[granularity] || BUCKET_CONFIG.MULTIPLIER_5M;
|
|
13
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Granularity, TimeSpan } from '../../../../gql/types/graphql';
|
|
2
|
+
|
|
3
|
+
export const getTimeSpanForGranularity = (
|
|
4
|
+
granularity: Granularity
|
|
5
|
+
): TimeSpan => {
|
|
6
|
+
const granularityTimeSpanMap: Record<Granularity, TimeSpan> = {
|
|
7
|
+
[Granularity.M5]: TimeSpan.TwoDays,
|
|
8
|
+
[Granularity.M15]: TimeSpan.FiveDays,
|
|
9
|
+
[Granularity.H1]: TimeSpan.TwentyDays,
|
|
10
|
+
[Granularity.H4]: TimeSpan.NinetyDays,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return granularityTimeSpanMap[granularity] || TimeSpan.TwoDays;
|
|
14
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './getInstrumentConfigForDivision';
|
|
2
|
+
export * from './getMultiplayerForTimeSpan';
|
|
3
|
+
export * from './getTimeSpanForGranularity';
|
|
3
4
|
export * from './processOrderPositionBooks';
|
|
4
5
|
export * from './processPriceCandles';
|
|
5
6
|
export * from './processSentiments';
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { CHART_CONFIG } from '../../constants';
|
|
2
|
+
import {
|
|
3
|
+
getDataZoomConfig,
|
|
4
|
+
getGridConfig,
|
|
5
|
+
getGridLines,
|
|
6
|
+
getLabelsConfig,
|
|
7
|
+
getSeriesCandlestickConfig,
|
|
8
|
+
getSeriesHeatmapConfig,
|
|
9
|
+
getSeriesSentimentConfig,
|
|
10
|
+
getTooltipConfig,
|
|
11
|
+
getVisualMapConfig,
|
|
12
|
+
getXAxisConfig,
|
|
13
|
+
getYAxisConfig,
|
|
14
|
+
} from './chartOptions';
|
|
15
|
+
import { isDifferenceGreaterThanTwoWeeks } from './chartUtils';
|
|
16
|
+
import { getChartStyles } from './chartUtils/getChartStyles';
|
|
17
|
+
import type { GetOptionType } from './types';
|
|
18
|
+
|
|
19
|
+
export const getOption: GetOptionType = ({
|
|
20
|
+
mainData: {
|
|
21
|
+
dates,
|
|
22
|
+
candlesOpen,
|
|
23
|
+
candlesClose,
|
|
24
|
+
candlesLow,
|
|
25
|
+
candlesHigh,
|
|
26
|
+
bookPrices,
|
|
27
|
+
bookIndexes,
|
|
28
|
+
sentimentShorts,
|
|
29
|
+
sentimentLongs,
|
|
30
|
+
},
|
|
31
|
+
additionalData: {
|
|
32
|
+
bucketWidth,
|
|
33
|
+
buckets,
|
|
34
|
+
displayPrecision,
|
|
35
|
+
bookType,
|
|
36
|
+
sentimentThresholdMin,
|
|
37
|
+
sentimentThresholdMax,
|
|
38
|
+
},
|
|
39
|
+
isLoading,
|
|
40
|
+
isDark,
|
|
41
|
+
isDesktop,
|
|
42
|
+
labelCallback,
|
|
43
|
+
}) => {
|
|
44
|
+
const styles = getChartStyles(isDark);
|
|
45
|
+
const selectedPriceRef = { current: 0 };
|
|
46
|
+
|
|
47
|
+
const initialStartZoom = isDesktop
|
|
48
|
+
? CHART_CONFIG.INITIAL_START_ZOOM_DESKTOP
|
|
49
|
+
: CHART_CONFIG.INITIAL_START_ZOOM_MOBILE;
|
|
50
|
+
|
|
51
|
+
const visibleXAxisData = dates.slice(
|
|
52
|
+
(dates.length * initialStartZoom) / 100,
|
|
53
|
+
(dates.length * CHART_CONFIG.INITIAL_END_ZOOM) / 100
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(
|
|
57
|
+
visibleXAxisData[0],
|
|
58
|
+
visibleXAxisData[visibleXAxisData.length - 1]
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const heatmapChart =
|
|
62
|
+
bookPrices && bookPrices.length > 0
|
|
63
|
+
? [
|
|
64
|
+
getSeriesHeatmapConfig({
|
|
65
|
+
bucketWidth,
|
|
66
|
+
buckets,
|
|
67
|
+
isDark,
|
|
68
|
+
sentimentThresholdMax,
|
|
69
|
+
sentimentThresholdMin,
|
|
70
|
+
isLoading,
|
|
71
|
+
}),
|
|
72
|
+
]
|
|
73
|
+
: [];
|
|
74
|
+
|
|
75
|
+
const sentimentChart =
|
|
76
|
+
sentimentLongs && sentimentLongs.length > 0
|
|
77
|
+
? [
|
|
78
|
+
getSeriesSentimentConfig({
|
|
79
|
+
styles,
|
|
80
|
+
isLoading,
|
|
81
|
+
}),
|
|
82
|
+
]
|
|
83
|
+
: [];
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
animation: false,
|
|
87
|
+
tooltip: getTooltipConfig({
|
|
88
|
+
bookType,
|
|
89
|
+
bucketWidth,
|
|
90
|
+
buckets,
|
|
91
|
+
displayPrecision,
|
|
92
|
+
labelCallback,
|
|
93
|
+
selectedPriceRef,
|
|
94
|
+
tooltipLinesColor: styles.tooltipLinesColor,
|
|
95
|
+
sentimentLongs,
|
|
96
|
+
sentimentShorts,
|
|
97
|
+
}),
|
|
98
|
+
grid: getGridConfig({ isDesktop }),
|
|
99
|
+
xAxis: getXAxisConfig({
|
|
100
|
+
dates,
|
|
101
|
+
isGreaterThanTwoWeeks,
|
|
102
|
+
}),
|
|
103
|
+
yAxis: getYAxisConfig({
|
|
104
|
+
bucketWidth,
|
|
105
|
+
displayPrecision,
|
|
106
|
+
}),
|
|
107
|
+
dataZoom: getDataZoomConfig({ isDesktop }),
|
|
108
|
+
visualMap: getVisualMapConfig({
|
|
109
|
+
sentimentLongColor: styles.sentimentLongColor,
|
|
110
|
+
sentimentShortColor: styles.sentimentShortColor,
|
|
111
|
+
}),
|
|
112
|
+
graphic: [
|
|
113
|
+
...getGridLines({ isDark, isDesktop }),
|
|
114
|
+
...getLabelsConfig({ isDark, isDesktop, labelCallback }),
|
|
115
|
+
],
|
|
116
|
+
dataset: {
|
|
117
|
+
source: {
|
|
118
|
+
dates,
|
|
119
|
+
candlesOpen,
|
|
120
|
+
candlesClose,
|
|
121
|
+
candlesLow,
|
|
122
|
+
candlesHigh,
|
|
123
|
+
bookPrices: bookPrices ?? [],
|
|
124
|
+
bookIndexes: bookIndexes ?? [],
|
|
125
|
+
sentimentShorts,
|
|
126
|
+
sentimentLongs,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
series: [
|
|
130
|
+
getSeriesCandlestickConfig({
|
|
131
|
+
styles,
|
|
132
|
+
isLoading,
|
|
133
|
+
}),
|
|
134
|
+
...heatmapChart,
|
|
135
|
+
...sentimentChart,
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -44,6 +44,9 @@ export interface UseCrowdViewDataReturn {
|
|
|
44
44
|
mainData?: CrowdViewMainData | null;
|
|
45
45
|
additionalData?: CrowdViewAdditionalData | null;
|
|
46
46
|
loading: boolean;
|
|
47
|
+
priceCandlesLoading: boolean;
|
|
48
|
+
orderPositionLoading: boolean;
|
|
49
|
+
sentimentsLoading: boolean;
|
|
47
50
|
error: boolean;
|
|
48
51
|
}
|
|
49
52
|
|
|
@@ -52,6 +55,7 @@ interface GetOptionProps {
|
|
|
52
55
|
additionalData: CrowdViewAdditionalData;
|
|
53
56
|
isDark: boolean;
|
|
54
57
|
isDesktop: boolean;
|
|
58
|
+
isLoading: boolean;
|
|
55
59
|
labelCallback: (key: string, params?: Record<string, unknown>) => string;
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -61,6 +65,7 @@ export interface ChartProps {
|
|
|
61
65
|
mainData: CrowdViewMainData;
|
|
62
66
|
additionalData: CrowdViewAdditionalData;
|
|
63
67
|
isDesktop: boolean;
|
|
68
|
+
isLoading: boolean;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
export interface ChartWithDataProps {
|
|
@@ -14,14 +14,15 @@ import type {
|
|
|
14
14
|
} from '../../../gql/types/graphql';
|
|
15
15
|
import { BookType, DataSource, Division } from '../../../gql/types/graphql';
|
|
16
16
|
import { BUCKET_CONFIG, INSTRUMENTS_CONFIG } from '../../constants';
|
|
17
|
-
import type { UseCrowdViewDataProps, UseCrowdViewDataReturn } from './types';
|
|
18
17
|
import {
|
|
18
|
+
getMultiplayerForTimeSpan,
|
|
19
19
|
getTimeSpanForGranularity,
|
|
20
20
|
processOrderPositionBooks,
|
|
21
21
|
processPriceCandles,
|
|
22
22
|
processSentiments,
|
|
23
23
|
validateData,
|
|
24
|
-
} from './
|
|
24
|
+
} from './dataUtils';
|
|
25
|
+
import type { UseCrowdViewDataProps, UseCrowdViewDataReturn } from './types';
|
|
25
26
|
|
|
26
27
|
export const useCrowdViewData = ({
|
|
27
28
|
instrument,
|
|
@@ -83,7 +84,7 @@ export const useCrowdViewData = ({
|
|
|
83
84
|
granularity,
|
|
84
85
|
maxBookPrice: maxPrice,
|
|
85
86
|
minBookPrice: minPrice,
|
|
86
|
-
bucketMultiplier:
|
|
87
|
+
bucketMultiplier: getMultiplayerForTimeSpan(granularity),
|
|
87
88
|
bucketMargin: BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
|
|
88
89
|
},
|
|
89
90
|
fetchPolicy: 'no-cache',
|
|
@@ -161,7 +162,7 @@ export const useCrowdViewData = ({
|
|
|
161
162
|
]);
|
|
162
163
|
|
|
163
164
|
const data = useMemo(() => {
|
|
164
|
-
if (!priceCandlesData ||
|
|
165
|
+
if (!priceCandlesData || error) {
|
|
165
166
|
return null;
|
|
166
167
|
}
|
|
167
168
|
|
|
@@ -178,7 +179,10 @@ export const useCrowdViewData = ({
|
|
|
178
179
|
sentimentLongs,
|
|
179
180
|
},
|
|
180
181
|
additionalData: {
|
|
181
|
-
bucketWidth
|
|
182
|
+
bucketWidth:
|
|
183
|
+
bucketWidth ||
|
|
184
|
+
INSTRUMENTS_CONFIG[instrument].defaultBucketWidth *
|
|
185
|
+
getMultiplayerForTimeSpan(granularity),
|
|
182
186
|
buckets,
|
|
183
187
|
displayPrecision: pipsLocation,
|
|
184
188
|
bookType,
|
|
@@ -188,8 +192,6 @@ export const useCrowdViewData = ({
|
|
|
188
192
|
};
|
|
189
193
|
}, [
|
|
190
194
|
priceCandlesData,
|
|
191
|
-
orderPositionData,
|
|
192
|
-
sentimentsData,
|
|
193
195
|
error,
|
|
194
196
|
dates,
|
|
195
197
|
candlesOpen,
|
|
@@ -201,6 +203,8 @@ export const useCrowdViewData = ({
|
|
|
201
203
|
sentimentShorts,
|
|
202
204
|
sentimentLongs,
|
|
203
205
|
bucketWidth,
|
|
206
|
+
granularity,
|
|
207
|
+
instrument,
|
|
204
208
|
buckets,
|
|
205
209
|
pipsLocation,
|
|
206
210
|
bookType,
|
|
@@ -211,6 +215,9 @@ export const useCrowdViewData = ({
|
|
|
211
215
|
return {
|
|
212
216
|
mainData: data?.mainData,
|
|
213
217
|
additionalData: data?.additionalData,
|
|
218
|
+
priceCandlesLoading,
|
|
219
|
+
orderPositionLoading,
|
|
220
|
+
sentimentsLoading,
|
|
214
221
|
loading,
|
|
215
222
|
error: !!error,
|
|
216
223
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLayoutProvider } from '@oanda/labs-widget-common';
|
|
1
2
|
import { useLocale } from '@oanda/mono-i18n';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
@@ -5,34 +6,35 @@ import { BookType } from '../../../gql/types/graphql';
|
|
|
5
6
|
import { LegendBar } from './LegendBar';
|
|
6
7
|
|
|
7
8
|
interface LegendProps {
|
|
8
|
-
longValues: (number | undefined)[];
|
|
9
|
-
shortValues: (number | undefined)[];
|
|
10
9
|
bookType: BookType;
|
|
11
|
-
isDark: boolean;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
export const Legend = ({
|
|
15
|
-
|
|
16
|
-
shortValues,
|
|
17
|
-
bookType,
|
|
18
|
-
isDark,
|
|
19
|
-
}: LegendProps) => {
|
|
12
|
+
export const Legend = ({ bookType }: LegendProps) => {
|
|
13
|
+
const { isDark } = useLayoutProvider();
|
|
20
14
|
const { lang } = useLocale();
|
|
21
15
|
|
|
22
16
|
return (
|
|
23
|
-
<div className="lw-
|
|
24
|
-
<
|
|
25
|
-
isDark={isDark}
|
|
26
|
-
|
|
27
|
-
type="
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
<div className="lw-my-4 lw-w-full">
|
|
18
|
+
<div className="lw-mb-1 lw-flex lw-w-full lw-flex-row lw-justify-between">
|
|
19
|
+
<LegendBar isDark={isDark} type="long" />
|
|
20
|
+
<div className="lw-w-[200px]" />
|
|
21
|
+
<LegendBar isDark={isDark} type="short" />
|
|
22
|
+
</div>
|
|
23
|
+
<div className="lw-flex lw-w-full lw-flex-row lw-justify-between lw-pb-2 lw-font-sans lw-text-xs lw-text-text-primary">
|
|
24
|
+
<span>
|
|
25
|
+
{lang(
|
|
26
|
+
bookType === BookType.Order ? 'buy_overbalance' : 'long_overbalance'
|
|
27
|
+
)}
|
|
28
|
+
</span>
|
|
29
|
+
<span>{lang('even_market_demand')}</span>
|
|
30
|
+
<span>
|
|
31
|
+
{lang(
|
|
32
|
+
bookType === BookType.Order
|
|
33
|
+
? 'sell_overbalance'
|
|
34
|
+
: 'short_overbalance'
|
|
35
|
+
)}
|
|
36
|
+
</span>
|
|
37
|
+
</div>
|
|
36
38
|
</div>
|
|
37
39
|
);
|
|
38
40
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cn } from '@oanda/labs-widget-common';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import { COLOR_MAP } from '../../constants';
|
|
@@ -5,39 +6,41 @@ import { COLOR_MAP } from '../../constants';
|
|
|
5
6
|
export type LegendType = 'long' | 'short';
|
|
6
7
|
|
|
7
8
|
interface LegendBarProps {
|
|
8
|
-
values: (number | undefined)[];
|
|
9
9
|
type: LegendType;
|
|
10
|
-
label: string;
|
|
11
10
|
isDark: boolean;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
export const LegendBar = ({
|
|
13
|
+
export const LegendBar = ({ type, isDark }: LegendBarProps) => {
|
|
15
14
|
const colorPalette = isDark ? COLOR_MAP.dark : COLOR_MAP.light;
|
|
16
|
-
const
|
|
15
|
+
const startColor =
|
|
16
|
+
type === 'long' ? colorPalette.long[1] : colorPalette.short[0];
|
|
17
|
+
const endColor =
|
|
18
|
+
type === 'long' ? colorPalette.long[0] : colorPalette.short[1];
|
|
19
|
+
const endGradient =
|
|
20
|
+
type === 'long'
|
|
21
|
+
? `linear-gradient(90deg,${endColor} 0%, transparent 100%)`
|
|
22
|
+
: `linear-gradient(270deg,${startColor} 0%, transparent 100%)`;
|
|
17
23
|
|
|
18
24
|
return (
|
|
19
|
-
<div
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{values[1] ? `≤ ${values[1].toFixed(2)}%` : '—'}
|
|
39
|
-
</span>
|
|
40
|
-
</div>
|
|
25
|
+
<div
|
|
26
|
+
className={cn('lw-flex lw-h-2 lw-w-full lw-overflow-hidden', {
|
|
27
|
+
'lw-flex-row-reverse': type === 'short',
|
|
28
|
+
})}
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
className="lw-h-full lw-flex-1"
|
|
32
|
+
data-testid="legend-bar-segment"
|
|
33
|
+
style={{
|
|
34
|
+
background: `linear-gradient(90deg,${startColor} 0%, ${endColor} 100%)`,
|
|
35
|
+
}}
|
|
36
|
+
/>
|
|
37
|
+
<div
|
|
38
|
+
className="lw-h-full lw-w-[10px]"
|
|
39
|
+
data-testid="legend-bar-segment"
|
|
40
|
+
style={{
|
|
41
|
+
background: endGradient,
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
41
44
|
</div>
|
|
42
45
|
);
|
|
43
46
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { colorPalette } from '@oanda/labs-widget-common';
|
|
2
|
+
import chroma from 'chroma-js';
|
|
2
3
|
|
|
3
4
|
import { InstrumentId } from './types';
|
|
4
5
|
|
|
5
6
|
export const BUCKET_CONFIG = {
|
|
6
|
-
|
|
7
|
+
MULTIPLIER_5M: 1,
|
|
8
|
+
MULTIPLIER_15M: 1,
|
|
9
|
+
MULTIPLIER_1H: 2,
|
|
10
|
+
MULTIPLIER_4H: 4,
|
|
7
11
|
PRICE_MARGIN_MULTIPLIER: 2,
|
|
8
12
|
} as const;
|
|
9
13
|
|
|
@@ -12,40 +16,47 @@ export const TIME_THRESHOLDS = {
|
|
|
12
16
|
} as const;
|
|
13
17
|
|
|
14
18
|
export const CHART_CONFIG = {
|
|
19
|
+
HEIGHT: 440,
|
|
15
20
|
MAIN_HEIGHT: 400,
|
|
16
21
|
MARGIN_BETWEEN: 50,
|
|
17
22
|
SENTIMENT_HEIGHT: 120,
|
|
18
23
|
WIDTH: 9999,
|
|
19
24
|
X_LABEL_SIZE: 40,
|
|
20
|
-
Y_LABEL_SIZE_DESKTOP:
|
|
25
|
+
Y_LABEL_SIZE_DESKTOP: 50,
|
|
21
26
|
Y_LABEL_SIZE_MOBILE: 40,
|
|
22
|
-
|
|
27
|
+
Y_SENTIMENT_LABEL_DESKTOP_SIZE: 40,
|
|
28
|
+
Y_SENTIMENT_LABEL_MOBILE_SIZE: 30,
|
|
29
|
+
INITIAL_START_ZOOM_DESKTOP: 70,
|
|
30
|
+
INITIAL_START_ZOOM_MOBILE: 85,
|
|
23
31
|
INITIAL_END_ZOOM: 100,
|
|
24
32
|
X_AXIS_DATE_PADDING: ' ',
|
|
25
33
|
SENTIMENT_MIN: 0,
|
|
26
34
|
SENTIMENT_MAX: 100,
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
TOP_MARGIN_DESKTOP: 0,
|
|
36
|
+
TOP_MARGIN_MOBILE: 30,
|
|
37
|
+
TOOLTIP_OFFSET: 5,
|
|
29
38
|
} as const;
|
|
30
39
|
|
|
31
|
-
export const CHART_CONFIG_CALCULATED = {
|
|
32
|
-
FULL_HEIGHT:
|
|
33
|
-
CHART_CONFIG.MAIN_HEIGHT +
|
|
34
|
-
CHART_CONFIG.MARGIN_BETWEEN +
|
|
35
|
-
CHART_CONFIG.SENTIMENT_HEIGHT +
|
|
36
|
-
CHART_CONFIG.X_LABEL_SIZE,
|
|
37
|
-
SENTIMENT_TEXT_POSITION:
|
|
38
|
-
CHART_CONFIG.SENTIMENT_HEIGHT + CHART_CONFIG.SENTIMENT_TEXT_OFFSET,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
40
|
export const COLOR_MAP = {
|
|
42
41
|
dark: {
|
|
43
|
-
long: [
|
|
44
|
-
|
|
42
|
+
long: [
|
|
43
|
+
chroma(colorPalette.darkBlue10).shade(0.5).hex(),
|
|
44
|
+
chroma(colorPalette.darkBlue90).shade(0.5).hex(),
|
|
45
|
+
],
|
|
46
|
+
short: [
|
|
47
|
+
chroma(colorPalette.darkYellow10).shade(0.5).hex(),
|
|
48
|
+
chroma(colorPalette.darkYellow90).shade(0.5).hex(),
|
|
49
|
+
],
|
|
45
50
|
},
|
|
46
51
|
light: {
|
|
47
|
-
long: [
|
|
48
|
-
|
|
52
|
+
long: [
|
|
53
|
+
chroma(colorPalette.lightBlue10).tint(0.5).hex(),
|
|
54
|
+
chroma(colorPalette.lightBlue90).tint(0.5).hex(),
|
|
55
|
+
],
|
|
56
|
+
short: [
|
|
57
|
+
chroma(colorPalette.lightYellow10).tint(0.5).hex(),
|
|
58
|
+
chroma(colorPalette.lightYellow90).tint(0.5).hex(),
|
|
59
|
+
],
|
|
49
60
|
},
|
|
50
61
|
} as const;
|
|
51
62
|
|