@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 @@
|
|
|
1
|
+
{"version":3,"file":"getVisualMapConfig.js","names":["CHART_CONFIG","getVisualMapConfig","_ref","sentimentLongColor","sentimentShortColor","show","dimension","seriesId","pieces","lt","SENTIMENT_MAX","color","gte","lte","gt"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.ts"],"sourcesContent":["import type { VisualMapComponentOption } from 'echarts';\n\nimport { CHART_CONFIG } from '../../../constants';\n\ninterface GetVisualMapConfigParams {\n sentimentLongColor: string;\n sentimentShortColor: string;\n}\n\nexport const getVisualMapConfig = ({\n sentimentLongColor,\n sentimentShortColor,\n}: GetVisualMapConfigParams): VisualMapComponentOption => ({\n show: false,\n dimension: 1,\n seriesId: 'sentiment',\n pieces: [\n {\n lt: CHART_CONFIG.SENTIMENT_MAX / 2,\n color: sentimentShortColor,\n },\n {\n gte: CHART_CONFIG.SENTIMENT_MAX / 2,\n lte: CHART_CONFIG.SENTIMENT_MAX,\n color: sentimentLongColor,\n },\n {\n gt: CHART_CONFIG.SENTIMENT_MAX,\n color: sentimentLongColor,\n },\n ],\n});\n"],"mappings":"AAEA,SAASA,YAAY,QAAQ,oBAAoB;AAOjD,OAAO,MAAMC,kBAAkB,GAAGC,IAAA;EAAA,IAAC;IACjCC,kBAAkB;IAClBC;EACwB,CAAC,GAAAF,IAAA;EAAA,OAAgC;IACzDG,IAAI,EAAE,KAAK;IACXC,SAAS,EAAE,CAAC;IACZC,QAAQ,EAAE,WAAW;IACrBC,MAAM,EAAE,CACN;MACEC,EAAE,EAAET,YAAY,CAACU,aAAa,GAAG,CAAC;MAClCC,KAAK,EAAEP;IACT,CAAC,EACD;MACEQ,GAAG,EAAEZ,YAAY,CAACU,aAAa,GAAG,CAAC;MACnCG,GAAG,EAAEb,YAAY,CAACU,aAAa;MAC/BC,KAAK,EAAER;IACT,CAAC,EACD;MACEW,EAAE,EAAEd,YAAY,CAACU,aAAa;MAC9BC,KAAK,EAAER;IACT,CAAC;EAEL,CAAC;AAAA,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { formatXAxisAdditionalLabel, formatXAxisLabel, getLabelData } from '../chartUtils';
|
|
2
|
+
export const getXAxisConfig = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
dates,
|
|
5
|
+
isGreaterThanTwoWeeks
|
|
6
|
+
} = _ref;
|
|
7
|
+
const labelsData = getLabelData({
|
|
8
|
+
dates,
|
|
9
|
+
isGreaterThanTwoWeeks
|
|
10
|
+
});
|
|
11
|
+
return [{
|
|
12
|
+
type: 'category',
|
|
13
|
+
id: 'main-xAxis',
|
|
14
|
+
name: isGreaterThanTwoWeeks ? 'xAxis-greater-than-two-weeks' : 'xAxis-less-than-two-weeks',
|
|
15
|
+
nameTextStyle: {
|
|
16
|
+
fontSize: 0
|
|
17
|
+
},
|
|
18
|
+
axisTick: {
|
|
19
|
+
show: false
|
|
20
|
+
},
|
|
21
|
+
axisLabel: {
|
|
22
|
+
padding: [8, 16, 8, 16],
|
|
23
|
+
margin: 0,
|
|
24
|
+
formatter: value => formatXAxisLabel(value, isGreaterThanTwoWeeks)
|
|
25
|
+
},
|
|
26
|
+
boundaryGap: false
|
|
27
|
+
}, {
|
|
28
|
+
type: 'category',
|
|
29
|
+
id: 'additional-xAxis',
|
|
30
|
+
gridIndex: 1,
|
|
31
|
+
axisTick: {
|
|
32
|
+
show: false
|
|
33
|
+
},
|
|
34
|
+
axisLine: {
|
|
35
|
+
show: false
|
|
36
|
+
},
|
|
37
|
+
splitLine: {
|
|
38
|
+
show: false
|
|
39
|
+
},
|
|
40
|
+
axisLabel: {
|
|
41
|
+
margin: 24,
|
|
42
|
+
hideOverlap: true,
|
|
43
|
+
customValues: labelsData,
|
|
44
|
+
formatter: value => formatXAxisAdditionalLabel(value, isGreaterThanTwoWeeks)
|
|
45
|
+
},
|
|
46
|
+
data: dates,
|
|
47
|
+
boundaryGap: false
|
|
48
|
+
}];
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=getXAxisConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getXAxisConfig.js","names":["formatXAxisAdditionalLabel","formatXAxisLabel","getLabelData","getXAxisConfig","_ref","dates","isGreaterThanTwoWeeks","labelsData","type","id","name","nameTextStyle","fontSize","axisTick","show","axisLabel","padding","margin","formatter","value","boundaryGap","gridIndex","axisLine","splitLine","hideOverlap","customValues","data"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts"],"sourcesContent":["import type { XAXisComponentOption } from 'echarts';\n\nimport {\n formatXAxisAdditionalLabel,\n formatXAxisLabel,\n getLabelData,\n} from '../chartUtils';\n\ninterface GetXAxisConfigParams {\n dates: string[];\n isGreaterThanTwoWeeks: boolean;\n}\n\nexport const getXAxisConfig = ({\n dates,\n isGreaterThanTwoWeeks,\n}: GetXAxisConfigParams): XAXisComponentOption[] => {\n const labelsData = getLabelData({\n dates,\n isGreaterThanTwoWeeks,\n });\n\n return [\n {\n type: 'category',\n id: 'main-xAxis',\n name: isGreaterThanTwoWeeks\n ? 'xAxis-greater-than-two-weeks'\n : 'xAxis-less-than-two-weeks',\n nameTextStyle: {\n fontSize: 0,\n },\n axisTick: {\n show: false,\n },\n axisLabel: {\n padding: [8, 16, 8, 16],\n margin: 0,\n formatter: (value: unknown) =>\n formatXAxisLabel(value, isGreaterThanTwoWeeks),\n },\n boundaryGap: false,\n },\n {\n type: 'category',\n id: 'additional-xAxis',\n gridIndex: 1,\n axisTick: {\n show: false,\n },\n axisLine: {\n show: false,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n margin: 24,\n hideOverlap: true,\n customValues: labelsData,\n formatter: (value: unknown) =>\n formatXAxisAdditionalLabel(value, isGreaterThanTwoWeeks),\n },\n data: dates,\n boundaryGap: false,\n },\n ];\n};\n"],"mappings":"AAEA,SACEA,0BAA0B,EAC1BC,gBAAgB,EAChBC,YAAY,QACP,eAAe;AAOtB,OAAO,MAAMC,cAAc,GAAGC,IAAA,IAGsB;EAAA,IAHrB;IAC7BC,KAAK;IACLC;EACoB,CAAC,GAAAF,IAAA;EACrB,MAAMG,UAAU,GAAGL,YAAY,CAAC;IAC9BG,KAAK;IACLC;EACF,CAAC,CAAC;EAEF,OAAO,CACL;IACEE,IAAI,EAAE,UAAU;IAChBC,EAAE,EAAE,YAAY;IAChBC,IAAI,EAAEJ,qBAAqB,GACvB,8BAA8B,GAC9B,2BAA2B;IAC/BK,aAAa,EAAE;MACbC,QAAQ,EAAE;IACZ,CAAC;IACDC,QAAQ,EAAE;MACRC,IAAI,EAAE;IACR,CAAC;IACDC,SAAS,EAAE;MACTC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;MACvBC,MAAM,EAAE,CAAC;MACTC,SAAS,EAAGC,KAAc,IACxBlB,gBAAgB,CAACkB,KAAK,EAAEb,qBAAqB;IACjD,CAAC;IACDc,WAAW,EAAE;EACf,CAAC,EACD;IACEZ,IAAI,EAAE,UAAU;IAChBC,EAAE,EAAE,kBAAkB;IACtBY,SAAS,EAAE,CAAC;IACZR,QAAQ,EAAE;MACRC,IAAI,EAAE;IACR,CAAC;IACDQ,QAAQ,EAAE;MACRR,IAAI,EAAE;IACR,CAAC;IACDS,SAAS,EAAE;MACTT,IAAI,EAAE;IACR,CAAC;IACDC,SAAS,EAAE;MACTE,MAAM,EAAE,EAAE;MACVO,WAAW,EAAE,IAAI;MACjBC,YAAY,EAAElB,UAAU;MACxBW,SAAS,EAAGC,KAAc,IACxBnB,0BAA0B,CAACmB,KAAK,EAAEb,qBAAqB;IAC3D,CAAC;IACDoB,IAAI,EAAErB,KAAK;IACXe,WAAW,EAAE;EACf,CAAC,CACF;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BUCKET_CONFIG, CHART_CONFIG } from '../../../constants';
|
|
2
|
+
export const getYAxisConfig = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
bucketWidth,
|
|
5
|
+
displayPrecision
|
|
6
|
+
} = _ref;
|
|
7
|
+
return [{
|
|
8
|
+
type: 'value',
|
|
9
|
+
gridIndex: 0,
|
|
10
|
+
position: 'right',
|
|
11
|
+
min: val => val.min - bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
|
|
12
|
+
max: val => val.max + bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
|
|
13
|
+
axisLine: {
|
|
14
|
+
show: false
|
|
15
|
+
},
|
|
16
|
+
axisTick: {
|
|
17
|
+
show: false
|
|
18
|
+
},
|
|
19
|
+
splitLine: {
|
|
20
|
+
show: false
|
|
21
|
+
},
|
|
22
|
+
axisLabel: {
|
|
23
|
+
lineHeight: 20,
|
|
24
|
+
margin: 4,
|
|
25
|
+
verticalAlignMinLabel: 'bottom',
|
|
26
|
+
verticalAlignMaxLabel: 'top',
|
|
27
|
+
formatter: value => value.toFixed(displayPrecision)
|
|
28
|
+
},
|
|
29
|
+
z: 30
|
|
30
|
+
}, {
|
|
31
|
+
type: 'value',
|
|
32
|
+
gridIndex: 1,
|
|
33
|
+
position: 'left',
|
|
34
|
+
min: CHART_CONFIG.SENTIMENT_MIN,
|
|
35
|
+
max: CHART_CONFIG.SENTIMENT_MAX,
|
|
36
|
+
axisLine: {
|
|
37
|
+
show: false
|
|
38
|
+
},
|
|
39
|
+
axisTick: {
|
|
40
|
+
show: false
|
|
41
|
+
},
|
|
42
|
+
axisPointer: {
|
|
43
|
+
show: false
|
|
44
|
+
},
|
|
45
|
+
splitLine: {
|
|
46
|
+
show: false
|
|
47
|
+
},
|
|
48
|
+
axisLabel: {
|
|
49
|
+
margin: 4,
|
|
50
|
+
lineHeight: 20,
|
|
51
|
+
verticalAlignMinLabel: 'bottom',
|
|
52
|
+
verticalAlignMaxLabel: 'middle',
|
|
53
|
+
customValues: [CHART_CONFIG.SENTIMENT_MIN, CHART_CONFIG.SENTIMENT_MAX / 5, CHART_CONFIG.SENTIMENT_MAX / 2, CHART_CONFIG.SENTIMENT_MAX * 4 / 5, CHART_CONFIG.SENTIMENT_MAX],
|
|
54
|
+
formatter: value => "".concat(value, "%")
|
|
55
|
+
},
|
|
56
|
+
z: 30
|
|
57
|
+
}];
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=getYAxisConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getYAxisConfig.js","names":["BUCKET_CONFIG","CHART_CONFIG","getYAxisConfig","_ref","bucketWidth","displayPrecision","type","gridIndex","position","min","val","PRICE_MARGIN_MULTIPLIER","max","axisLine","show","axisTick","splitLine","axisLabel","lineHeight","margin","verticalAlignMinLabel","verticalAlignMaxLabel","formatter","value","toFixed","z","SENTIMENT_MIN","SENTIMENT_MAX","axisPointer","customValues","concat"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts"],"sourcesContent":["import type { YAXisComponentOption } from 'echarts';\n\nimport { BUCKET_CONFIG, CHART_CONFIG } from '../../../constants';\n\ninterface GetYAxisConfigParams {\n bucketWidth: number;\n displayPrecision: number;\n}\n\nexport const getYAxisConfig = ({\n bucketWidth,\n displayPrecision,\n}: GetYAxisConfigParams): YAXisComponentOption[] => [\n {\n type: 'value',\n gridIndex: 0,\n position: 'right',\n min: (val: { min: number }) =>\n val.min - bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,\n max: (val: { max: number }) =>\n val.max + bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: { show: false },\n axisLabel: {\n lineHeight: 20,\n margin: 4,\n verticalAlignMinLabel: 'bottom',\n verticalAlignMaxLabel: 'top',\n formatter: (value: number) => value.toFixed(displayPrecision),\n },\n z: 30,\n },\n {\n type: 'value',\n gridIndex: 1,\n position: 'left',\n min: CHART_CONFIG.SENTIMENT_MIN,\n max: CHART_CONFIG.SENTIMENT_MAX,\n axisLine: { show: false },\n axisTick: { show: false },\n axisPointer: { show: false },\n splitLine: { show: false },\n axisLabel: {\n margin: 4,\n lineHeight: 20,\n verticalAlignMinLabel: 'bottom',\n verticalAlignMaxLabel: 'middle',\n customValues: [\n CHART_CONFIG.SENTIMENT_MIN,\n CHART_CONFIG.SENTIMENT_MAX / 5,\n CHART_CONFIG.SENTIMENT_MAX / 2,\n (CHART_CONFIG.SENTIMENT_MAX * 4) / 5,\n CHART_CONFIG.SENTIMENT_MAX,\n ],\n formatter: (value: number) => `${value}%`,\n },\n z: 30,\n },\n];\n"],"mappings":"AAEA,SAASA,aAAa,EAAEC,YAAY,QAAQ,oBAAoB;AAOhE,OAAO,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;IAC7BC,WAAW;IACXC;EACoB,CAAC,GAAAF,IAAA;EAAA,OAA6B,CAClD;IACEG,IAAI,EAAE,OAAO;IACbC,SAAS,EAAE,CAAC;IACZC,QAAQ,EAAE,OAAO;IACjBC,GAAG,EAAGC,GAAoB,IACxBA,GAAG,CAACD,GAAG,GAAGL,WAAW,GAAGJ,aAAa,CAACW,uBA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Aa,OAAAO,MAAA,CAAQP,KAAK;IACxC,CAAC;IACDE,CAAC,EAAE;EACL,CAAC,CACF;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './getDataZoomConfig';
|
|
2
|
+
export * from './getGridConfig';
|
|
3
|
+
export * from './getGridLines';
|
|
4
|
+
export * from './getLabelsConfig';
|
|
5
|
+
export * from './getSeriesCandlestickConfig';
|
|
6
|
+
export * from './getSeriesHeatmapConfig';
|
|
7
|
+
export * from './getSeriesSentimentConfig';
|
|
8
|
+
export * from './getTooltipConfig';
|
|
9
|
+
export * from './getVisualMapConfig';
|
|
10
|
+
export * from './getXAxisConfig';
|
|
11
|
+
export * from './getYAxisConfig';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/index.ts"],"sourcesContent":["export * from './getDataZoomConfig';\nexport * from './getGridConfig';\nexport * from './getGridLines';\nexport * from './getLabelsConfig';\nexport * from './getSeriesCandlestickConfig';\nexport * from './getSeriesHeatmapConfig';\nexport * from './getSeriesSentimentConfig';\nexport * from './getTooltipConfig';\nexport * from './getVisualMapConfig';\nexport * from './getXAxisConfig';\nexport * from './getYAxisConfig';\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,8BAA8B;AAC5C,cAAc,0BAA0B;AACxC,cAAc,4BAA4B;AAC1C,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const formatXAxisAdditionalLabel = (value, isGreaterThanTwoWeeks) => {
|
|
2
|
+
const date = new Date(value);
|
|
3
|
+
if (isNaN(date.getTime())) {
|
|
4
|
+
return '';
|
|
5
|
+
}
|
|
6
|
+
return "".concat(date.toLocaleDateString(undefined, {
|
|
7
|
+
month: isGreaterThanTwoWeeks ? 'short' : 'long',
|
|
8
|
+
day: isGreaterThanTwoWeeks ? 'numeric' : undefined
|
|
9
|
+
}));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=formatXAxisAdditionalLabel.js.map
|
package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatXAxisAdditionalLabel.js","names":["formatXAxisAdditionalLabel","value","isGreaterThanTwoWeeks","date","Date","isNaN","getTime","concat","toLocaleDateString","undefined","month","day"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.ts"],"sourcesContent":["export const formatXAxisAdditionalLabel = (\n value: unknown,\n isGreaterThanTwoWeeks: boolean\n) => {\n const date = new Date(value as string);\n if (isNaN(date.getTime())) {\n return '';\n }\n return `${date.toLocaleDateString(undefined, {\n month: isGreaterThanTwoWeeks ? 'short' : 'long',\n day: isGreaterThanTwoWeeks ? 'numeric' : undefined,\n })}`;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,0BAA0B,GAAGA,CACxCC,KAAc,EACdC,qBAA8B,KAC3B;EACH,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAACH,KAAe,CAAC;EACtC,IAAII,KAAK,CAACF,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC,EAAE;IACzB,OAAO,EAAE;EACX;EACA,UAAAC,MAAA,CAAUJ,IAAI,CAACK,kBAAkB,CAACC,SAAS,EAAE;IAC3CC,KAAK,EAAER,qBAAqB,GAAG,OAAO,GAAG,MAAM;IAC/CS,GAAG,EAAET,qBAAqB,GAAG,SAAS,GAAGO;EAC3C,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CHART_CONFIG } from '../../../constants';
|
|
2
|
+
export const formatXAxisLabel = (value, isGreaterThanTwoWeeks) => {
|
|
3
|
+
const date = new Date(value);
|
|
4
|
+
return isGreaterThanTwoWeeks ? "".concat(date.toLocaleTimeString(undefined, {
|
|
5
|
+
hour: '2-digit',
|
|
6
|
+
minute: '2-digit'
|
|
7
|
+
})) : "".concat(CHART_CONFIG.X_AXIS_DATE_PADDING).concat(date.toLocaleDateString(undefined, {
|
|
8
|
+
day: 'numeric'
|
|
9
|
+
})).concat(CHART_CONFIG.X_AXIS_DATE_PADDING);
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=formatXAxisLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatXAxisLabel.js","names":["CHART_CONFIG","formatXAxisLabel","value","isGreaterThanTwoWeeks","date","Date","concat","toLocaleTimeString","undefined","hour","minute","X_AXIS_DATE_PADDING","toLocaleDateString","day"],"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,SAASA,YAAY,QAAQ,oBAAoB;AAEjD,OAAO,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,CACCN,YAAY,CAACW,mBAAmB,EAAAL,MAAA,CAAGF,IAAI,CAACQ,kBAAkB,CAACJ,SAAS,EAAE;IACvEK,GAAG,EAAE;EACP,CAAC,CAAC,EAAAP,MAAA,CAAGN,YAAY,CAACW,mBAAmB,CAAE;AAC7C,CAAC","ignoreList":[]}
|
|
@@ -2,19 +2,19 @@ import { colorPalette } from '@oanda/labs-widget-common';
|
|
|
2
2
|
export const getChartStyles = isDark => {
|
|
3
3
|
const sentimentLongColor = isDark ? colorPalette.darkBlue90 : colorPalette.lightBlue90;
|
|
4
4
|
const sentimentShortColor = isDark ? colorPalette.darkYellow90 : colorPalette.lightYellow90;
|
|
5
|
+
const sentimentOutlineColor = isDark ? colorPalette.black : colorPalette.white;
|
|
6
|
+
const sentimentOutlineWidth = isDark ? 3 : 2;
|
|
5
7
|
const candleLongColor = isDark ? colorPalette.bottleGreenDark : colorPalette.bottleGreenLight;
|
|
6
8
|
const candleShortColor = isDark ? colorPalette.orange : colorPalette.raspberryLight;
|
|
7
|
-
const sentimentAreaOpacity = isDark ? 0.5 : 0.2;
|
|
8
9
|
const tooltipLinesColor = isDark ? colorPalette.orange : colorPalette.bottleGreenLight;
|
|
9
|
-
const sentimentLabelColor = isDark ? colorPalette.white : colorPalette.black;
|
|
10
10
|
return {
|
|
11
11
|
sentimentLongColor,
|
|
12
12
|
sentimentShortColor,
|
|
13
|
+
sentimentOutlineColor,
|
|
13
14
|
candleLongColor,
|
|
14
15
|
candleShortColor,
|
|
15
|
-
sentimentAreaOpacity,
|
|
16
16
|
tooltipLinesColor,
|
|
17
|
-
|
|
17
|
+
sentimentOutlineWidth
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
//# sourceMappingURL=getChartStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getChartStyles.js","names":["colorPalette","getChartStyles","isDark","sentimentLongColor","darkBlue90","lightBlue90","sentimentShortColor","darkYellow90","lightYellow90","sentimentOutlineColor","black","white","sentimentOutlineWidth","candleLongColor","bottleGreenDark","bottleGreenLight","candleShortColor","orange","raspberryLight","tooltipLinesColor"],"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,SAASA,YAAY,QAAQ,2BAA2B;AAYxD,OAAO,MAAMC,cAAc,GAAIC,MAAe,IAAkB;EAC9D,MAAMC,kBAAkB,GAAGD,MAAM,GAC7BF,YAAY,CAACI,UAAU,GACvBJ,YAAY,CAACK,WAAW;EAC5B,MAAMC,mBAAmB,GAAGJ,MAAM,GAC9BF,YAAY,CAACO,YAAY,GACzBP,YAAY,CAACQ,aAAa;EAE9B,MAAMC,qBAAqB,GAAGP,MAAM,GAChCF,YAAY,CAACU,KAAK,GAClBV,YAAY,CAACW,KAAK;EACtB,MAAMC,qBAAqB,GAAGV,MAAM,GAAG,CAAC,GAAG,CAAC;EAE5C,MAAMW,eAAe,GAAGX,MAAM,GAC1BF,YAAY,CAACc,eAAe,GAC5Bd,YAAY,CAACe,gBAAgB;EACjC,MAAMC,gBAAgB,GAAGd,MAAM,GAC3BF,YAAY,CAACiB,MAAM,GACnBjB,YAAY,CAACkB,cAAc;EAC/B,MAAMC,iBAAiB,GAAGjB,MAAM,GAC5BF,YAAY,CAACiB,MAAM,GACnBjB,YAAY,CAACe,gBAAgB;EAEjC,OAAO;IACLZ,kBAAkB;IAClBG,mBAAmB;IACnBG,qBAAqB;IACrBI,eAAe;IACfG,gBAAgB;IAChBG,iBAAiB;IACjBP;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import chroma from 'chroma-js';
|
|
2
|
+
export const getGradientColor = (value, startColor, targetColor, minThreshold, maxThreshold) => {
|
|
3
|
+
const colorScale = chroma.scale([startColor, targetColor]).domain([minThreshold, maxThreshold]).mode('rgb');
|
|
4
|
+
return colorScale(value).hex();
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=getGradientColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getGradientColor.js","names":["chroma","getGradientColor","value","startColor","targetColor","minThreshold","maxThreshold","colorScale","scale","domain","mode","hex"],"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,OAAOA,MAAM,MAAM,WAAW;AAE9B,OAAO,MAAMC,gBAAgB,GAAGA,CAC9BC,KAAa,EACbC,UAAkB,EAClBC,WAAmB,EACnBC,YAAoB,EACpBC,YAAoB,KACT;EACX,MAAMC,UAAU,GAAGP,MAAM,CACtBQ,KAAK,CAAC,CAACL,UAAU,EAAEC,WAAW,CAAC,CAAC,CAChCK,MAAM,CAAC,CAACJ,YAAY,EAAEC,YAAY,CAAC,CAAC,CACpCI,IAAI,CAAC,KAAK,CAAC;EAEd,OAAOH,UAAU,CAACL,KAAK,CAAC,CAACS,GAAG,CAAC,CAAC;AAChC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const getLabelData = _ref => {
|
|
2
|
+
let {
|
|
3
|
+
dates,
|
|
4
|
+
isGreaterThanTwoWeeks
|
|
5
|
+
} = _ref;
|
|
6
|
+
return dates.filter((record, index, arr) => {
|
|
7
|
+
if (index === 0) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const previousTimestamp = arr[index - 1];
|
|
11
|
+
const currentDate = new Date(record);
|
|
12
|
+
const previousDate = new Date(previousTimestamp);
|
|
13
|
+
return isGreaterThanTwoWeeks ? currentDate.getDate() !== previousDate.getDate() : currentDate.getMonth() !== previousDate.getMonth();
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//# 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"],"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":"AAEA,OAAO,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","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { COLOR_MAP } from '../../../constants';
|
|
2
|
+
import { getGradientColor } from './getGradientColor';
|
|
3
|
+
export const getRectColor = (sentiment, isDark, minThreshold, maxThreshold) => {
|
|
4
|
+
const colorPalette = isDark ? COLOR_MAP.dark : COLOR_MAP.light;
|
|
5
|
+
return sentiment < 0 ? getGradientColor(sentiment * -1, colorPalette.short[0], colorPalette.short[1], minThreshold, maxThreshold) : getGradientColor(sentiment, colorPalette.long[0], colorPalette.long[1], minThreshold, maxThreshold);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=getRectColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRectColor.js","names":["COLOR_MAP","getGradientColor","getRectColor","sentiment","isDark","minThreshold","maxThreshold","colorPalette","dark","light","short","long"],"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,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,OAAO,MAAMC,YAAY,GAAGA,CAC1BC,SAAiB,EACjBC,MAAe,EACfC,YAAoB,EACpBC,YAAoB,KACjB;EACH,MAAMC,YAAY,GAAGH,MAAM,GAAGJ,SAAS,CAACQ,IAAI,GAAGR,SAAS,CAACS,KAAK;EAE9D,OAAON,SAAS,GAAG,CAAC,GAChBF,gBAAgB,CACdE,SAAS,GAAG,CAAC,CAAC,EACdI,YAAY,CAACG,KAAK,CAAC,CAAC,CAAC,EACrBH,YAAY,CAACG,KAAK,CAAC,CAAC,CAAC,EACrBL,YAAY,EACZC,YACF,CAAC,GACDL,gBAAgB,CACdE,SAAS,EACTI,YAAY,CAACI,IAAI,CAAC,CAAC,CAAC,EACpBJ,YAAY,CAACI,IAAI,CAAC,CAAC,CAAC,EACpBN,YAAY,EACZC,YACF,CAAC;AACP,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { BookType } from '../../../../gql/types/graphql';
|
|
2
|
+
const DATE_FORMAT_OPTIONS = {
|
|
3
|
+
hour: '2-digit',
|
|
4
|
+
minute: '2-digit',
|
|
5
|
+
year: 'numeric',
|
|
6
|
+
day: 'numeric',
|
|
7
|
+
month: 'numeric',
|
|
8
|
+
timeZoneName: 'short'
|
|
9
|
+
};
|
|
10
|
+
const SENTIMENT_DISPLAY_PRECISION = 2;
|
|
11
|
+
const calculateBucketDisplayPrecision = bucketWidth => {
|
|
12
|
+
var _bucketWidth$toString;
|
|
13
|
+
return ((_bucketWidth$toString = bucketWidth.toString().split('.')[1]) === null || _bucketWidth$toString === void 0 ? void 0 : _bucketWidth$toString.length) || 0;
|
|
14
|
+
};
|
|
15
|
+
const findSeriesParam = (params, seriesId) => {
|
|
16
|
+
return params.find(series => series.seriesId === seriesId);
|
|
17
|
+
};
|
|
18
|
+
const findSentimentSeriesParam = (params, sentimentLongs, sentimentShorts) => {
|
|
19
|
+
var _sentimentLongs$index, _sentimentShorts$inde;
|
|
20
|
+
const index = params[0].dataIndex;
|
|
21
|
+
return {
|
|
22
|
+
sentimentLong: (_sentimentLongs$index = sentimentLongs[index]) !== null && _sentimentLongs$index !== void 0 ? _sentimentLongs$index : null,
|
|
23
|
+
sentimentShort: (_sentimentShorts$inde = sentimentShorts[index]) !== null && _sentimentShorts$inde !== void 0 ? _sentimentShorts$inde : null
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const getSentimentOverbalanceLabel = (sentiment, bookType) => {
|
|
27
|
+
if (sentiment < 0) {
|
|
28
|
+
return bookType === BookType.Order ? 'sell_overbalance' : 'short_overbalance';
|
|
29
|
+
}
|
|
30
|
+
return bookType === BookType.Order ? 'buy_overbalance' : 'long_overbalance';
|
|
31
|
+
};
|
|
32
|
+
const formatCandleData = (candleData, labelCallback) => {
|
|
33
|
+
const [, open, close, low, high] = candleData;
|
|
34
|
+
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");
|
|
35
|
+
};
|
|
36
|
+
const formatBookData = _ref => {
|
|
37
|
+
let {
|
|
38
|
+
matchedBucket,
|
|
39
|
+
bucketWidth,
|
|
40
|
+
bucketDisplayPrecision,
|
|
41
|
+
bookType,
|
|
42
|
+
labelCallback
|
|
43
|
+
} = _ref;
|
|
44
|
+
const bookLabelKey = bookType === BookType.Order ? 'orders' : 'positions';
|
|
45
|
+
const priceRangeStart = matchedBucket.price.toFixed(bucketDisplayPrecision);
|
|
46
|
+
const priceRangeEnd = (matchedBucket.price + bucketWidth).toFixed(bucketDisplayPrecision);
|
|
47
|
+
const sentimentLabel = getSentimentOverbalanceLabel(matchedBucket.sentiment, bookType);
|
|
48
|
+
const sentimentValue = Math.abs(matchedBucket.sentiment).toFixed(bucketDisplayPrecision);
|
|
49
|
+
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>");
|
|
50
|
+
};
|
|
51
|
+
const formatSentimentData = (sentimentLong, sentimentShort, labelCallback) => {
|
|
52
|
+
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>");
|
|
53
|
+
};
|
|
54
|
+
const hasValidCandleData = candleData => !!candleData[1] && !!candleData[2] && !!candleData[3] && !!candleData[4];
|
|
55
|
+
const hasValidSentimentData = (sentimentLong, sentimentShort) => sentimentLong !== null && sentimentShort !== null;
|
|
56
|
+
const findMatchingBucket = (buckets, bucketsIndex, selectedPrice, bucketWidth) => {
|
|
57
|
+
if (bucketsIndex === undefined) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
const selectedBuckets = buckets[bucketsIndex];
|
|
61
|
+
return selectedBuckets === null || selectedBuckets === void 0 ? void 0 : selectedBuckets.find(_ref2 => {
|
|
62
|
+
let {
|
|
63
|
+
price
|
|
64
|
+
} = _ref2;
|
|
65
|
+
return selectedPrice >= price && selectedPrice < price + bucketWidth;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
export const getTooltipFormatter = _ref3 => {
|
|
69
|
+
let {
|
|
70
|
+
params,
|
|
71
|
+
buckets,
|
|
72
|
+
bucketWidth,
|
|
73
|
+
selectedPrice,
|
|
74
|
+
bookType,
|
|
75
|
+
labelCallback,
|
|
76
|
+
sentimentLongs,
|
|
77
|
+
sentimentShorts
|
|
78
|
+
} = _ref3;
|
|
79
|
+
if (!params || !Array.isArray(params) || params.length === 0) {
|
|
80
|
+
return '';
|
|
81
|
+
}
|
|
82
|
+
const candleParam = findSeriesParam(params, 'candlestick');
|
|
83
|
+
const booksParam = findSeriesParam(params, 'heatmap');
|
|
84
|
+
const {
|
|
85
|
+
sentimentLong,
|
|
86
|
+
sentimentShort
|
|
87
|
+
} = findSentimentSeriesParam(params, sentimentLongs, sentimentShorts);
|
|
88
|
+
if (!candleParam) {
|
|
89
|
+
return '';
|
|
90
|
+
}
|
|
91
|
+
const bucketDisplayPrecision = calculateBucketDisplayPrecision(bucketWidth);
|
|
92
|
+
const time = new Date(candleParam.axisValue);
|
|
93
|
+
const candleData = candleParam.value;
|
|
94
|
+
const bucketsIndex = booksParam === null || booksParam === void 0 ? void 0 : booksParam.value[2];
|
|
95
|
+
const matchedBucket = findMatchingBucket(buckets, bucketsIndex, selectedPrice, bucketWidth);
|
|
96
|
+
const showCandles = hasValidCandleData(candleData);
|
|
97
|
+
const showSentiment = hasValidSentimentData(sentimentLong, sentimentShort);
|
|
98
|
+
if (!showCandles && !matchedBucket) {
|
|
99
|
+
return '';
|
|
100
|
+
}
|
|
101
|
+
const timeFormatted = time.toLocaleString(undefined, DATE_FORMAT_OPTIONS);
|
|
102
|
+
const candleSection = showCandles ? formatCandleData(candleData, labelCallback) : '';
|
|
103
|
+
const bookSection = matchedBucket ? formatBookData({
|
|
104
|
+
matchedBucket,
|
|
105
|
+
bucketWidth,
|
|
106
|
+
bucketDisplayPrecision,
|
|
107
|
+
bookType,
|
|
108
|
+
labelCallback
|
|
109
|
+
}) : '';
|
|
110
|
+
const sentimentSection = showSentiment && sentimentLong && sentimentShort ? formatSentimentData(sentimentLong, sentimentShort, labelCallback) : '';
|
|
111
|
+
return "<p>".concat(timeFormatted, "</p><br />\n").concat(candleSection, "\n").concat(bookSection, "\n").concat(sentimentSection);
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=getTooltipFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTooltipFormatter.js","names":["BookType","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","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"],"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,SAASA,QAAQ,QAAQ,+BAA+B;AAGxD,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,M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GACjE,EAAE;EAER,aAAAK,MAAA,CAAaoC,aAAa,kBAAApC,MAAA,CAC1BsC,aAAa,QAAAtC,MAAA,CACbuC,WAAW,QAAAvC,MAAA,CACXwC,gBAAgB;AAClB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { formatXAxisAdditionalLabel } from './formatXAxisAdditionalLabel';
|
|
2
|
+
import { formatXAxisLabel } from './formatXAxisLabel';
|
|
3
|
+
import { getLabelData } from './getLabelData';
|
|
4
|
+
import { isDifferenceGreaterThanTwoWeeks } from './isDifferenceGreaterThanTwoWeeks';
|
|
5
|
+
export const handleLabelUpdate = (instance, mainData, labelTimerRef, isGreaterThanTwoWeeksRef) => {
|
|
6
|
+
if (labelTimerRef.current) {
|
|
7
|
+
clearTimeout(labelTimerRef.current);
|
|
8
|
+
}
|
|
9
|
+
labelTimerRef.current = setTimeout(() => {
|
|
10
|
+
var _isGreaterThanTwoWeek;
|
|
11
|
+
const {
|
|
12
|
+
dates
|
|
13
|
+
} = mainData;
|
|
14
|
+
const {
|
|
15
|
+
dataZoom
|
|
16
|
+
} = instance.getOption();
|
|
17
|
+
if (!Array.isArray(dataZoom) || dataZoom.length === 0 || !dataZoom[0] || typeof dataZoom[0].startValue !== 'number' || typeof dataZoom[0].endValue !== 'number') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const {
|
|
21
|
+
startValue,
|
|
22
|
+
endValue
|
|
23
|
+
} = dataZoom[0];
|
|
24
|
+
if (!dates[startValue] || !dates[endValue]) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(dates[startValue], dates[endValue]);
|
|
28
|
+
const wasGreaterThanTwoWeeks = (_isGreaterThanTwoWeek = isGreaterThanTwoWeeksRef.current) !== null && _isGreaterThanTwoWeek !== void 0 ? _isGreaterThanTwoWeek : false;
|
|
29
|
+
if (isGreaterThanTwoWeeks !== wasGreaterThanTwoWeeks) {
|
|
30
|
+
const labelsData = getLabelData({
|
|
31
|
+
dates,
|
|
32
|
+
isGreaterThanTwoWeeks
|
|
33
|
+
});
|
|
34
|
+
instance.setOption({
|
|
35
|
+
xAxis: [{
|
|
36
|
+
id: 'main-xAxis',
|
|
37
|
+
axisLabel: {
|
|
38
|
+
formatter: value => formatXAxisLabel(value, isGreaterThanTwoWeeks)
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
id: 'additional-xAxis',
|
|
42
|
+
axisLabel: {
|
|
43
|
+
customValues: labelsData,
|
|
44
|
+
formatter: value => formatXAxisAdditionalLabel(value, isGreaterThanTwoWeeks)
|
|
45
|
+
}
|
|
46
|
+
}]
|
|
47
|
+
});
|
|
48
|
+
isGreaterThanTwoWeeksRef.current = isGreaterThanTwoWeeks;
|
|
49
|
+
}
|
|
50
|
+
}, 50);
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=handleLabelUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleLabelUpdate.js","names":["formatXAxisAdditionalLabel","formatXAxisLabel","getLabelData","isDifferenceGreaterThanTwoWeeks","handleLabelUpdate","instance","mainData","labelTimerRef","isGreaterThanTwoWeeksRef","current","clearTimeout","setTimeout","_isGreaterThanTwoWeek","dates","dataZoom","getOption","Array","isArray","length","startValue","endValue","isGreaterThanTwoWeeks","wasGreaterThanTwoWeeks","labelsData","setOption","xAxis","id","axisLabel","formatter","value","customValues"],"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,SAASA,0BAA0B,QAAQ,8BAA8B;AACzE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,+BAA+B,QAAQ,mCAAmC;AAEnF,OAAO,MAAMC,iBAAiB,GAAGA,CAC/BC,QAAqB,EACrBC,QAAgC,EAChCC,aAAsD,EACtDC,wBAA0D,KACjD;EACT,IAA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F,CAAC,EACD;UACEK,EAAE,EAAE,kBAAkB;UACtBC,SAAS,EAAE;YACTG,YAAY,EAAEP,UAAU;YACxBK,SAAS,EAAGC,KAAc,IACxB7B,0BAA0B,CAAC6B,KAAK,EAAER,qBAAqB;UAC3D;QACF,CAAC;MAEL,CAAC,CAAC;MAEFb,wBAAwB,CAACC,OAAO,GAAGY,qBAAqB;IAC1D;EACF,CAAC,EAAE,EAAE,CAAC;AACR,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const handleTooltipUpdate = (instance, zoomTimerRef, tooltipVisibleRef, canHover) => {
|
|
2
|
+
if (!canHover) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
if (tooltipVisibleRef.current) {
|
|
6
|
+
instance.setOption({
|
|
7
|
+
tooltip: {
|
|
8
|
+
show: false
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
tooltipVisibleRef.current = false;
|
|
12
|
+
}
|
|
13
|
+
if (zoomTimerRef.current) {
|
|
14
|
+
clearTimeout(zoomTimerRef.current);
|
|
15
|
+
}
|
|
16
|
+
zoomTimerRef.current = setTimeout(() => {
|
|
17
|
+
if (!tooltipVisibleRef.current) {
|
|
18
|
+
instance.setOption({
|
|
19
|
+
tooltip: {
|
|
20
|
+
show: true
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
tooltipVisibleRef.current = true;
|
|
24
|
+
}
|
|
25
|
+
}, 100);
|
|
26
|
+
};
|
|
27
|
+
//# 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"],"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":"AAGA,OAAO,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","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
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';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"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,cAAc,8BAA8B;AAC5C,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,oBAAoB;AAClC,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB;AAC9B,cAAc,uBAAuB;AACrC,cAAc,qBAAqB;AACnC,cAAc,uBAAuB;AACrC,cAAc,mCAAmC","ignoreList":[]}
|
package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TIME_THRESHOLDS } from '../../../constants';
|
|
2
|
+
export const isDifferenceGreaterThanTwoWeeks = (startDate, endDate) => {
|
|
3
|
+
const date1 = new Date(startDate);
|
|
4
|
+
const date2 = new Date(endDate);
|
|
5
|
+
const differenceInMs = Math.abs(date2.getTime() - date1.getTime());
|
|
6
|
+
return differenceInMs < TIME_THRESHOLDS.TWO_WEEKS_MS;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=isDifferenceGreaterThanTwoWeeks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDifferenceGreaterThanTwoWeeks.js","names":["TIME_THRESHOLDS","isDifferenceGreaterThanTwoWeeks","startDate","endDate","date1","Date","date2","differenceInMs","Math","abs","getTime","TWO_WEEKS_MS"],"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,SAASA,eAAe,QAAQ,oBAAoB;AAEpD,OAAO,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,GAAGP,eAAe,CAACW,YAAY;AACtD,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Division } from '
|
|
2
|
-
import { instrumentSelectConfig, instrumentSelectConfigOC } from '
|
|
1
|
+
import { Division } from '../../../../gql/types/graphql';
|
|
2
|
+
import { instrumentSelectConfig, instrumentSelectConfigOC } from '../../../selectConfig';
|
|
3
3
|
export const getInstrumentConfigForDivision = division => {
|
|
4
4
|
return division === Division.Oc ? instrumentSelectConfigOC : instrumentSelectConfig;
|
|
5
5
|
};
|
|
6
|
-
//# sourceMappingURL=
|
|
6
|
+
//# sourceMappingURL=getInstrumentConfigForDivision.js.map
|
package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInstrumentConfigForDivision.js","names":["Division","instrumentSelectConfig","instrumentSelectConfigOC","getInstrumentConfigForDivision","division","Oc"],"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,SAASA,QAAQ,QAAQ,+BAA+B;AACxD,SACEC,sBAAsB,EACtBC,wBAAwB,QACnB,uBAAuB;AAE9B,OAAO,MAAMC,8BAA8B,GAAIC,QAAkB,IAAK;EACpE,OAAOA,QAAQ,KAAKJ,QAAQ,CAACK,EAAE,GAC3BH,wBAAwB,GACxBD,sBAAsB;AAC5B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Granularity } from '../../../../gql/types/graphql';
|
|
2
|
+
import { BUCKET_CONFIG } from '../../../constants';
|
|
3
|
+
export const getMultiplayerForTimeSpan = granularity => {
|
|
4
|
+
const timeSpanMultiplierMap = {
|
|
5
|
+
[Granularity.M5]: BUCKET_CONFIG.MULTIPLIER_5M,
|
|
6
|
+
[Granularity.M15]: BUCKET_CONFIG.MULTIPLIER_15M,
|
|
7
|
+
[Granularity.H1]: BUCKET_CONFIG.MULTIPLIER_1H,
|
|
8
|
+
[Granularity.H4]: BUCKET_CONFIG.MULTIPLIER_4H
|
|
9
|
+
};
|
|
10
|
+
return timeSpanMultiplierMap[granularity] || BUCKET_CONFIG.MULTIPLIER_5M;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=getMultiplayerForTimeSpan.js.map
|
package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMultiplayerForTimeSpan.js","names":["Granularity","BUCKET_CONFIG","getMultiplayerForTimeSpan","granularity","timeSpanMultiplierMap","M5","MULTIPLIER_5M","M15","MULTIPLIER_15M","H1","MULTIPLIER_1H","H4","MULTIPLIER_4H"],"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,SAASA,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,aAAa,QAAQ,oBAAoB;AAElD,OAAO,MAAMC,yBAAyB,GAAIC,WAAwB,IAAa;EAC7E,MAAMC,qBAAkD,GAAG;IACzD,CAACJ,WAAW,CAACK,EAAE,GAAGJ,aAAa,CAACK,aAAa;IAC7C,CAACN,WAAW,CAACO,GAAG,GAAGN,aAAa,CAACO,cAAc;IAC/C,CAACR,WAAW,CAACS,EAAE,GAAGR,aAAa,CAACS,aAAa;IAC7C,CAACV,WAAW,CAACW,EAAE,GAAGV,aAAa,CAACW;EAClC,CAAC;EAED,OAAOR,qBAAqB,CAACD,WAAW,CAAC,IAAIF,aAAa,CAACK,aAAa;AAC1E,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Granularity, TimeSpan } from '../../../../gql/types/graphql';
|
|
2
|
+
export const getTimeSpanForGranularity = granularity => {
|
|
3
|
+
const granularityTimeSpanMap = {
|
|
4
|
+
[Granularity.M5]: TimeSpan.TwoDays,
|
|
5
|
+
[Granularity.M15]: TimeSpan.FiveDays,
|
|
6
|
+
[Granularity.H1]: TimeSpan.TwentyDays,
|
|
7
|
+
[Granularity.H4]: TimeSpan.NinetyDays
|
|
8
|
+
};
|
|
9
|
+
return granularityTimeSpanMap[granularity] || TimeSpan.TwoDays;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=getTimeSpanForGranularity.js.map
|
package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTimeSpanForGranularity.js","names":["Granularity","TimeSpan","getTimeSpanForGranularity","granularity","granularityTimeSpanMap","M5","TwoDays","M15","FiveDays","H1","TwentyDays","H4","NinetyDays"],"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,SAASA,WAAW,EAAEC,QAAQ,QAAQ,+BAA+B;AAErE,OAAO,MAAMC,yBAAyB,GACpCC,WAAwB,IACX;EACb,MAAMC,sBAAqD,GAAG;IAC5D,CAACJ,WAAW,CAACK,EAAE,GAAGJ,QAAQ,CAACK,OAAO;IAClC,CAACN,WAAW,CAACO,GAAG,GAAGN,QAAQ,CAACO,QAAQ;IACpC,CAACR,WAAW,CAACS,EAAE,GAAGR,QAAQ,CAACS,UAAU;IACrC,CAACV,WAAW,CAACW,EAAE,GAAGV,QAAQ,CAACW;EAC7B,CAAC;EAED,OAAOR,sBAAsB,CAACD,WAAW,CAAC,IAAIF,QAAQ,CAACK,OAAO;AAChE,CAAC","ignoreList":[]}
|