@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,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatXAxisLabel = void 0;
|
|
7
|
+
var _constants = require("../../../constants");
|
|
8
|
+
const formatXAxisLabel = (value, isGreaterThanTwoWeeks) => {
|
|
9
|
+
const date = new Date(value);
|
|
10
|
+
return isGreaterThanTwoWeeks ? "".concat(date.toLocaleTimeString(undefined, {
|
|
11
|
+
hour: '2-digit',
|
|
12
|
+
minute: '2-digit'
|
|
13
|
+
})) : "".concat(_constants.CHART_CONFIG.X_AXIS_DATE_PADDING).concat(date.toLocaleDateString(undefined, {
|
|
14
|
+
day: 'numeric'
|
|
15
|
+
})).concat(_constants.CHART_CONFIG.X_AXIS_DATE_PADDING);
|
|
16
|
+
};
|
|
17
|
+
exports.formatXAxisLabel = formatXAxisLabel;
|
|
18
|
+
//# sourceMappingURL=formatXAxisLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatXAxisLabel.js","names":["_constants","require","formatXAxisLabel","value","isGreaterThanTwoWeeks","date","Date","concat","toLocaleTimeString","undefined","hour","minute","CHART_CONFIG","X_AXIS_DATE_PADDING","toLocaleDateString","day","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.ts"],"sourcesContent":["import { CHART_CONFIG } from '../../../constants';\n\nexport const formatXAxisLabel = (\n value: unknown,\n isGreaterThanTwoWeeks: boolean\n) => {\n const date = new Date(value as string);\n return isGreaterThanTwoWeeks\n ? `${date.toLocaleTimeString(undefined, {\n hour: '2-digit',\n minute: '2-digit',\n })}`\n : `${CHART_CONFIG.X_AXIS_DATE_PADDING}${date.toLocaleDateString(undefined, {\n day: 'numeric',\n })}${CHART_CONFIG.X_AXIS_DATE_PADDING}`;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,MAAMC,gBAAgB,GAAGA,CAC9BC,KAAc,EACdC,qBAA8B,KAC3B;EACH,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAACH,KAAe,CAAC;EACtC,OAAOC,qBAAqB,MAAAG,MAAA,CACrBF,IAAI,CAACG,kBAAkB,CAACC,SAAS,EAAE;IACpCC,IAAI,EAAE,SAAS;IACfC,MAAM,EAAE;EACV,CAAC,CAAC,OAAAJ,MAAA,CACCK,uBAAY,CAACC,mBAAmB,EAAAN,MAAA,CAAGF,IAAI,CAACS,kBAAkB,CAACL,SAAS,EAAE;IACvEM,GAAG,EAAE;EACP,CAAC,CAAC,EAAAR,MAAA,CAAGK,uBAAY,CAACC,mBAAmB,CAAE;AAC7C,CAAC;AAACG,OAAA,CAAAd,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -8,19 +8,19 @@ var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
|
8
8
|
const getChartStyles = isDark => {
|
|
9
9
|
const sentimentLongColor = isDark ? _labsWidgetCommon.colorPalette.darkBlue90 : _labsWidgetCommon.colorPalette.lightBlue90;
|
|
10
10
|
const sentimentShortColor = isDark ? _labsWidgetCommon.colorPalette.darkYellow90 : _labsWidgetCommon.colorPalette.lightYellow90;
|
|
11
|
+
const sentimentOutlineColor = isDark ? _labsWidgetCommon.colorPalette.black : _labsWidgetCommon.colorPalette.white;
|
|
12
|
+
const sentimentOutlineWidth = isDark ? 3 : 2;
|
|
11
13
|
const candleLongColor = isDark ? _labsWidgetCommon.colorPalette.bottleGreenDark : _labsWidgetCommon.colorPalette.bottleGreenLight;
|
|
12
14
|
const candleShortColor = isDark ? _labsWidgetCommon.colorPalette.orange : _labsWidgetCommon.colorPalette.raspberryLight;
|
|
13
|
-
const sentimentAreaOpacity = isDark ? 0.5 : 0.2;
|
|
14
15
|
const tooltipLinesColor = isDark ? _labsWidgetCommon.colorPalette.orange : _labsWidgetCommon.colorPalette.bottleGreenLight;
|
|
15
|
-
const sentimentLabelColor = isDark ? _labsWidgetCommon.colorPalette.white : _labsWidgetCommon.colorPalette.black;
|
|
16
16
|
return {
|
|
17
17
|
sentimentLongColor,
|
|
18
18
|
sentimentShortColor,
|
|
19
|
+
sentimentOutlineColor,
|
|
19
20
|
candleLongColor,
|
|
20
21
|
candleShortColor,
|
|
21
|
-
sentimentAreaOpacity,
|
|
22
22
|
tooltipLinesColor,
|
|
23
|
-
|
|
23
|
+
sentimentOutlineWidth
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
exports.getChartStyles = getChartStyles;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getChartStyles.js","names":["_labsWidgetCommon","require","getChartStyles","isDark","sentimentLongColor","colorPalette","darkBlue90","lightBlue90","sentimentShortColor","darkYellow90","lightYellow90","sentimentOutlineColor","black","white","sentimentOutlineWidth","candleLongColor","bottleGreenDark","bottleGreenLight","candleShortColor","orange","raspberryLight","tooltipLinesColor","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nexport interface ChartStyles {\n sentimentLongColor: string;\n sentimentShortColor: string;\n sentimentOutlineColor: string;\n candleLongColor: string;\n candleShortColor: string;\n tooltipLinesColor: string;\n sentimentOutlineWidth: number;\n}\n\nexport const getChartStyles = (isDark: boolean): ChartStyles => {\n const sentimentLongColor = isDark\n ? colorPalette.darkBlue90\n : colorPalette.lightBlue90;\n const sentimentShortColor = isDark\n ? colorPalette.darkYellow90\n : colorPalette.lightYellow90;\n\n const sentimentOutlineColor = isDark\n ? colorPalette.black\n : colorPalette.white;\n const sentimentOutlineWidth = isDark ? 3 : 2;\n\n const candleLongColor = isDark\n ? colorPalette.bottleGreenDark\n : colorPalette.bottleGreenLight;\n const candleShortColor = isDark\n ? colorPalette.orange\n : colorPalette.raspberryLight;\n const tooltipLinesColor = isDark\n ? colorPalette.orange\n : colorPalette.bottleGreenLight;\n\n return {\n sentimentLongColor,\n sentimentShortColor,\n sentimentOutlineColor,\n candleLongColor,\n candleShortColor,\n tooltipLinesColor,\n sentimentOutlineWidth,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAYO,MAAMC,cAAc,GAAIC,MAAe,IAAkB;EAC9D,MAAMC,kBAAkB,GAAGD,MAAM,GAC7BE,8BAAY,CAACC,UAAU,GACvBD,8BAAY,CAACE,WAAW;EAC5B,MAAMC,mBAAmB,GAAGL,MAAM,GAC9BE,8BAAY,CAACI,YAAY,GACzBJ,8BAAY,CAACK,aAAa;EAE9B,MAAMC,qBAAqB,GAAGR,MAAM,GAChCE,8BAAY,CAACO,KAAK,GAClBP,8BAAY,CAACQ,KAAK;EACtB,MAAMC,qBAAqB,GAAGX,MAAM,GAAG,CAAC,GAAG,CAAC;EAE5C,MAAMY,eAAe,GAAGZ,MAAM,GAC1BE,8BAAY,CAACW,eAAe,GAC5BX,8BAAY,CAACY,gBAAgB;EACjC,MAAMC,gBAAgB,GAAGf,MAAM,GAC3BE,8BAAY,CAACc,MAAM,GACnBd,8BAAY,CAACe,cAAc;EAC/B,MAAMC,iBAAiB,GAAGlB,MAAM,GAC5BE,8BAAY,CAACc,MAAM,GACnBd,8BAAY,CAACY,gBAAgB;EAEjC,OAAO;IACLb,kBAAkB;IAClBI,mBAAmB;IACnBG,qBAAqB;IACrBI,eAAe;IACfG,gBAAgB;IAChBG,iBAAiB;IACjBP;EACF,CAAC;AACH,CAAC;AAACQ,OAAA,CAAApB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getGradientColor = void 0;
|
|
7
|
+
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const getGradientColor = (value, startColor, targetColor, minThreshold, maxThreshold) => {
|
|
10
|
+
const colorScale = _chromaJs.default.scale([startColor, targetColor]).domain([minThreshold, maxThreshold]).mode('rgb');
|
|
11
|
+
return colorScale(value).hex();
|
|
12
|
+
};
|
|
13
|
+
exports.getGradientColor = getGradientColor;
|
|
14
|
+
//# sourceMappingURL=getGradientColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGradientColor.js","names":["_chromaJs","_interopRequireDefault","require","e","__esModule","default","getGradientColor","value","startColor","targetColor","minThreshold","maxThreshold","colorScale","chroma","scale","domain","mode","hex","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.ts"],"sourcesContent":["import chroma from 'chroma-js';\n\nexport const getGradientColor = (\n value: number,\n startColor: string,\n targetColor: string,\n minThreshold: number,\n maxThreshold: number\n): string => {\n const colorScale = chroma\n .scale([startColor, targetColor])\n .domain([minThreshold, maxThreshold])\n .mode('rgb');\n\n return colorScale(value).hex();\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;AAExB,MAAMG,gBAAgB,GAAGA,CAC9BC,KAAa,EACbC,UAAkB,EAClBC,WAAmB,EACnBC,YAAoB,EACpBC,YAAoB,KACT;EACX,MAAMC,UAAU,GAAGC,iBAAM,CACtBC,KAAK,CAAC,CAACN,UAAU,EAAEC,WAAW,CAAC,CAAC,CAChCM,MAAM,CAAC,CAACL,YAAY,EAAEC,YAAY,CAAC,CAAC,CACpCK,IAAI,CAAC,KAAK,CAAC;EAEd,OAAOJ,UAAU,CAACL,KAAK,CAAC,CAACU,GAAG,CAAC,CAAC;AAChC,CAAC;AAACC,OAAA,CAAAZ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getLabelData = void 0;
|
|
7
|
+
const getLabelData = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
dates,
|
|
10
|
+
isGreaterThanTwoWeeks
|
|
11
|
+
} = _ref;
|
|
12
|
+
return dates.filter((record, index, arr) => {
|
|
13
|
+
if (index === 0) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const previousTimestamp = arr[index - 1];
|
|
17
|
+
const currentDate = new Date(record);
|
|
18
|
+
const previousDate = new Date(previousTimestamp);
|
|
19
|
+
return isGreaterThanTwoWeeks ? currentDate.getDate() !== previousDate.getDate() : currentDate.getMonth() !== previousDate.getMonth();
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
exports.getLabelData = getLabelData;
|
|
23
|
+
//# sourceMappingURL=getLabelData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLabelData.js","names":["getLabelData","_ref","dates","isGreaterThanTwoWeeks","filter","record","index","arr","previousTimestamp","currentDate","Date","previousDate","getDate","getMonth","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts"],"sourcesContent":["import type { GetLabelsDataProps } from '../types';\n\nexport const getLabelData = ({\n dates,\n isGreaterThanTwoWeeks,\n}: GetLabelsDataProps) =>\n dates.filter((record, index, arr) => {\n if (index === 0) {\n return false;\n }\n const previousTimestamp = arr[index - 1];\n const currentDate = new Date(record);\n const previousDate = new Date(previousTimestamp);\n\n return isGreaterThanTwoWeeks\n ? currentDate.getDate() !== previousDate.getDate()\n : currentDate.getMonth() !== previousDate.getMonth();\n });\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAGC,IAAA;EAAA,IAAC;IAC3BC,KAAK;IACLC;EACkB,CAAC,GAAAF,IAAA;EAAA,OACnBC,KAAK,CAACE,MAAM,CAAC,CAACC,MAAM,EAAEC,KAAK,EAAEC,GAAG,KAAK;IACnC,IAAID,KAAK,KAAK,CAAC,EAAE;MACf,OAAO,KAAK;IACd;IACA,MAAME,iBAAiB,GAAGD,GAAG,CAACD,KAAK,GAAG,CAAC,CAAC;IACxC,MAAMG,WAAW,GAAG,IAAIC,IAAI,CAACL,MAAM,CAAC;IACpC,MAAMM,YAAY,GAAG,IAAID,IAAI,CAACF,iBAAiB,CAAC;IAEhD,OAAOL,qBAAqB,GACxBM,WAAW,CAACG,OAAO,CAAC,CAAC,KAAKD,YAAY,CAACC,OAAO,CAAC,CAAC,GAChDH,WAAW,CAACI,QAAQ,CAAC,CAAC,KAAKF,YAAY,CAACE,QAAQ,CAAC,CAAC;EACxD,CAAC,CAAC;AAAA;AAACC,OAAA,CAAAd,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRectColor = void 0;
|
|
7
|
+
var _constants = require("../../../constants");
|
|
8
|
+
var _getGradientColor = require("./getGradientColor");
|
|
9
|
+
const getRectColor = (sentiment, isDark, minThreshold, maxThreshold) => {
|
|
10
|
+
const colorPalette = isDark ? _constants.COLOR_MAP.dark : _constants.COLOR_MAP.light;
|
|
11
|
+
return sentiment < 0 ? (0, _getGradientColor.getGradientColor)(sentiment * -1, colorPalette.short[0], colorPalette.short[1], minThreshold, maxThreshold) : (0, _getGradientColor.getGradientColor)(sentiment, colorPalette.long[0], colorPalette.long[1], minThreshold, maxThreshold);
|
|
12
|
+
};
|
|
13
|
+
exports.getRectColor = getRectColor;
|
|
14
|
+
//# sourceMappingURL=getRectColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRectColor.js","names":["_constants","require","_getGradientColor","getRectColor","sentiment","isDark","minThreshold","maxThreshold","colorPalette","COLOR_MAP","dark","light","getGradientColor","short","long","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts"],"sourcesContent":["import { COLOR_MAP } from '../../../constants';\nimport { getGradientColor } from './getGradientColor';\n\nexport const getRectColor = (\n sentiment: number,\n isDark: boolean,\n minThreshold: number,\n maxThreshold: number\n) => {\n const colorPalette = isDark ? COLOR_MAP.dark : COLOR_MAP.light;\n\n return sentiment < 0\n ? getGradientColor(\n sentiment * -1,\n colorPalette.short[0],\n colorPalette.short[1],\n minThreshold,\n maxThreshold\n )\n : getGradientColor(\n sentiment,\n colorPalette.long[0],\n colorPalette.long[1],\n minThreshold,\n maxThreshold\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEO,MAAME,YAAY,GAAGA,CAC1BC,SAAiB,EACjBC,MAAe,EACfC,YAAoB,EACpBC,YAAoB,KACjB;EACH,MAAMC,YAAY,GAAGH,MAAM,GAAGI,oBAAS,CAACC,IAAI,GAAGD,oBAAS,CAACE,KAAK;EAE9D,OAAOP,SAAS,GAAG,CAAC,GAChB,IAAAQ,kCAAgB,EACdR,SAAS,GAAG,CAAC,CAAC,EACdI,YAAY,CAACK,KAAK,CAAC,CAAC,CAAC,EACrBL,YAAY,CAACK,KAAK,CAAC,CAAC,CAAC,EACrBP,YAAY,EACZC,YACF,CAAC,GACD,IAAAK,kCAAgB,EACdR,SAAS,EACTI,YAAY,CAACM,IAAI,CAAC,CAAC,CAAC,EACpBN,YAAY,CAACM,IAAI,CAAC,CAAC,CAAC,EACpBR,YAAY,EACZC,YACF,CAAC;AACP,CAAC;AAACQ,OAAA,CAAAZ,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTooltipFormatter = void 0;
|
|
7
|
+
var _graphql = require("../../../../gql/types/graphql");
|
|
8
|
+
const DATE_FORMAT_OPTIONS = {
|
|
9
|
+
hour: '2-digit',
|
|
10
|
+
minute: '2-digit',
|
|
11
|
+
year: 'numeric',
|
|
12
|
+
day: 'numeric',
|
|
13
|
+
month: 'numeric',
|
|
14
|
+
timeZoneName: 'short'
|
|
15
|
+
};
|
|
16
|
+
const SENTIMENT_DISPLAY_PRECISION = 2;
|
|
17
|
+
const calculateBucketDisplayPrecision = bucketWidth => {
|
|
18
|
+
var _bucketWidth$toString;
|
|
19
|
+
return ((_bucketWidth$toString = bucketWidth.toString().split('.')[1]) === null || _bucketWidth$toString === void 0 ? void 0 : _bucketWidth$toString.length) || 0;
|
|
20
|
+
};
|
|
21
|
+
const findSeriesParam = (params, seriesId) => {
|
|
22
|
+
return params.find(series => series.seriesId === seriesId);
|
|
23
|
+
};
|
|
24
|
+
const findSentimentSeriesParam = (params, sentimentLongs, sentimentShorts) => {
|
|
25
|
+
var _sentimentLongs$index, _sentimentShorts$inde;
|
|
26
|
+
const index = params[0].dataIndex;
|
|
27
|
+
return {
|
|
28
|
+
sentimentLong: (_sentimentLongs$index = sentimentLongs[index]) !== null && _sentimentLongs$index !== void 0 ? _sentimentLongs$index : null,
|
|
29
|
+
sentimentShort: (_sentimentShorts$inde = sentimentShorts[index]) !== null && _sentimentShorts$inde !== void 0 ? _sentimentShorts$inde : null
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const getSentimentOverbalanceLabel = (sentiment, bookType) => {
|
|
33
|
+
if (sentiment < 0) {
|
|
34
|
+
return bookType === _graphql.BookType.Order ? 'sell_overbalance' : 'short_overbalance';
|
|
35
|
+
}
|
|
36
|
+
return bookType === _graphql.BookType.Order ? 'buy_overbalance' : 'long_overbalance';
|
|
37
|
+
};
|
|
38
|
+
const formatCandleData = (candleData, labelCallback) => {
|
|
39
|
+
const [, open, close, low, high] = candleData;
|
|
40
|
+
return "<p><b>".concat(labelCallback('candle'), ":</b></p>\n<p>").concat(labelCallback('open_price'), ": ").concat(open, " </p>\n<p>").concat(labelCallback('close_price'), ": ").concat(close, " </p>\n<p>").concat(labelCallback('low'), ": ").concat(low, " </p>\n<p>").concat(labelCallback('high'), ": ").concat(high, " </p>\n");
|
|
41
|
+
};
|
|
42
|
+
const formatBookData = _ref => {
|
|
43
|
+
let {
|
|
44
|
+
matchedBucket,
|
|
45
|
+
bucketWidth,
|
|
46
|
+
bucketDisplayPrecision,
|
|
47
|
+
bookType,
|
|
48
|
+
labelCallback
|
|
49
|
+
} = _ref;
|
|
50
|
+
const bookLabelKey = bookType === _graphql.BookType.Order ? 'orders' : 'positions';
|
|
51
|
+
const priceRangeStart = matchedBucket.price.toFixed(bucketDisplayPrecision);
|
|
52
|
+
const priceRangeEnd = (matchedBucket.price + bucketWidth).toFixed(bucketDisplayPrecision);
|
|
53
|
+
const sentimentLabel = getSentimentOverbalanceLabel(matchedBucket.sentiment, bookType);
|
|
54
|
+
const sentimentValue = Math.abs(matchedBucket.sentiment).toFixed(bucketDisplayPrecision);
|
|
55
|
+
return "<br /><p><b>".concat(labelCallback(bookLabelKey), ":</b></p>\n<p>").concat(labelCallback('price_range'), ": ").concat(priceRangeStart, " - ").concat(priceRangeEnd, " </p>\n<p>").concat(labelCallback(sentimentLabel), ": ").concat(sentimentValue, "% </p>");
|
|
56
|
+
};
|
|
57
|
+
const formatSentimentData = (sentimentLong, sentimentShort, labelCallback) => {
|
|
58
|
+
return "<br /><p><b>".concat(labelCallback('sentiment'), ":</b></p>\n<p>").concat(labelCallback('long'), ": ").concat(sentimentLong.toFixed(SENTIMENT_DISPLAY_PRECISION), "% </p>\n<p>").concat(labelCallback('short'), ": ").concat(sentimentShort.toFixed(SENTIMENT_DISPLAY_PRECISION), "% </p>");
|
|
59
|
+
};
|
|
60
|
+
const hasValidCandleData = candleData => !!candleData[1] && !!candleData[2] && !!candleData[3] && !!candleData[4];
|
|
61
|
+
const hasValidSentimentData = (sentimentLong, sentimentShort) => sentimentLong !== null && sentimentShort !== null;
|
|
62
|
+
const findMatchingBucket = (buckets, bucketsIndex, selectedPrice, bucketWidth) => {
|
|
63
|
+
if (bucketsIndex === undefined) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const selectedBuckets = buckets[bucketsIndex];
|
|
67
|
+
return selectedBuckets === null || selectedBuckets === void 0 ? void 0 : selectedBuckets.find(_ref2 => {
|
|
68
|
+
let {
|
|
69
|
+
price
|
|
70
|
+
} = _ref2;
|
|
71
|
+
return selectedPrice >= price && selectedPrice < price + bucketWidth;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const getTooltipFormatter = _ref3 => {
|
|
75
|
+
let {
|
|
76
|
+
params,
|
|
77
|
+
buckets,
|
|
78
|
+
bucketWidth,
|
|
79
|
+
selectedPrice,
|
|
80
|
+
bookType,
|
|
81
|
+
labelCallback,
|
|
82
|
+
sentimentLongs,
|
|
83
|
+
sentimentShorts
|
|
84
|
+
} = _ref3;
|
|
85
|
+
if (!params || !Array.isArray(params) || params.length === 0) {
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
const candleParam = findSeriesParam(params, 'candlestick');
|
|
89
|
+
const booksParam = findSeriesParam(params, 'heatmap');
|
|
90
|
+
const {
|
|
91
|
+
sentimentLong,
|
|
92
|
+
sentimentShort
|
|
93
|
+
} = findSentimentSeriesParam(params, sentimentLongs, sentimentShorts);
|
|
94
|
+
if (!candleParam) {
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
const bucketDisplayPrecision = calculateBucketDisplayPrecision(bucketWidth);
|
|
98
|
+
const time = new Date(candleParam.axisValue);
|
|
99
|
+
const candleData = candleParam.value;
|
|
100
|
+
const bucketsIndex = booksParam === null || booksParam === void 0 ? void 0 : booksParam.value[2];
|
|
101
|
+
const matchedBucket = findMatchingBucket(buckets, bucketsIndex, selectedPrice, bucketWidth);
|
|
102
|
+
const showCandles = hasValidCandleData(candleData);
|
|
103
|
+
const showSentiment = hasValidSentimentData(sentimentLong, sentimentShort);
|
|
104
|
+
if (!showCandles && !matchedBucket) {
|
|
105
|
+
return '';
|
|
106
|
+
}
|
|
107
|
+
const timeFormatted = time.toLocaleString(undefined, DATE_FORMAT_OPTIONS);
|
|
108
|
+
const candleSection = showCandles ? formatCandleData(candleData, labelCallback) : '';
|
|
109
|
+
const bookSection = matchedBucket ? formatBookData({
|
|
110
|
+
matchedBucket,
|
|
111
|
+
bucketWidth,
|
|
112
|
+
bucketDisplayPrecision,
|
|
113
|
+
bookType,
|
|
114
|
+
labelCallback
|
|
115
|
+
}) : '';
|
|
116
|
+
const sentimentSection = showSentiment && sentimentLong && sentimentShort ? formatSentimentData(sentimentLong, sentimentShort, labelCallback) : '';
|
|
117
|
+
return "<p>".concat(timeFormatted, "</p><br />\n").concat(candleSection, "\n").concat(bookSection, "\n").concat(sentimentSection);
|
|
118
|
+
};
|
|
119
|
+
exports.getTooltipFormatter = getTooltipFormatter;
|
|
120
|
+
//# sourceMappingURL=getTooltipFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTooltipFormatter.js","names":["_graphql","require","DATE_FORMAT_OPTIONS","hour","minute","year","day","month","timeZoneName","SENTIMENT_DISPLAY_PRECISION","calculateBucketDisplayPrecision","bucketWidth","_bucketWidth$toString","toString","split","length","findSeriesParam","params","seriesId","find","series","findSentimentSeriesParam","sentimentLongs","sentimentShorts","_sentimentLongs$index","_sentimentShorts$inde","index","dataIndex","sentimentLong","sentimentShort","getSentimentOverbalanceLabel","sentiment","bookType","BookType","Order","formatCandleData","candleData","labelCallback","open","close","low","high","concat","formatBookData","_ref","matchedBucket","bucketDisplayPrecision","bookLabelKey","priceRangeStart","price","toFixed","priceRangeEnd","sentimentLabel","sentimentValue","Math","abs","formatSentimentData","hasValidCandleData","hasValidSentimentData","findMatchingBucket","buckets","bucketsIndex","selectedPrice","undefined","selectedBuckets","_ref2","getTooltipFormatter","_ref3","Array","isArray","candleParam","booksParam","time","Date","axisValue","value","showCandles","showSentiment","timeFormatted","toLocaleString","candleSection","bookSection","sentimentSection","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts"],"sourcesContent":["import { BookType } from '../../../../gql/types/graphql';\nimport type { Bucket, TooltipParam } from '../types';\n\nconst DATE_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {\n hour: '2-digit',\n minute: '2-digit',\n year: 'numeric',\n day: 'numeric',\n month: 'numeric',\n timeZoneName: 'short',\n};\n\nconst SENTIMENT_DISPLAY_PRECISION = 2;\n\nconst calculateBucketDisplayPrecision = (bucketWidth: number): number => {\n return bucketWidth.toString().split('.')[1]?.length || 0;\n};\n\nconst findSeriesParam = <T extends TooltipParam['seriesId']>(\n params: TooltipParam[],\n seriesId: T\n): Extract<TooltipParam, { seriesId: T }> | undefined => {\n return params.find(\n (series): series is Extract<TooltipParam, { seriesId: T }> =>\n series.seriesId === seriesId\n );\n};\n\nconst findSentimentSeriesParam = (\n params: TooltipParam[],\n sentimentLongs: (number | null)[],\n sentimentShorts: (number | null)[]\n): {\n sentimentLong: number | null;\n sentimentShort: number | null;\n} => {\n const index = params[0].dataIndex as number;\n\n return {\n sentimentLong: sentimentLongs[index] ?? null,\n sentimentShort: sentimentShorts[index] ?? null,\n };\n};\n\nconst getSentimentOverbalanceLabel = (\n sentiment: number,\n bookType: BookType\n): string => {\n if (sentiment < 0) {\n return bookType === BookType.Order\n ? 'sell_overbalance'\n : 'short_overbalance';\n }\n return bookType === BookType.Order ? 'buy_overbalance' : 'long_overbalance';\n};\n\nconst formatCandleData = (\n candleData: [number, number, number, number, number],\n labelCallback: (key: string) => string\n): string => {\n const [, open, close, low, high] = candleData;\n return `<p><b>${labelCallback('candle')}:</b></p>\n<p>${labelCallback('open_price')}: ${open} </p>\n<p>${labelCallback('close_price')}: ${close} </p>\n<p>${labelCallback('low')}: ${low} </p>\n<p>${labelCallback('high')}: ${high} </p>\n`;\n};\n\nconst formatBookData = ({\n matchedBucket,\n bucketWidth,\n bucketDisplayPrecision,\n bookType,\n labelCallback,\n}: {\n matchedBucket: Bucket;\n bucketWidth: number;\n bucketDisplayPrecision: number;\n bookType: BookType;\n labelCallback: (key: string) => string;\n}): string => {\n const bookLabelKey = bookType === BookType.Order ? 'orders' : 'positions';\n const priceRangeStart = matchedBucket.price.toFixed(bucketDisplayPrecision);\n const priceRangeEnd = (matchedBucket.price + bucketWidth).toFixed(\n bucketDisplayPrecision\n );\n const sentimentLabel = getSentimentOverbalanceLabel(\n matchedBucket.sentiment,\n bookType\n );\n const sentimentValue = Math.abs(matchedBucket.sentiment).toFixed(\n bucketDisplayPrecision\n );\n\n return `<br /><p><b>${labelCallback(bookLabelKey)}:</b></p>\n<p>${labelCallback('price_range')}: ${priceRangeStart} - ${priceRangeEnd} </p>\n<p>${labelCallback(sentimentLabel)}: ${sentimentValue}% </p>`;\n};\n\nconst formatSentimentData = (\n sentimentLong: number,\n sentimentShort: number,\n labelCallback: (key: string) => string\n): string => {\n return `<br /><p><b>${labelCallback('sentiment')}:</b></p>\n<p>${labelCallback('long')}: ${sentimentLong.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </p>\n<p>${labelCallback('short')}: ${sentimentShort.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </p>`;\n};\n\nconst hasValidCandleData = (\n candleData: [number, number, number, number, number]\n): boolean =>\n !!candleData[1] && !!candleData[2] && !!candleData[3] && !!candleData[4];\n\nconst hasValidSentimentData = (\n sentimentLong: number | null,\n sentimentShort: number | null\n): boolean => sentimentLong !== null && sentimentShort !== null;\n\nconst findMatchingBucket = (\n buckets: Bucket[][],\n bucketsIndex: number | undefined,\n selectedPrice: number,\n bucketWidth: number\n): Bucket | undefined => {\n if (bucketsIndex === undefined) {\n return undefined;\n }\n const selectedBuckets = buckets[bucketsIndex];\n return selectedBuckets?.find(\n ({ price }) => selectedPrice >= price && selectedPrice < price + bucketWidth\n );\n};\n\nexport const getTooltipFormatter = ({\n params,\n buckets,\n bucketWidth,\n selectedPrice,\n bookType,\n labelCallback,\n sentimentLongs,\n sentimentShorts,\n}: {\n params: TooltipParam[];\n buckets: Bucket[][];\n bucketWidth: number;\n selectedPrice: number;\n bookType: BookType;\n labelCallback: (key: string) => string;\n sentimentLongs: (number | null)[];\n sentimentShorts: (number | null)[];\n}) => {\n if (!params || !Array.isArray(params) || params.length === 0) {\n return '';\n }\n\n const candleParam = findSeriesParam(params, 'candlestick');\n const booksParam = findSeriesParam(params, 'heatmap');\n const { sentimentLong, sentimentShort } = findSentimentSeriesParam(\n params,\n sentimentLongs,\n sentimentShorts\n );\n\n if (!candleParam) {\n return '';\n }\n\n const bucketDisplayPrecision = calculateBucketDisplayPrecision(bucketWidth);\n const time = new Date(candleParam.axisValue as string);\n const candleData = candleParam.value;\n const bucketsIndex = booksParam?.value[2];\n const matchedBucket = findMatchingBucket(\n buckets,\n bucketsIndex,\n selectedPrice,\n bucketWidth\n );\n const showCandles = hasValidCandleData(candleData);\n const showSentiment = hasValidSentimentData(sentimentLong, sentimentShort);\n\n if (!showCandles && !matchedBucket) {\n return '';\n }\n\n const timeFormatted = time.toLocaleString(undefined, DATE_FORMAT_OPTIONS);\n const candleSection = showCandles\n ? formatCandleData(candleData, labelCallback)\n : '';\n\n const bookSection = matchedBucket\n ? formatBookData({\n matchedBucket,\n bucketWidth,\n bucketDisplayPrecision,\n bookType,\n labelCallback,\n })\n : '';\n\n const sentimentSection =\n showSentiment && sentimentLong && sentimentShort\n ? formatSentimentData(sentimentLong, sentimentShort, labelCallback)\n : '';\n\n return `<p>${timeFormatted}</p><br />\n${candleSection}\n${bookSection}\n${sentimentSection}`;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGA,MAAMC,mBAA+C,GAAG;EACtDC,IAAI,EAAE,SAAS;EACfC,MAAM,EAAE,SAAS;EACjBC,IAAI,EAAE,SAAS;EACfC,GAAG,EAAE,SAAS;EACdC,KAAK,EAAE,SAAS;EAChBC,YAAY,EAAE;AAChB,CAAC;AAED,MAAMC,2BAA2B,GAAG,CAAC;AAErC,MAAMC,+BAA+B,GAAIC,WAAmB,IAAa;EAAA,IAAAC,qBAAA;EACvE,OAAO,EAAAA,qBAAA,GAAAD,WAAW,CAACE,QAAQ,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAAF,qBAAA,uBAApCA,qBAAA,CAAsCG,MAAM,KAAI,CAAC;AAC1D,CAAC;AAED,MAAMC,eAAe,GAAGA,CACtBC,MAAsB,EACtBC,QAAW,KAC4C;EACvD,OAAOD,MAAM,CAACE,IAAI,CACfC,MAAM,IACLA,MAAM,CAACF,QAAQ,KAAKA,QACxB,CAAC;AACH,CAAC;AAED,MAAMG,wBAAwB,GAAGA,CAC/BJ,MAAsB,EACtBK,cAAiC,EACjCC,eAAkC,KAI/B;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EACH,MAAMC,KAAK,GAAGT,MAAM,CAAC,CAAC,CA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|
|
6
|
+
exports.handleLabelUpdate = void 0;
|
|
7
|
+
var _formatXAxisAdditionalLabel = require("./formatXAxisAdditionalLabel");
|
|
8
|
+
var _formatXAxisLabel = require("./formatXAxisLabel");
|
|
9
|
+
var _getLabelData = require("./getLabelData");
|
|
10
|
+
var _isDifferenceGreaterThanTwoWeeks = require("./isDifferenceGreaterThanTwoWeeks");
|
|
11
|
+
const handleLabelUpdate = (instance, mainData, labelTimerRef, isGreaterThanTwoWeeksRef) => {
|
|
12
|
+
if (labelTimerRef.current) {
|
|
13
|
+
clearTimeout(labelTimerRef.current);
|
|
14
|
+
}
|
|
15
|
+
labelTimerRef.current = setTimeout(() => {
|
|
16
|
+
var _isGreaterThanTwoWeek;
|
|
17
|
+
const {
|
|
18
|
+
dates
|
|
19
|
+
} = mainData;
|
|
20
|
+
const {
|
|
21
|
+
dataZoom
|
|
22
|
+
} = instance.getOption();
|
|
23
|
+
if (!Array.isArray(dataZoom) || dataZoom.length === 0 || !dataZoom[0] || typeof dataZoom[0].startValue !== 'number' || typeof dataZoom[0].endValue !== 'number') {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const {
|
|
27
|
+
startValue,
|
|
28
|
+
endValue
|
|
29
|
+
} = dataZoom[0];
|
|
30
|
+
if (!dates[startValue] || !dates[endValue]) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const isGreaterThanTwoWeeks = (0, _isDifferenceGreaterThanTwoWeeks.isDifferenceGreaterThanTwoWeeks)(dates[startValue], dates[endValue]);
|
|
34
|
+
const wasGreaterThanTwoWeeks = (_isGreaterThanTwoWeek = isGreaterThanTwoWeeksRef.current) !== null && _isGreaterThanTwoWeek !== void 0 ? _isGreaterThanTwoWeek : false;
|
|
35
|
+
if (isGreaterThanTwoWeeks !== wasGreaterThanTwoWeeks) {
|
|
36
|
+
const labelsData = (0, _getLabelData.getLabelData)({
|
|
37
|
+
dates,
|
|
38
|
+
isGreaterThanTwoWeeks
|
|
39
|
+
});
|
|
40
|
+
instance.setOption({
|
|
41
|
+
xAxis: [{
|
|
42
|
+
id: 'main-xAxis',
|
|
43
|
+
axisLabel: {
|
|
44
|
+
formatter: value => (0, _formatXAxisLabel.formatXAxisLabel)(value, isGreaterThanTwoWeeks)
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
id: 'additional-xAxis',
|
|
48
|
+
axisLabel: {
|
|
49
|
+
customValues: labelsData,
|
|
50
|
+
formatter: value => (0, _formatXAxisAdditionalLabel.formatXAxisAdditionalLabel)(value, isGreaterThanTwoWeeks)
|
|
51
|
+
}
|
|
52
|
+
}]
|
|
53
|
+
});
|
|
54
|
+
isGreaterThanTwoWeeksRef.current = isGreaterThanTwoWeeks;
|
|
55
|
+
}
|
|
56
|
+
}, 50);
|
|
57
|
+
};
|
|
58
|
+
exports.handleLabelUpdate = handleLabelUpdate;
|
|
59
|
+
//# sourceMappingURL=handleLabelUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleLabelUpdate.js","names":["_formatXAxisAdditionalLabel","require","_formatXAxisLabel","_getLabelData","_isDifferenceGreaterThanTwoWeeks","handleLabelUpdate","instance","mainData","labelTimerRef","isGreaterThanTwoWeeksRef","current","clearTimeout","setTimeout","_isGreaterThanTwoWeek","dates","dataZoom","getOption","Array","isArray","length","startValue","endValue","isGreaterThanTwoWeeks","isDifferenceGreaterThanTwoWeeks","wasGreaterThanTwoWeeks","labelsData","getLabelData","setOption","xAxis","id","axisLabel","formatter","value","formatXAxisLabel","customValues","formatXAxisAdditionalLabel","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.ts"],"sourcesContent":["import type { EChartsType } from 'echarts';\nimport type { MutableRefObject } from 'react';\n\nimport type { ChartProps, DataZoomArray } from '../types';\nimport { formatXAxisAdditionalLabel } from './formatXAxisAdditionalLabel';\nimport { formatXAxisLabel } from './formatXAxisLabel';\nimport { getLabelData } from './getLabelData';\nimport { isDifferenceGreaterThanTwoWeeks } from './isDifferenceGreaterThanTwoWeeks';\n\nexport const handleLabelUpdate = (\n instance: EChartsType,\n mainData: ChartProps['mainData'],\n labelTimerRef: MutableRefObject<NodeJS.Timeout | null>,\n isGreaterThanTwoWeeksRef: MutableRefObject<boolean | null>\n): void => {\n if (labelTimerRef.current) {\n clearTimeout(labelTimerRef.current);\n }\n labelTimerRef.current = setTimeout(() => {\n const { dates } = mainData;\n\n const { dataZoom } = instance.getOption();\n if (\n !Array.isArray(dataZoom) ||\n dataZoom.length === 0 ||\n !dataZoom[0] ||\n typeof dataZoom[0].startValue !== 'number' ||\n typeof dataZoom[0].endValue !== 'number'\n ) {\n return;\n }\n\n const { startValue, endValue } = dataZoom[0] as DataZoomArray[0];\n\n if (!dates[startValue] || !dates[endValue]) {\n return;\n }\n\n const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(\n dates[startValue],\n dates[endValue]\n );\n\n const wasGreaterThanTwoWeeks = isGreaterThanTwoWeeksRef.current ?? false;\n\n if (isGreaterThanTwoWeeks !== wasGreaterThanTwoWeeks) {\n const labelsData = getLabelData({\n dates,\n isGreaterThanTwoWeeks,\n });\n\n instance.setOption({\n xAxis: [\n {\n id: 'main-xAxis',\n axisLabel: {\n formatter: (value: string) =>\n formatXAxisLabel(value, isGreaterThanTwoWeeks),\n },\n },\n {\n id: 'additional-xAxis',\n axisLabel: {\n customValues: labelsData,\n formatter: (value: unknown) =>\n formatXAxisAdditionalLabel(value, isGreaterThanTwoWeeks),\n },\n },\n ],\n });\n\n isGreaterThanTwoWeeksRef.current = isGreaterThanTwoWeeks;\n }\n }, 50);\n};\n"],"mappings":";;;;;;AAIA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,gCAAA,GAAAH,OAAA;AAEO,MAAMI,iBAAiB,GAAGA,CAC/BC,QAAqB,EACrBC,QAAgC,EAChCC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vB,IAAAC,kCAAgB,EAACD,KAAK,EAAEV,qBAAqB;UACjD;QACF,CAAC,EACD;UACEO,EAAE,EAAE,kBAAkB;UACtBC,SAAS,EAAE;YACTI,YAAY,EAAET,UAAU;YACxBM,SAAS,EAAGC,KAAc,IACxB,IAAAG,sDAA0B,EAACH,KAAK,EAAEV,qBAAqB;UAC3D;QACF,CAAC;MAEL,CAAC,CAAC;MAEFb,wBAAwB,CAACC,OAAO,GAAGY,qBAAqB;IAC1D;EACF,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAACc,OAAA,CAAA/B,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleTooltipUpdate = void 0;
|
|
7
|
+
const handleTooltipUpdate = (instance, zoomTimerRef, tooltipVisibleRef, canHover) => {
|
|
8
|
+
if (!canHover) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (tooltipVisibleRef.current) {
|
|
12
|
+
instance.setOption({
|
|
13
|
+
tooltip: {
|
|
14
|
+
show: false
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
tooltipVisibleRef.current = false;
|
|
18
|
+
}
|
|
19
|
+
if (zoomTimerRef.current) {
|
|
20
|
+
clearTimeout(zoomTimerRef.current);
|
|
21
|
+
}
|
|
22
|
+
zoomTimerRef.current = setTimeout(() => {
|
|
23
|
+
if (!tooltipVisibleRef.current) {
|
|
24
|
+
instance.setOption({
|
|
25
|
+
tooltip: {
|
|
26
|
+
show: true
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
tooltipVisibleRef.current = true;
|
|
30
|
+
}
|
|
31
|
+
}, 100);
|
|
32
|
+
};
|
|
33
|
+
exports.handleTooltipUpdate = handleTooltipUpdate;
|
|
34
|
+
//# sourceMappingURL=handleTooltipUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleTooltipUpdate.js","names":["handleTooltipUpdate","instance","zoomTimerRef","tooltipVisibleRef","canHover","current","setOption","tooltip","show","clearTimeout","setTimeout","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.ts"],"sourcesContent":["import type { EChartsType } from 'echarts';\nimport type { MutableRefObject } from 'react';\n\nexport const handleTooltipUpdate = (\n instance: EChartsType,\n zoomTimerRef: MutableRefObject<NodeJS.Timeout | null>,\n tooltipVisibleRef: MutableRefObject<boolean>,\n canHover: boolean\n): void => {\n if (!canHover) {\n return;\n }\n\n if (tooltipVisibleRef.current) {\n instance.setOption({\n tooltip: {\n show: false,\n },\n });\n tooltipVisibleRef.current = false;\n }\n\n if (zoomTimerRef.current) {\n clearTimeout(zoomTimerRef.current);\n }\n\n zoomTimerRef.current = setTimeout(() => {\n if (!tooltipVisibleRef.current) {\n instance.setOption({\n tooltip: {\n show: true,\n },\n });\n tooltipVisibleRef.current = true;\n }\n }, 100);\n};\n"],"mappings":";;;;;;AAGO,MAAMA,mBAAmB,GAAGA,CACjCC,QAAqB,EACrBC,YAAqD,EACrDC,iBAA4C,EAC5CC,QAAiB,KACR;EACT,IAAI,CAACA,QAAQ,EAAE;IACb;EACF;EAEA,IAAID,iBAAiB,CAACE,OAAO,EAAE;IAC7BJ,QAAQ,CAACK,SAAS,CAAC;MACjBC,OAAO,EAAE;QACPC,IAAI,EAAE;MACR;IACF,CAAC,CAAC;IACFL,iBAAiB,CAACE,OAAO,GAAG,KAAK;EACnC;EAEA,IAAIH,YAAY,CAACG,OAAO,EAAE;IACxBI,YAAY,CAACP,YAAY,CAACG,OAAO,CAAC;EACpC;EAEAH,YAAY,CAACG,OAAO,GAAGK,UAAU,CAAC,MAAM;IACtC,IAAI,CAACP,iBAAiB,CAACE,OAAO,EAAE;MAC9BJ,QAAQ,CAACK,SAAS,CAAC;QACjBC,OAAO,EAAE;UACPC,IAAI,EAAE;QACR;MACF,CAAC,CAAC;MACFL,iBAAiB,CAACE,OAAO,GAAG,IAAI;IAClC;EACF,CAAC,EAAE,GAAG,CAAC;AACT,CAAC;AAACM,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _formatXAxisAdditionalLabel = require("./formatXAxisAdditionalLabel");
|
|
7
|
+
Object.keys(_formatXAxisAdditionalLabel).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _formatXAxisAdditionalLabel[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _formatXAxisAdditionalLabel[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _formatXAxisLabel = require("./formatXAxisLabel");
|
|
18
|
+
Object.keys(_formatXAxisLabel).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _formatXAxisLabel[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _formatXAxisLabel[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _getChartStyles = require("./getChartStyles");
|
|
29
|
+
Object.keys(_getChartStyles).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _getChartStyles[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _getChartStyles[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _getGradientColor = require("./getGradientColor");
|
|
40
|
+
Object.keys(_getGradientColor).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _getGradientColor[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _getGradientColor[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
var _getLabelData = require("./getLabelData");
|
|
51
|
+
Object.keys(_getLabelData).forEach(function (key) {
|
|
52
|
+
if (key === "default" || key === "__esModule") return;
|
|
53
|
+
if (key in exports && exports[key] === _getLabelData[key]) return;
|
|
54
|
+
Object.defineProperty(exports, key, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _getLabelData[key];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var _getRectColor = require("./getRectColor");
|
|
62
|
+
Object.keys(_getRectColor).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _getRectColor[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _getRectColor[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _getTooltipFormatter = require("./getTooltipFormatter");
|
|
73
|
+
Object.keys(_getTooltipFormatter).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _getTooltipFormatter[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _getTooltipFormatter[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
var _handleLabelUpdate = require("./handleLabelUpdate");
|
|
84
|
+
Object.keys(_handleLabelUpdate).forEach(function (key) {
|
|
85
|
+
if (key === "default" || key === "__esModule") return;
|
|
86
|
+
if (key in exports && exports[key] === _handleLabelUpdate[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _handleLabelUpdate[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _handleTooltipUpdate = require("./handleTooltipUpdate");
|
|
95
|
+
Object.keys(_handleTooltipUpdate).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _handleTooltipUpdate[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _handleTooltipUpdate[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
var _isDifferenceGreaterThanTwoWeeks = require("./isDifferenceGreaterThanTwoWeeks");
|
|
106
|
+
Object.keys(_isDifferenceGreaterThanTwoWeeks).forEach(function (key) {
|
|
107
|
+
if (key === "default" || key === "__esModule") return;
|
|
108
|
+
if (key in exports && exports[key] === _isDifferenceGreaterThanTwoWeeks[key]) return;
|
|
109
|
+
Object.defineProperty(exports, key, {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _isDifferenceGreaterThanTwoWeeks[key];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_formatXAxisAdditionalLabel","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_formatXAxisLabel","_getChartStyles","_getGradientColor","_getLabelData","_getRectColor","_getTooltipFormatter","_handleLabelUpdate","_handleTooltipUpdate","_isDifferenceGreaterThanTwoWeeks"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/index.ts"],"sourcesContent":["export * from './formatXAxisAdditionalLabel';\nexport * from './formatXAxisLabel';\nexport * from './getChartStyles';\nexport * from './getGradientColor';\nexport * from './getLabelData';\nexport * from './getRectColor';\nexport * from './getTooltipFormatter';\nexport * from './handleLabelUpdate';\nexport * from './handleTooltipUpdate';\nexport * from './isDifferenceGreaterThanTwoWeeks';\n"],"mappings":";;;;;AAAA,IAAAA,2BAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,2BAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,2BAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,2BAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,iBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,iBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,iBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,iBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,eAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,eAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,O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AAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAa,gCAAA,CAAAb,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAS,gCAAA,CAAAb,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isDifferenceGreaterThanTwoWeeks = void 0;
|
|
7
|
+
var _constants = require("../../../constants");
|
|
8
|
+
const isDifferenceGreaterThanTwoWeeks = (startDate, endDate) => {
|
|
9
|
+
const date1 = new Date(startDate);
|
|
10
|
+
const date2 = new Date(endDate);
|
|
11
|
+
const differenceInMs = Math.abs(date2.getTime() - date1.getTime());
|
|
12
|
+
return differenceInMs < _constants.TIME_THRESHOLDS.TWO_WEEKS_MS;
|
|
13
|
+
};
|
|
14
|
+
exports.isDifferenceGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks;
|
|
15
|
+
//# sourceMappingURL=isDifferenceGreaterThanTwoWeeks.js.map
|
package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDifferenceGreaterThanTwoWeeks.js","names":["_constants","require","isDifferenceGreaterThanTwoWeeks","startDate","endDate","date1","Date","date2","differenceInMs","Math","abs","getTime","TIME_THRESHOLDS","TWO_WEEKS_MS","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.ts"],"sourcesContent":["import { TIME_THRESHOLDS } from '../../../constants';\n\nexport const isDifferenceGreaterThanTwoWeeks = (\n startDate: string,\n endDate: string\n) => {\n const date1 = new Date(startDate);\n const date2 = new Date(endDate);\n\n const differenceInMs = Math.abs(date2.getTime() - date1.getTime());\n\n return differenceInMs < TIME_THRESHOLDS.TWO_WEEKS_MS;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,MAAMC,+BAA+B,GAAGA,CAC7CC,SAAiB,EACjBC,OAAe,KACZ;EACH,MAAMC,KAAK,GAAG,IAAIC,IAAI,CAACH,SAAS,CAAC;EACjC,MAAMI,KAAK,GAAG,IAAID,IAAI,CAACF,OAAO,CAAC;EAE/B,MAAMI,cAAc,GAAGC,IAAI,CAACC,GAAG,CAACH,KAAK,CAACI,OAAO,CAAC,CAAC,GAAGN,KAAK,CAACM,OAAO,CAAC,CAAC,CAAC;EAElE,OAAOH,cAAc,GAAGI,0BAAe,CAACC,YAAY;AACtD,CAAC;AAACC,OAAA,CAAAZ,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getInstrumentConfigForDivision = void 0;
|
|
7
|
-
var _graphql = require("
|
|
8
|
-
var _selectConfig = require("
|
|
7
|
+
var _graphql = require("../../../../gql/types/graphql");
|
|
8
|
+
var _selectConfig = require("../../../selectConfig");
|
|
9
9
|
const getInstrumentConfigForDivision = division => {
|
|
10
10
|
return division === _graphql.Division.Oc ? _selectConfig.instrumentSelectConfigOC : _selectConfig.instrumentSelectConfig;
|
|
11
11
|
};
|
|
12
12
|
exports.getInstrumentConfigForDivision = getInstrumentConfigForDivision;
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=getInstrumentConfigForDivision.js.map
|
package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInstrumentConfigForDivision.js","names":["_graphql","require","_selectConfig","getInstrumentConfigForDivision","division","Division","Oc","instrumentSelectConfigOC","instrumentSelectConfig","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.ts"],"sourcesContent":["import { Division } from '../../../../gql/types/graphql';\nimport {\n instrumentSelectConfig,\n instrumentSelectConfigOC,\n} from '../../../selectConfig';\n\nexport const getInstrumentConfigForDivision = (division: Division) => {\n return division === Division.Oc\n ? instrumentSelectConfigOC\n : instrumentSelectConfig;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKO,MAAME,8BAA8B,GAAIC,QAAkB,IAAK;EACpE,OAAOA,QAAQ,KAAKC,iBAAQ,CAACC,EAAE,GAC3BC,sCAAwB,GACxBC,oCAAsB;AAC5B,CAAC;AAACC,OAAA,CAAAN,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getMultiplayerForTimeSpan = void 0;
|
|
7
|
+
var _graphql = require("../../../../gql/types/graphql");
|
|
8
|
+
var _constants = require("../../../constants");
|
|
9
|
+
const getMultiplayerForTimeSpan = granularity => {
|
|
10
|
+
const timeSpanMultiplierMap = {
|
|
11
|
+
[_graphql.Granularity.M5]: _constants.BUCKET_CONFIG.MULTIPLIER_5M,
|
|
12
|
+
[_graphql.Granularity.M15]: _constants.BUCKET_CONFIG.MULTIPLIER_15M,
|
|
13
|
+
[_graphql.Granularity.H1]: _constants.BUCKET_CONFIG.MULTIPLIER_1H,
|
|
14
|
+
[_graphql.Granularity.H4]: _constants.BUCKET_CONFIG.MULTIPLIER_4H
|
|
15
|
+
};
|
|
16
|
+
return timeSpanMultiplierMap[granularity] || _constants.BUCKET_CONFIG.MULTIPLIER_5M;
|
|
17
|
+
};
|
|
18
|
+
exports.getMultiplayerForTimeSpan = getMultiplayerForTimeSpan;
|
|
19
|
+
//# sourceMappingURL=getMultiplayerForTimeSpan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMultiplayerForTimeSpan.js","names":["_graphql","require","_constants","getMultiplayerForTimeSpan","granularity","timeSpanMultiplierMap","Granularity","M5","BUCKET_CONFIG","MULTIPLIER_5M","M15","MULTIPLIER_15M","H1","MULTIPLIER_1H","H4","MULTIPLIER_4H","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.ts"],"sourcesContent":["import { Granularity } from '../../../../gql/types/graphql';\nimport { BUCKET_CONFIG } from '../../../constants';\n\nexport const getMultiplayerForTimeSpan = (granularity: Granularity): number => {\n const timeSpanMultiplierMap: Record<Granularity, number> = {\n [Granularity.M5]: BUCKET_CONFIG.MULTIPLIER_5M,\n [Granularity.M15]: BUCKET_CONFIG.MULTIPLIER_15M,\n [Granularity.H1]: BUCKET_CONFIG.MULTIPLIER_1H,\n [Granularity.H4]: BUCKET_CONFIG.MULTIPLIER_4H,\n };\n\n return timeSpanMultiplierMap[granularity] || BUCKET_CONFIG.MULTIPLIER_5M;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEO,MAAME,yBAAyB,GAAIC,WAAwB,IAAa;EAC7E,MAAMC,qBAAkD,GAAG;IACzD,CAACC,oBAAW,CAACC,EAAE,GAAGC,wBAAa,CAACC,aAAa;IAC7C,CAACH,oBAAW,CAACI,GAAG,GAAGF,wBAAa,CAACG,cAAc;IAC/C,CAACL,oBAAW,CAACM,EAAE,GAAGJ,wBAAa,CAACK,aAAa;IAC7C,CAACP,oBAAW,CAACQ,EAAE,GAAGN,wBAAa,CAACO;EAClC,CAAC;EAED,OAAOV,qBAAqB,CAACD,WAAW,CAAC,IAAII,wBAAa,CAACC,aAAa;AAC1E,CAAC;AAACO,OAAA,CAAAb,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTimeSpanForGranularity = void 0;
|
|
7
|
+
var _graphql = require("../../../../gql/types/graphql");
|
|
8
|
+
const getTimeSpanForGranularity = granularity => {
|
|
9
|
+
const granularityTimeSpanMap = {
|
|
10
|
+
[_graphql.Granularity.M5]: _graphql.TimeSpan.TwoDays,
|
|
11
|
+
[_graphql.Granularity.M15]: _graphql.TimeSpan.FiveDays,
|
|
12
|
+
[_graphql.Granularity.H1]: _graphql.TimeSpan.TwentyDays,
|
|
13
|
+
[_graphql.Granularity.H4]: _graphql.TimeSpan.NinetyDays
|
|
14
|
+
};
|
|
15
|
+
return granularityTimeSpanMap[granularity] || _graphql.TimeSpan.TwoDays;
|
|
16
|
+
};
|
|
17
|
+
exports.getTimeSpanForGranularity = getTimeSpanForGranularity;
|
|
18
|
+
//# sourceMappingURL=getTimeSpanForGranularity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTimeSpanForGranularity.js","names":["_graphql","require","getTimeSpanForGranularity","granularity","granularityTimeSpanMap","Granularity","M5","TimeSpan","TwoDays","M15","FiveDays","H1","TwentyDays","H4","NinetyDays","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.ts"],"sourcesContent":["import { Granularity, TimeSpan } from '../../../../gql/types/graphql';\n\nexport const getTimeSpanForGranularity = (\n granularity: Granularity\n): TimeSpan => {\n const granularityTimeSpanMap: Record<Granularity, TimeSpan> = {\n [Granularity.M5]: TimeSpan.TwoDays,\n [Granularity.M15]: TimeSpan.FiveDays,\n [Granularity.H1]: TimeSpan.TwentyDays,\n [Granularity.H4]: TimeSpan.NinetyDays,\n };\n\n return granularityTimeSpanMap[granularity] || TimeSpan.TwoDays;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEO,MAAMC,yBAAyB,GACpCC,WAAwB,IACX;EACb,MAAMC,sBAAqD,GAAG;IAC5D,CAACC,oBAAW,CAACC,EAAE,GAAGC,iBAAQ,CAACC,OAAO;IAClC,CAACH,oBAAW,CAACI,GAAG,GAAGF,iBAAQ,CAACG,QAAQ;IACpC,CAACL,oBAAW,CAACM,EAAE,GAAGJ,iBAAQ,CAACK,UAAU;IACrC,CAACP,oBAAW,CAACQ,EAAE,GAAGN,iBAAQ,CAACO;EAC7B,CAAC;EAED,OAAOV,sBAAsB,CAACD,WAAW,CAAC,IAAII,iBAAQ,CAACC,OAAO;AAChE,CAAC;AAACO,OAAA,CAAAb,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|