@oanda/labs-crowd-view-widget 1.0.52 → 1.0.54
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 +436 -0
- package/dist/main/CrowdViewWidget/Main.js +4 -6
- package/dist/main/CrowdViewWidget/Main.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +18 -31
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +7 -5
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +18 -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 +5 -52
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +54 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +65 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +60 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +53 -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 +42 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +75 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js +116 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.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 +42 -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 +108 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js +83 -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/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 +8 -41
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js +65 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js +65 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js +43 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +8 -2
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +103 -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 +53 -30
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js +15 -13
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +5 -16
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/main/CrowdViewWidget/constants.js +12 -18
- package/dist/main/CrowdViewWidget/constants.js.map +1 -1
- package/dist/main/gql/getOrderPositionBooks.js +1 -1
- package/dist/main/gql/getOrderPositionBooks.js.map +1 -1
- package/dist/main/gql/getPriceCandles.js +1 -1
- package/dist/main/gql/getPriceCandles.js.map +1 -1
- package/dist/main/gql/types/gql.js +2 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +111 -18
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/translations/sources/en.json +2 -1
- package/dist/module/CrowdViewWidget/Main.js +3 -5
- package/dist/module/CrowdViewWidget/Main.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +20 -33
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +7 -5
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +11 -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 +5 -52
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +46 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +58 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +53 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +46 -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 +35 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +68 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.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 +35 -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 +101 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +8 -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/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 +7 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js +58 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js +58 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js +36 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +8 -2
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +96 -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 +50 -27
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js +15 -13
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +5 -16
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/module/CrowdViewWidget/constants.js +10 -17
- package/dist/module/CrowdViewWidget/constants.js.map +1 -1
- package/dist/module/gql/getOrderPositionBooks.js +1 -1
- package/dist/module/gql/getOrderPositionBooks.js.map +1 -1
- package/dist/module/gql/getPriceCandles.js +1 -1
- package/dist/module/gql/getPriceCandles.js.map +1 -1
- package/dist/module/gql/types/gql.js +2 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +111 -18
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/translations/sources/en.json +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridLines.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +9 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts +11 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts +7 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +16 -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 +9 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/index.d.ts +10 -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 +17 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getRectColor.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +10 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/index.d.ts +7 -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/getTimeSpanForGranularity.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/index.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.d.ts +11 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.d.ts +12 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/processSentiments.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/index.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +28 -11
- 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 +4 -12
- package/dist/types/gql/types/gql.d.ts +6 -4
- package/dist/types/gql/types/graphql.d.ts +30 -11
- package/package.json +3 -3
- package/src/CrowdViewWidget/Main.tsx +3 -4
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +25 -40
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +8 -4
- package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +29 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +84 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +52 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts +82 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts +63 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +63 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.ts +32 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +43 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +77 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +10 -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 +42 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts +27 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +183 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +7 -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/getTimeSpanForGranularity.ts +14 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/index.ts +6 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.ts +92 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.ts +67 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/processSentiments.ts +55 -0
- package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.ts +10 -2
- package/src/CrowdViewWidget/components/Chart/getOption.ts +114 -0
- package/src/CrowdViewWidget/components/Chart/index.ts +1 -1
- package/src/CrowdViewWidget/components/Chart/types.ts +30 -19
- package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +84 -67
- package/src/CrowdViewWidget/components/Legend/Legend.tsx +24 -23
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +13 -26
- package/src/CrowdViewWidget/constants.ts +21 -23
- package/src/gql/getOrderPositionBooks.ts +13 -5
- package/src/gql/getPriceCandles.ts +1 -0
- package/src/gql/types/gql.ts +6 -6
- package/src/gql/types/graphql.ts +98 -16
- package/src/translations/sources/en.json +2 -1
- package/test/components/Chart/utils/chartUtils.test.ts +39 -21
- package/test/components/Chart/utils/getChartStyles.test.ts +10 -10
- package/test/components/Chart/utils/processSentiments.test.ts +138 -30
- package/test/components/Legend.test.tsx +13 -21
- package/test/components/LegendBar.test.tsx +31 -51
- package/test/utils/instrumentUtils.test.ts +1 -1
- package/test/utils/processOrderPositionBooks.test.ts +201 -84
- package/test/utils/processPriceCandles.test.ts +93 -67
- package/test/utils/validateData.test.ts +136 -38
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js +0 -359
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js +0 -37
- package/dist/main/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -127
- 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/getTargetBucketWidth.js +0 -14
- package/dist/main/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processBuckets.js +0 -29
- package/dist/main/CrowdViewWidget/components/Chart/utils/processBuckets.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js +0 -23
- package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js +0 -43
- package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js +0 -28
- 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 -351
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js +0 -29
- package/dist/module/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -114
- 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/getTargetBucketWidth.js +0 -7
- package/dist/module/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js +0 -10
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processBuckets.js +0 -22
- package/dist/module/CrowdViewWidget/components/Chart/utils/processBuckets.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js +0 -16
- package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js +0 -36
- package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js +0 -21
- 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/aggregateBuckets.d.ts +0 -2
- package/dist/types/CrowdViewWidget/components/Chart/utils/chartUtils.d.ts +0 -31
- package/dist/types/CrowdViewWidget/components/Chart/utils/getGridLines.d.ts +0 -97
- package/dist/types/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.d.ts +0 -3
- package/dist/types/CrowdViewWidget/components/Chart/utils/index.d.ts +0 -9
- package/dist/types/CrowdViewWidget/components/Chart/utils/processBuckets.d.ts +0 -3
- package/dist/types/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.d.ts +0 -8
- package/dist/types/CrowdViewWidget/components/Chart/utils/processPriceCandles.d.ts +0 -27
- package/dist/types/CrowdViewWidget/components/Chart/utils/processSentiments.d.ts +0 -3
- package/src/CrowdViewWidget/components/Chart/chartOptions.ts +0 -401
- package/src/CrowdViewWidget/components/Chart/utils/aggregateBuckets.ts +0 -44
- package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +0 -216
- package/src/CrowdViewWidget/components/Chart/utils/getGridLines.ts +0 -148
- package/src/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.ts +0 -13
- package/src/CrowdViewWidget/components/Chart/utils/index.ts +0 -9
- package/src/CrowdViewWidget/components/Chart/utils/processBuckets.ts +0 -43
- package/src/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.ts +0 -30
- package/src/CrowdViewWidget/components/Chart/utils/processPriceCandles.ts +0 -53
- package/src/CrowdViewWidget/components/Chart/utils/processSentiments.ts +0 -42
- package/test/utils/aggregateBuckets.test.ts +0 -82
- package/test/utils/getTargetBucketWidth.test.ts +0 -37
- package/test/utils/processBuckets.test.ts +0 -153
- /package/dist/types/CrowdViewWidget/components/Chart/{chartOptions.d.ts → getOption.d.ts} +0 -0
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getOption = void 0;
|
|
7
|
-
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
8
|
-
var _constants = require("../../constants");
|
|
9
|
-
var _chartUtils = require("./utils/chartUtils");
|
|
10
|
-
var _getChartStyles = require("./utils/getChartStyles");
|
|
11
|
-
var _getGridLines = require("./utils/getGridLines");
|
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
14
|
-
let {
|
|
15
|
-
xAxisData,
|
|
16
|
-
candlesSeriesData,
|
|
17
|
-
orderPositionBooks,
|
|
18
|
-
bucketWidth,
|
|
19
|
-
buckets,
|
|
20
|
-
precision,
|
|
21
|
-
bookType,
|
|
22
|
-
sentiments
|
|
23
|
-
} = _ref;
|
|
24
|
-
let selectedPrice;
|
|
25
|
-
const {
|
|
26
|
-
sentimentLongColor,
|
|
27
|
-
sentimentShortColor,
|
|
28
|
-
candleLongColor,
|
|
29
|
-
candleShortColor,
|
|
30
|
-
sentimentAreaOpacity,
|
|
31
|
-
tooltipLinesColor,
|
|
32
|
-
sentimentLabelColor
|
|
33
|
-
} = (0, _getChartStyles.getChartStyles)(isDark);
|
|
34
|
-
const visibleXAxisData = xAxisData.slice(xAxisData.length * _constants.CHART_CONFIG.INITIAL_START_ZOOM / 100, xAxisData.length * _constants.CHART_CONFIG.INITIAL_END_ZOOM / 100);
|
|
35
|
-
const isGreaterThanTwoWeeks = (0, _chartUtils.isDifferenceGreaterThanTwoWeeks)(visibleXAxisData[0], visibleXAxisData[visibleXAxisData.length - 1]);
|
|
36
|
-
const labelsData = (0, _chartUtils.getLabelData)({
|
|
37
|
-
xAxisData,
|
|
38
|
-
isGreaterThanTwoWeeks
|
|
39
|
-
});
|
|
40
|
-
const gridMainLines = (0, _getGridLines.getGridLines)({
|
|
41
|
-
isDark,
|
|
42
|
-
isDesktop
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
animation: false,
|
|
46
|
-
dataZoom: [{
|
|
47
|
-
id: 'main',
|
|
48
|
-
type: 'inside',
|
|
49
|
-
xAxisIndex: 0,
|
|
50
|
-
start: _constants.CHART_CONFIG.INITIAL_START_ZOOM,
|
|
51
|
-
end: _constants.CHART_CONFIG.INITIAL_END_ZOOM,
|
|
52
|
-
filterMode: 'filter'
|
|
53
|
-
}, {
|
|
54
|
-
id: 'sentiment',
|
|
55
|
-
type: 'inside',
|
|
56
|
-
xAxisIndex: 1,
|
|
57
|
-
start: _constants.CHART_CONFIG.INITIAL_START_ZOOM,
|
|
58
|
-
end: _constants.CHART_CONFIG.INITIAL_END_ZOOM,
|
|
59
|
-
filterMode: 'none'
|
|
60
|
-
}],
|
|
61
|
-
tooltip: {
|
|
62
|
-
trigger: 'axis',
|
|
63
|
-
axisPointer: {
|
|
64
|
-
type: 'cross',
|
|
65
|
-
axis: 'x',
|
|
66
|
-
lineStyle: {
|
|
67
|
-
color: tooltipLinesColor
|
|
68
|
-
},
|
|
69
|
-
crossStyle: {
|
|
70
|
-
color: tooltipLinesColor
|
|
71
|
-
},
|
|
72
|
-
label: {
|
|
73
|
-
padding: 0,
|
|
74
|
-
lineHeight: 24,
|
|
75
|
-
formatter: params => {
|
|
76
|
-
if (params.axisDimension === 'y' && params.axisIndex === 0) {
|
|
77
|
-
selectedPrice = Number(params.value);
|
|
78
|
-
return " ".concat(Number(params.value).toFixed(precision), " ");
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
confine: true,
|
|
85
|
-
formatter: params => (0, _chartUtils.getTooltipFormatter)({
|
|
86
|
-
params,
|
|
87
|
-
buckets,
|
|
88
|
-
bucketWidth,
|
|
89
|
-
selectedPrice,
|
|
90
|
-
labelCallback,
|
|
91
|
-
precision,
|
|
92
|
-
bookType
|
|
93
|
-
})
|
|
94
|
-
},
|
|
95
|
-
xAxis: [{
|
|
96
|
-
type: 'category',
|
|
97
|
-
name: 'xAxis-less-than-two-weeks',
|
|
98
|
-
nameTextStyle: {
|
|
99
|
-
fontSize: 0
|
|
100
|
-
},
|
|
101
|
-
id: 'main-xAxis',
|
|
102
|
-
data: xAxisData,
|
|
103
|
-
splitNumber: 1,
|
|
104
|
-
axisTick: {
|
|
105
|
-
show: false
|
|
106
|
-
},
|
|
107
|
-
axisLabel: {
|
|
108
|
-
padding: [8, 16, 8, 16],
|
|
109
|
-
margin: 0,
|
|
110
|
-
formatter: value => (0, _chartUtils.formatXAxisLabel)(value, isGreaterThanTwoWeeks)
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
type: 'category',
|
|
114
|
-
gridIndex: 1,
|
|
115
|
-
show: false,
|
|
116
|
-
data: xAxisData,
|
|
117
|
-
splitNumber: 1,
|
|
118
|
-
axisTick: {
|
|
119
|
-
show: false
|
|
120
|
-
},
|
|
121
|
-
axisLabel: {
|
|
122
|
-
show: false
|
|
123
|
-
}
|
|
124
|
-
}],
|
|
125
|
-
yAxis: [{
|
|
126
|
-
type: 'value',
|
|
127
|
-
gridIndex: 0,
|
|
128
|
-
position: 'right',
|
|
129
|
-
min: val => val.min - bucketWidth * 2,
|
|
130
|
-
max: val => val.max + bucketWidth * 2,
|
|
131
|
-
axisLine: {
|
|
132
|
-
show: false
|
|
133
|
-
},
|
|
134
|
-
axisTick: {
|
|
135
|
-
show: false
|
|
136
|
-
},
|
|
137
|
-
axisLabel: {
|
|
138
|
-
showMaxLabel: false,
|
|
139
|
-
showMinLabel: false,
|
|
140
|
-
margin: isDesktop ? 4 : 2,
|
|
141
|
-
formatter: value => value.toFixed(precision - 1)
|
|
142
|
-
}
|
|
143
|
-
}, {
|
|
144
|
-
type: 'value',
|
|
145
|
-
gridIndex: 1,
|
|
146
|
-
position: 'right',
|
|
147
|
-
min: _constants.CHART_CONFIG.SENTIMENT_MIN,
|
|
148
|
-
max: _constants.CHART_CONFIG.SENTIMENT_MAX,
|
|
149
|
-
interval: _constants.CHART_CONFIG.SENTIMENT_INTERVAL,
|
|
150
|
-
axisLine: {
|
|
151
|
-
show: false
|
|
152
|
-
},
|
|
153
|
-
axisTick: {
|
|
154
|
-
show: false
|
|
155
|
-
},
|
|
156
|
-
axisLabel: {
|
|
157
|
-
verticalAlignMaxLabel: 'top',
|
|
158
|
-
verticalAlignMinLabel: 'bottom',
|
|
159
|
-
lineHeight: 20,
|
|
160
|
-
margin: isDesktop ? 4 : 2,
|
|
161
|
-
rich: {
|
|
162
|
-
shortRect: {
|
|
163
|
-
backgroundColor: (0, _chromaJs.default)(sentimentShortColor).alpha(0.3).css(),
|
|
164
|
-
borderColor: sentimentShortColor,
|
|
165
|
-
borderWidth: 1,
|
|
166
|
-
width: 8,
|
|
167
|
-
height: 8
|
|
168
|
-
},
|
|
169
|
-
longRect: {
|
|
170
|
-
backgroundColor: (0, _chromaJs.default)(sentimentLongColor).alpha(0.3).css(),
|
|
171
|
-
borderColor: sentimentLongColor,
|
|
172
|
-
borderWidth: 1,
|
|
173
|
-
width: 8,
|
|
174
|
-
height: 8
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
formatter: value => {
|
|
178
|
-
if (value === _constants.CHART_CONFIG.SENTIMENT_MIN) {
|
|
179
|
-
return "{shortRect| } ".concat(labelCallback('short'));
|
|
180
|
-
}
|
|
181
|
-
if (value === _constants.CHART_CONFIG.SENTIMENT_MAX) {
|
|
182
|
-
return "{longRect| } ".concat(labelCallback('long'));
|
|
183
|
-
}
|
|
184
|
-
if (value === _constants.CHART_CONFIG.SENTIMENT_MAX / 2) {
|
|
185
|
-
return '50%';
|
|
186
|
-
}
|
|
187
|
-
return undefined;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}],
|
|
191
|
-
axisPointer: {
|
|
192
|
-
link: [{
|
|
193
|
-
xAxisIndex: 'all'
|
|
194
|
-
}]
|
|
195
|
-
},
|
|
196
|
-
visualMap: {
|
|
197
|
-
show: false,
|
|
198
|
-
seriesId: 'sentiment',
|
|
199
|
-
dimension: 1,
|
|
200
|
-
pieces: [{
|
|
201
|
-
lt: _constants.CHART_CONFIG.SENTIMENT_MAX / 2,
|
|
202
|
-
color: sentimentShortColor
|
|
203
|
-
}, {
|
|
204
|
-
gte: _constants.CHART_CONFIG.SENTIMENT_MAX / 2,
|
|
205
|
-
lte: _constants.CHART_CONFIG.SENTIMENT_MAX,
|
|
206
|
-
color: sentimentLongColor
|
|
207
|
-
}, {
|
|
208
|
-
gt: _constants.CHART_CONFIG.SENTIMENT_MAX,
|
|
209
|
-
color: sentimentLongColor
|
|
210
|
-
}]
|
|
211
|
-
},
|
|
212
|
-
series: [{
|
|
213
|
-
type: 'candlestick',
|
|
214
|
-
id: 'candlestick',
|
|
215
|
-
gridIndex: 0,
|
|
216
|
-
xAxisIndex: 0,
|
|
217
|
-
yAxisIndex: 0,
|
|
218
|
-
data: candlesSeriesData,
|
|
219
|
-
itemStyle: {
|
|
220
|
-
color: (0, _chromaJs.default)(candleShortColor).desaturate().css(),
|
|
221
|
-
color0: (0, _chromaJs.default)(candleLongColor).desaturate().css(),
|
|
222
|
-
borderColor: candleShortColor,
|
|
223
|
-
borderColor0: candleLongColor
|
|
224
|
-
},
|
|
225
|
-
emphasis: {
|
|
226
|
-
itemStyle: {
|
|
227
|
-
color: candleShortColor,
|
|
228
|
-
color0: candleLongColor
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
markPoint: {
|
|
232
|
-
symbol: 'circle',
|
|
233
|
-
symbolSize: 0,
|
|
234
|
-
data: labelsData
|
|
235
|
-
}
|
|
236
|
-
}, {
|
|
237
|
-
type: 'custom',
|
|
238
|
-
gridIndex: 0,
|
|
239
|
-
name: 'heatmap',
|
|
240
|
-
id: 'heatmap',
|
|
241
|
-
xAxisIndex: 0,
|
|
242
|
-
yAxisIndex: 0,
|
|
243
|
-
silent: true,
|
|
244
|
-
clip: true,
|
|
245
|
-
renderItem: (_params, api) => {
|
|
246
|
-
const xVal = api.value(0);
|
|
247
|
-
const bucketIndex = api.value(2);
|
|
248
|
-
const metaValues = buckets[bucketIndex];
|
|
249
|
-
const [rectWidth, rectHeight] = api.size([0, bucketWidth]);
|
|
250
|
-
const items = metaValues.map(_ref2 => {
|
|
251
|
-
let {
|
|
252
|
-
price,
|
|
253
|
-
sentiment
|
|
254
|
-
} = _ref2;
|
|
255
|
-
const start = api.coord([xVal, price]);
|
|
256
|
-
return {
|
|
257
|
-
type: 'rect',
|
|
258
|
-
shape: {
|
|
259
|
-
x: start[0] - rectWidth / 2,
|
|
260
|
-
y: start[1] - rectHeight,
|
|
261
|
-
width: rectWidth + 1,
|
|
262
|
-
height: rectHeight
|
|
263
|
-
},
|
|
264
|
-
style: {
|
|
265
|
-
fill: (0, _chartUtils.getRectColor)(sentiment, isDark)
|
|
266
|
-
},
|
|
267
|
-
silent: true,
|
|
268
|
-
emphasisDisabled: true
|
|
269
|
-
};
|
|
270
|
-
});
|
|
271
|
-
return {
|
|
272
|
-
type: 'group',
|
|
273
|
-
children: items,
|
|
274
|
-
silent: true,
|
|
275
|
-
emphasisDisabled: true
|
|
276
|
-
};
|
|
277
|
-
},
|
|
278
|
-
data: orderPositionBooks
|
|
279
|
-
}, {
|
|
280
|
-
type: 'line',
|
|
281
|
-
name: 'sentiment-short',
|
|
282
|
-
id: 'sentiment',
|
|
283
|
-
xAxisIndex: 1,
|
|
284
|
-
yAxisIndex: 1,
|
|
285
|
-
data: sentiments,
|
|
286
|
-
showSymbol: false,
|
|
287
|
-
symbol: 'none',
|
|
288
|
-
lineStyle: {
|
|
289
|
-
width: 3,
|
|
290
|
-
opacity: 1
|
|
291
|
-
},
|
|
292
|
-
areaStyle: {
|
|
293
|
-
color: sentimentShortColor,
|
|
294
|
-
opacity: sentimentAreaOpacity
|
|
295
|
-
},
|
|
296
|
-
emphasis: {
|
|
297
|
-
areaStyle: {
|
|
298
|
-
opacity: 0
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
stack: 'sentiment'
|
|
302
|
-
}, {
|
|
303
|
-
type: 'line',
|
|
304
|
-
name: 'sentiment-long',
|
|
305
|
-
id: 'sentiment-long',
|
|
306
|
-
xAxisIndex: 1,
|
|
307
|
-
yAxisIndex: 1,
|
|
308
|
-
data: sentiments.map(sentiment => [sentiment[0], sentiment[2]]),
|
|
309
|
-
symbol: 'none',
|
|
310
|
-
lineStyle: {
|
|
311
|
-
color: 'transparent',
|
|
312
|
-
width: 0
|
|
313
|
-
},
|
|
314
|
-
areaStyle: {
|
|
315
|
-
color: sentimentLongColor,
|
|
316
|
-
opacity: sentimentAreaOpacity
|
|
317
|
-
},
|
|
318
|
-
stack: 'sentiment',
|
|
319
|
-
emphasis: {
|
|
320
|
-
disabled: true
|
|
321
|
-
},
|
|
322
|
-
tooltip: {
|
|
323
|
-
show: false
|
|
324
|
-
}
|
|
325
|
-
}],
|
|
326
|
-
grid: [{
|
|
327
|
-
name: 'main-grid',
|
|
328
|
-
id: 'main-grid',
|
|
329
|
-
height: "".concat(_constants.CHART_CONFIG.MAIN_HEIGHT, "px"),
|
|
330
|
-
top: '0px',
|
|
331
|
-
left: '0px',
|
|
332
|
-
right: "".concat(isDesktop ? _constants.CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : _constants.CHART_CONFIG.Y_LABEL_SIZE_MOBILE, "px"),
|
|
333
|
-
bottom: "".concat(_constants.CHART_CONFIG.X_LABEL_SIZE, "px")
|
|
334
|
-
}, {
|
|
335
|
-
name: 'sentiment-grid',
|
|
336
|
-
id: 'sentiment-grid',
|
|
337
|
-
height: "".concat(_constants.CHART_CONFIG.SENTIMENT_HEIGHT, "px"),
|
|
338
|
-
bottom: "0px",
|
|
339
|
-
left: '0px',
|
|
340
|
-
right: "".concat(isDesktop ? _constants.CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : _constants.CHART_CONFIG.Y_LABEL_SIZE_MOBILE, "px")
|
|
341
|
-
}],
|
|
342
|
-
graphic: [...gridMainLines, {
|
|
343
|
-
type: 'text',
|
|
344
|
-
silent: true,
|
|
345
|
-
z: 1,
|
|
346
|
-
left: 4,
|
|
347
|
-
bottom: _constants.CHART_CONFIG_CALCULATED.SENTIMENT_TEXT_POSITION,
|
|
348
|
-
style: {
|
|
349
|
-
text: "".concat(labelCallback('sentiment'), ":"),
|
|
350
|
-
fontFamily: 'Sofia W03',
|
|
351
|
-
fontSize: 14,
|
|
352
|
-
fontWeight: 'bold',
|
|
353
|
-
fill: sentimentLabelColor
|
|
354
|
-
}
|
|
355
|
-
}]
|
|
356
|
-
};
|
|
357
|
-
};
|
|
358
|
-
exports.getOption = getOption;
|
|
359
|
-
//# sourceMappingURL=chartOptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chartOptions.js","names":["_chromaJs","_interopRequireDefault","require","_constants","_chartUtils","_getChartStyles","_getGridLines","e","__esModule","default","getOption","_ref","isDark","isDesktop","labelCallback","xAxisData","candlesSeriesData","orderPositionBooks","bucketWidth","buckets","precision","bookType","sentiments","selectedPrice","sentimentLongColor","sentimentShortColor","candleLongColor","candleShortColor","sentimentAreaOpacity","tooltipLinesColor","sentimentLabelColor","getChartStyles","visibleXAxisData","slice","length","CHART_CONFIG","INITIAL_START_ZOOM","INITIAL_END_ZOOM","isGreaterThanTwoWeeks","isDifferenceGreaterThanTwoWeeks","labelsData","getLabelData","gridMainLines","getGridLines","animation","dataZoom","id","type","xAxisIndex","start","end","filterMode","tooltip","trigger","axisPointer","axis","lineStyle","color","crossStyle","label","padding","lineHeight","formatter","params","axisDimension","axisIndex","Number","value","concat","toFixed","confine","getTooltipFormatter","xAxis","name","nameTextStyle","fontSize","data","splitNumber","axisTick","show","axisLabel","margin","formatXAxisLabel","gridIndex","yAxis","position","min","val","max","axisLine","showMaxLabel","showMinLabel","SENTIMENT_MIN","SENTIMENT_MAX","interval","SENTIMENT_INTERVAL","verticalAlignMaxLabel","verticalAlignMinLabel","rich","shortRect","backgroundColor","chroma","alpha","css","borderColor","borderWidth","width","height","longRect","undefined","link","visualMap","seriesId","dimension","pieces","lt","gte","lte","gt","series","yAxisIndex","itemStyle","desaturate","color0","borderColor0","emphasis","markPoint","symbol","symbolSize","silent","clip","renderItem","_params","api","xVal","bucketIndex","metaValues","rectWidth","rectHeight","size","items","map","_ref2","price","sentiment","coord","shape","x","y","style","fill","getRectColor","emphasisDisabled","children","showSymbol","opacity","areaStyle","stack","disabled","grid","MAIN_HEIGHT","top","left","right","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","bottom","X_LABEL_SIZE","SENTIMENT_HEIGHT","graphic","z","CHART_CONFIG_CALCULATED","SENTIMENT_TEXT_POSITION","text","fontFamily","fontWeight","exports"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/chartOptions.ts"],"sourcesContent":["import chroma from 'chroma-js';\n\nimport { CHART_CONFIG, CHART_CONFIG_CALCULATED } from '../../constants';\nimport type { Bucket, GetOptionType, TooltipParam } from './types';\nimport {\n formatXAxisLabel,\n getLabelData,\n getRectColor,\n getTooltipFormatter,\n isDifferenceGreaterThanTwoWeeks,\n} from './utils/chartUtils';\nimport { getChartStyles } from './utils/getChartStyles';\nimport { getGridLines } from './utils/getGridLines';\n\n// @ts-expect-error\nexport const getOption: GetOptionType = (\n {\n xAxisData,\n candlesSeriesData,\n orderPositionBooks,\n bucketWidth,\n buckets,\n precision,\n bookType,\n sentiments,\n },\n isDark,\n isDesktop,\n labelCallback\n) => {\n let selectedPrice: number;\n const {\n sentimentLongColor,\n sentimentShortColor,\n candleLongColor,\n candleShortColor,\n sentimentAreaOpacity,\n tooltipLinesColor,\n sentimentLabelColor,\n } = getChartStyles(isDark);\n\n const visibleXAxisData = xAxisData.slice(\n (xAxisData.length * CHART_CONFIG.INITIAL_START_ZOOM) / 100,\n (xAxisData.length * CHART_CONFIG.INITIAL_END_ZOOM) / 100\n );\n\n const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(\n visibleXAxisData[0],\n visibleXAxisData[visibleXAxisData.length - 1]\n );\n\n const labelsData = getLabelData({\n xAxisData,\n isGreaterThanTwoWeeks,\n });\n\n const gridMainLines = getGridLines({\n isDark,\n isDesktop,\n });\n\n return {\n animation: false,\n dataZoom: [\n {\n id: 'main',\n type: 'inside',\n xAxisIndex: 0,\n start: CHART_CONFIG.INITIAL_START_ZOOM,\n end: CHART_CONFIG.INITIAL_END_ZOOM,\n filterMode: 'filter',\n },\n {\n id: 'sentiment',\n type: 'inside',\n xAxisIndex: 1,\n start: CHART_CONFIG.INITIAL_START_ZOOM,\n end: CHART_CONFIG.INITIAL_END_ZOOM,\n filterMode: 'none',\n },\n ],\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n type: 'cross',\n axis: 'x',\n lineStyle: {\n color: tooltipLinesColor,\n },\n crossStyle: {\n color: tooltipLinesColor,\n },\n label: {\n padding: 0,\n lineHeight: 24,\n formatter: (params) => {\n if (params.axisDimension === 'y' && params.axisIndex === 0) {\n selectedPrice = Number(params.value);\n return ` ${Number(params.value).toFixed(precision)} `;\n }\n\n return null;\n },\n },\n },\n confine: true,\n formatter: (params: TooltipParam[]) =>\n getTooltipFormatter({\n params,\n buckets,\n bucketWidth,\n selectedPrice,\n labelCallback,\n precision,\n bookType,\n }),\n },\n xAxis: [\n {\n type: 'category',\n name: 'xAxis-less-than-two-weeks',\n nameTextStyle: {\n fontSize: 0,\n },\n id: 'main-xAxis',\n data: xAxisData,\n splitNumber: 1,\n axisTick: {\n show: false,\n },\n axisLabel: {\n padding: [8, 16, 8, 16],\n margin: 0,\n formatter: (value) => formatXAxisLabel(value, isGreaterThanTwoWeeks),\n },\n },\n {\n type: 'category',\n gridIndex: 1,\n show: false,\n data: xAxisData,\n splitNumber: 1,\n axisTick: {\n show: false,\n },\n axisLabel: {\n show: false,\n },\n },\n ],\n yAxis: [\n {\n type: 'value',\n gridIndex: 0,\n position: 'right',\n min: (val) => val.min - bucketWidth * 2,\n max: (val) => val.max + bucketWidth * 2,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n margin: isDesktop ? 4 : 2,\n formatter: (value: number) => value.toFixed(precision - 1),\n },\n },\n {\n type: 'value',\n gridIndex: 1,\n position: 'right',\n min: CHART_CONFIG.SENTIMENT_MIN,\n max: CHART_CONFIG.SENTIMENT_MAX,\n interval: CHART_CONFIG.SENTIMENT_INTERVAL,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n verticalAlignMaxLabel: 'top',\n verticalAlignMinLabel: 'bottom',\n lineHeight: 20,\n margin: isDesktop ? 4 : 2,\n rich: {\n shortRect: {\n backgroundColor: chroma(sentimentShortColor).alpha(0.3).css(),\n borderColor: sentimentShortColor,\n borderWidth: 1,\n width: 8,\n height: 8,\n },\n longRect: {\n backgroundColor: chroma(sentimentLongColor).alpha(0.3).css(),\n borderColor: sentimentLongColor,\n borderWidth: 1,\n width: 8,\n height: 8,\n },\n },\n formatter: (value: number) => {\n if (value === CHART_CONFIG.SENTIMENT_MIN) {\n return `{shortRect| } ${labelCallback('short')}`;\n }\n\n if (value === CHART_CONFIG.SENTIMENT_MAX) {\n return `{longRect| } ${labelCallback('long')}`;\n }\n\n if (value === CHART_CONFIG.SENTIMENT_MAX / 2) {\n return '50%';\n }\n\n return undefined;\n },\n },\n },\n ],\n axisPointer: {\n link: [\n {\n xAxisIndex: 'all',\n },\n ],\n },\n visualMap: {\n show: false,\n seriesId: 'sentiment',\n dimension: 1,\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 series: [\n {\n type: 'candlestick',\n id: 'candlestick',\n gridIndex: 0,\n xAxisIndex: 0,\n yAxisIndex: 0,\n data: candlesSeriesData,\n itemStyle: {\n color: chroma(candleShortColor).desaturate().css(),\n color0: chroma(candleLongColor).desaturate().css(),\n borderColor: candleShortColor,\n borderColor0: candleLongColor,\n },\n emphasis: {\n itemStyle: {\n color: candleShortColor,\n color0: candleLongColor,\n },\n },\n markPoint: {\n symbol: 'circle',\n symbolSize: 0,\n data: labelsData,\n },\n },\n {\n type: 'custom',\n gridIndex: 0,\n name: 'heatmap',\n id: 'heatmap',\n xAxisIndex: 0,\n yAxisIndex: 0,\n silent: true,\n clip: true,\n renderItem: (_params, api) => {\n const xVal = api.value(0);\n const bucketIndex = api.value(2) as number;\n const metaValues = buckets[bucketIndex];\n\n const [rectWidth, rectHeight] = api.size!([\n 0,\n bucketWidth,\n ]) as number[];\n\n const items = metaValues.map(({ price, sentiment }: Bucket) => {\n const start = api.coord([xVal, price]);\n\n return {\n type: 'rect',\n shape: {\n x: start[0] - rectWidth / 2,\n y: start[1] - rectHeight,\n width: rectWidth + 1,\n height: rectHeight,\n },\n style: {\n fill: getRectColor(sentiment, isDark),\n },\n silent: true,\n emphasisDisabled: true,\n };\n });\n\n return {\n type: 'group',\n children: items,\n silent: true,\n emphasisDisabled: true,\n };\n },\n data: orderPositionBooks,\n },\n {\n type: 'line',\n name: 'sentiment-short',\n id: 'sentiment',\n xAxisIndex: 1,\n yAxisIndex: 1,\n data: sentiments,\n showSymbol: false,\n symbol: 'none',\n lineStyle: {\n width: 3,\n opacity: 1,\n },\n areaStyle: {\n color: sentimentShortColor,\n opacity: sentimentAreaOpacity,\n },\n emphasis: {\n areaStyle: {\n opacity: 0,\n },\n },\n stack: 'sentiment',\n },\n {\n type: 'line',\n name: 'sentiment-long',\n id: 'sentiment-long',\n xAxisIndex: 1,\n yAxisIndex: 1,\n data: sentiments.map((sentiment) => [sentiment[0], sentiment[2]]),\n symbol: 'none',\n lineStyle: {\n color: 'transparent',\n width: 0,\n },\n areaStyle: {\n color: sentimentLongColor,\n opacity: sentimentAreaOpacity,\n },\n stack: 'sentiment',\n emphasis: {\n disabled: true,\n },\n tooltip: {\n show: false,\n },\n },\n ],\n grid: [\n {\n name: 'main-grid',\n id: 'main-grid',\n height: `${CHART_CONFIG.MAIN_HEIGHT}px`,\n top: '0px',\n left: '0px',\n right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,\n bottom: `${CHART_CONFIG.X_LABEL_SIZE}px`,\n },\n {\n name: 'sentiment-grid',\n id: 'sentiment-grid',\n height: `${CHART_CONFIG.SENTIMENT_HEIGHT}px`,\n bottom: `0px`,\n left: '0px',\n right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,\n },\n ],\n graphic: [\n ...gridMainLines,\n {\n type: 'text',\n silent: true,\n z: 1,\n left: 4,\n bottom: CHART_CONFIG_CALCULATED.SENTIMENT_TEXT_POSITION,\n style: {\n text: `${labelCallback('sentiment')}:`,\n fontFamily: 'Sofia W03',\n fontSize: 14,\n fontWeight: 'bold',\n fill: sentimentLabelColor,\n },\n },\n ],\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAoD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG7C,MAAMG,SAAwB,GAAGA,CAAAC,IAAA,EAWtCC,MAAM,EACNC,SAAS,EACTC,aAAa,KACV;EAAA,IAbH;IACEC,SAAS;IACTC,iBAAiB;IACjBC,kBAAkB;IAClBC,WAAW;IACXC,OAAO;IACPC,SAAS;IACTC,QAAQ;IACRC;EACF,CAAC,GAAAX,IAAA;EAKD,IAAIY,aAAqB;EACzB,MAAM;IACJC,kBAAkB;IAClBC,mBAAmB;IACnBC,eAAe;IACfC,gBAAgB;IAChBC,oBAAoB;IACpBC,iBAAiB;IACjBC;EACF,CAAC,GAAG,IAAAC,8BAAc,EAACnB,MAAM,CAAC;EAE1B,MAAMoB,gBAAgB,GAAGjB,SAAS,CAACkB,KAAK,CACrClB,SAAS,CAACmB,MAAM,GAAGC,uBAAY,CAACC,k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AE,CACP,GAAG/H,aAAa,EAChB;MACEK,IAAI,EAAE,MAAM;MACZkF,MAAM,EAAE,IAAI;MACZyC,CAAC,EAAE,CAAC;MACJR,IAAI,EAAE,CAAC;MACPI,MAAM,EAAEK,kCAAuB,CAACC,uBAAuB;MACvDvB,KAAK,EAAE;QACLwB,IAAI,KAAAzG,MAAA,CAAKtD,aAAa,CAAC,WAAW,CAAC,MAAG;QACtCgK,UAAU,EAAE,WAAW;QACvBnG,QAAQ,EAAE,EAAE;QACZoG,UAAU,EAAE,MAAM;QAClBzB,IAAI,EAAExH;MACR;IACF,CAAC;EAEL,CAAC;AACH,CAAC;AAACkJ,OAAA,CAAAtK,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.aggregateBuckets = void 0;
|
|
7
|
-
var _decimal = _interopRequireDefault(require("decimal.js"));
|
|
8
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const aggregateBuckets = (buckets, newBucketWidth) => {
|
|
10
|
-
if (!buckets.length) {
|
|
11
|
-
return [];
|
|
12
|
-
}
|
|
13
|
-
const bucketWidthDecimal = new _decimal.default(newBucketWidth);
|
|
14
|
-
const aggregatedMap = new Map();
|
|
15
|
-
for (const bucket of buckets) {
|
|
16
|
-
var _aggregatedMap$get;
|
|
17
|
-
const priceDecimal = new _decimal.default(bucket.price);
|
|
18
|
-
const sentimentDecimal = new _decimal.default(bucket.sentiment);
|
|
19
|
-
const bucketIndex = priceDecimal.div(bucketWidthDecimal).floor();
|
|
20
|
-
const groupingKey = bucketIndex.mul(bucketWidthDecimal);
|
|
21
|
-
const groupingKeyStr = groupingKey.toString();
|
|
22
|
-
const currentSentiment = (_aggregatedMap$get = aggregatedMap.get(groupingKeyStr)) !== null && _aggregatedMap$get !== void 0 ? _aggregatedMap$get : new _decimal.default(0);
|
|
23
|
-
aggregatedMap.set(groupingKeyStr, currentSentiment.add(sentimentDecimal));
|
|
24
|
-
}
|
|
25
|
-
const aggregatedBuckets = Array.from(aggregatedMap.entries()).map(_ref => {
|
|
26
|
-
let [priceStr, sentimentDecimal] = _ref;
|
|
27
|
-
const price = new _decimal.default(priceStr).toNumber();
|
|
28
|
-
const sentiment = sentimentDecimal.toNumber();
|
|
29
|
-
return {
|
|
30
|
-
price,
|
|
31
|
-
sentiment
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
return aggregatedBuckets;
|
|
35
|
-
};
|
|
36
|
-
exports.aggregateBuckets = aggregateBuckets;
|
|
37
|
-
//# sourceMappingURL=aggregateBuckets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregateBuckets.js","names":["_decimal","_interopRequireDefault","require","e","__esModule","default","aggregateBuckets","buckets","newBucketWidth","length","bucketWidthDecimal","Decimal","aggregatedMap","Map","bucket","_aggregatedMap$get","priceDecimal","price","sentimentDecimal","sentiment","bucketIndex","div","floor","groupingKey","mul","groupingKeyStr","toString","currentSentiment","get","set","add","aggregatedBuckets","Array","from","entries","map","_ref","priceStr","toNumber","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/aggregateBuckets.ts"],"sourcesContent":["import Decimal from 'decimal.js';\n\nimport type { Bucket } from '../types';\n\nexport const aggregateBuckets = (\n buckets: Bucket[],\n newBucketWidth: number\n): Bucket[] => {\n if (!buckets.length) {\n return [];\n }\n\n const bucketWidthDecimal = new Decimal(newBucketWidth);\n\n const aggregatedMap = new Map<string, Decimal>();\n\n for (const bucket of buckets) {\n const priceDecimal = new Decimal(bucket.price);\n const sentimentDecimal = new Decimal(bucket.sentiment);\n\n const bucketIndex = priceDecimal.div(bucketWidthDecimal).floor();\n const groupingKey = bucketIndex.mul(bucketWidthDecimal);\n\n const groupingKeyStr = groupingKey.toString();\n\n const currentSentiment =\n aggregatedMap.get(groupingKeyStr) ?? new Decimal(0);\n aggregatedMap.set(groupingKeyStr, currentSentiment.add(sentimentDecimal));\n }\n\n const aggregatedBuckets = Array.from(aggregatedMap.entries()).map(\n ([priceStr, sentimentDecimal]) => {\n const price = new Decimal(priceStr).toNumber();\n const sentiment = sentimentDecimal.toNumber();\n\n return {\n price,\n sentiment,\n };\n }\n );\n\n return aggregatedBuckets;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI1B,MAAMG,gBAAgB,GAAGA,CAC9BC,OAAiB,EACjBC,cAAsB,KACT;EACb,IAAI,CAACD,OAAO,CAACE,MAAM,EAAE;IACnB,OAAO,EAAE;EACX;EAEA,MAAMC,kBAAkB,GAAG,IAAIC,gBAAO,CAACH,cAAc,CAAC;EAEtD,MAAMI,aAAa,GAAG,IAAIC,GAAG,CAAkB,CAAC;EAEhD,KAAK,MAAMC,MAAM,IAAIP,OAAO,EAAE;IAAA,IAAAQ,kBAAA;IAC5B,MAAMC,YAAY,GAAG,IAAIL,gBAAO,CAACG,MAAM,CAACG,KAAK,CAAC;IAC9C,MAAMC,gBAAgB,GAAG,IAAIP,gBAAO,CAACG,MAAM,CAACK,SAAS,CAAC;IAEtD,MAAMC,WAAW,GAAGJ,YAAY,CAACK,GAAG,CAACX,kBAAkB,CAAC,CAACY,KAAK,CAAC,CAAC;IAChE,MAAMC,WAAW,GAAGH,WAAW,CAACI,GAAG,CAACd,kBAAkB,CAAC;IAEvD,MAAMe,cAAc,GAAGF,WAAW,CAACG,QAAQ,CAAC,CAAC;IAE7C,MAAMC,gBAAgB,IAAAZ,kBAAA,GACpBH,aAAa,CAACgB,GAAG,CAACH,cAAc,CAAC,cAAAV,kBAAA,cAAAA,kBAAA,GAAI,IAAIJ,gBAAO,CAAC,CAAC,CAAC;IACrDC,aAAa,CAACiB,GAAG,CAACJ,cAAc,EAAEE,gBAAgB,CAACG,GAAG,CAACZ,gBAAgB,CAAC,CAAC;EAC3E;EAEA,MAAMa,iBAAiB,GAAGC,KAAK,CAACC,IAAI,CAACrB,aAAa,CAACsB,OAAO,CAAC,CAAC,CAAC,CAACC,GAAG,CAC/DC,IAAA,IAAkC;IAAA,IAAjC,CAACC,QAAQ,EAAEnB,gBAAgB,CAAC,GAAAkB,IAAA;IAC3B,MAAMnB,KAAK,GAAG,IAAIN,gBAAO,CAAC0B,QAAQ,CAAC,CAACC,QAAQ,CAAC,CAAC;IAC9C,MAAMnB,SAAS,GAAGD,gBAAgB,CAACoB,QAAQ,CAAC,CAAC;IAE7C,OAAO;MACLrB,KAAK;MACLE;IACF,CAAC;EACH,CACF,CAAC;EAED,OAAOY,iBAAiB;AAC1B,CAAC;AAACQ,OAAA,CAAAjC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isDifferenceGreaterThanTwoWeeks = exports.getTooltipFormatter = exports.getTimeSpanForGranularity = exports.getRectColor = exports.getLabelData = exports.formatXAxisLabel = void 0;
|
|
7
|
-
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
8
|
-
var _graphql = require("../../../../gql/types/graphql");
|
|
9
|
-
var _constants = require("../../../constants");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
const getLabelData = _ref => {
|
|
12
|
-
let {
|
|
13
|
-
xAxisData,
|
|
14
|
-
isGreaterThanTwoWeeks
|
|
15
|
-
} = _ref;
|
|
16
|
-
return xAxisData.filter((record, index, arr) => {
|
|
17
|
-
if (index === 0) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
const previousTimestamp = arr[index - 1];
|
|
21
|
-
const currentDate = new Date(record);
|
|
22
|
-
const previousDate = new Date(previousTimestamp);
|
|
23
|
-
return isGreaterThanTwoWeeks ? currentDate.getDate() !== previousDate.getDate() : currentDate.getMonth() !== previousDate.getMonth();
|
|
24
|
-
}).map(item => ({
|
|
25
|
-
name: new Date(item).toLocaleDateString(undefined, {
|
|
26
|
-
month: isGreaterThanTwoWeeks ? 'short' : 'long',
|
|
27
|
-
day: isGreaterThanTwoWeeks ? 'numeric' : undefined
|
|
28
|
-
}),
|
|
29
|
-
xAxis: item,
|
|
30
|
-
y: _constants.CHART_CONFIG.MAIN_HEIGHT + _constants.CHART_CONFIG.X_LABEL_SIZE - 22,
|
|
31
|
-
silent: true,
|
|
32
|
-
emphasis: {
|
|
33
|
-
disabled: true
|
|
34
|
-
},
|
|
35
|
-
label: {
|
|
36
|
-
fontFamily: 'Sofia W03',
|
|
37
|
-
fontSize: 10,
|
|
38
|
-
position: 'bottom',
|
|
39
|
-
align: 'center',
|
|
40
|
-
formatter: '{b}'
|
|
41
|
-
}
|
|
42
|
-
}));
|
|
43
|
-
};
|
|
44
|
-
exports.getLabelData = getLabelData;
|
|
45
|
-
const isDifferenceGreaterThanTwoWeeks = (startDate, endDate) => {
|
|
46
|
-
const date1 = new Date(startDate);
|
|
47
|
-
const date2 = new Date(endDate);
|
|
48
|
-
const differenceInMs = Math.abs(date2.getTime() - date1.getTime());
|
|
49
|
-
return differenceInMs < _constants.TIME_THRESHOLDS.TWO_WEEKS_MS;
|
|
50
|
-
};
|
|
51
|
-
exports.isDifferenceGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks;
|
|
52
|
-
const getTimeSpanForGranularity = granularity => {
|
|
53
|
-
const granularityTimeSpanMap = {
|
|
54
|
-
[_graphql.Granularity.M5]: _graphql.TimeSpan.TwoDays,
|
|
55
|
-
[_graphql.Granularity.M15]: _graphql.TimeSpan.FiveDays,
|
|
56
|
-
[_graphql.Granularity.H1]: _graphql.TimeSpan.TwentyDays,
|
|
57
|
-
[_graphql.Granularity.H4]: _graphql.TimeSpan.NinetyDays
|
|
58
|
-
};
|
|
59
|
-
return granularityTimeSpanMap[granularity] || _graphql.TimeSpan.TwoDays;
|
|
60
|
-
};
|
|
61
|
-
exports.getTimeSpanForGranularity = getTimeSpanForGranularity;
|
|
62
|
-
const getGradientColor = (value, startColor, targetColor) => {
|
|
63
|
-
const startThreshold = _constants.BOOKS_THRESHOLDS.MIN;
|
|
64
|
-
const endThreshold = _constants.BOOKS_THRESHOLDS.MAX;
|
|
65
|
-
const colorScale = _chromaJs.default.scale([startColor, targetColor]).domain([startThreshold, endThreshold]).mode('rgb');
|
|
66
|
-
return colorScale(value).hex();
|
|
67
|
-
};
|
|
68
|
-
const getRectColor = (sentiment, isDark) => {
|
|
69
|
-
const colorPalette = isDark ? _constants.COLOR_MAP.dark : _constants.COLOR_MAP.light;
|
|
70
|
-
return sentiment < 0 ? getGradientColor(sentiment * -1, colorPalette.short[0], colorPalette.short[1]) : getGradientColor(sentiment, colorPalette.long[0], colorPalette.long[1]);
|
|
71
|
-
};
|
|
72
|
-
exports.getRectColor = getRectColor;
|
|
73
|
-
const getTooltipFormatter = _ref2 => {
|
|
74
|
-
let {
|
|
75
|
-
params,
|
|
76
|
-
buckets,
|
|
77
|
-
bucketWidth,
|
|
78
|
-
selectedPrice,
|
|
79
|
-
precision,
|
|
80
|
-
bookType,
|
|
81
|
-
labelCallback
|
|
82
|
-
} = _ref2;
|
|
83
|
-
if (!params || !Array.isArray(params) || params.length === 0) {
|
|
84
|
-
return undefined;
|
|
85
|
-
}
|
|
86
|
-
const candleParam = params.find(series => series.seriesId === 'candlestick');
|
|
87
|
-
const booksParam = params.find(series => series.seriesId === 'heatmap');
|
|
88
|
-
const sentimentParam = params.find(series => series.seriesId === 'sentiment');
|
|
89
|
-
if (!candleParam) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
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 selectedBuckets = bucketsIndex !== undefined ? buckets[bucketsIndex] : undefined;
|
|
96
|
-
const matchedBucket = selectedBuckets === null || selectedBuckets === void 0 ? void 0 : selectedBuckets.find(_ref3 => {
|
|
97
|
-
let {
|
|
98
|
-
price
|
|
99
|
-
} = _ref3;
|
|
100
|
-
return selectedPrice >= price && selectedPrice < price + bucketWidth;
|
|
101
|
-
});
|
|
102
|
-
const showCandles = !!candleData[1] && !!candleData[2] && !!candleData[3] && !!candleData[4];
|
|
103
|
-
if (!showCandles && !matchedBucket) {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
const showSentiment = !!(sentimentParam !== null && sentimentParam !== void 0 && sentimentParam.value[1]) && !!(sentimentParam !== null && sentimentParam !== void 0 && sentimentParam.value[2]);
|
|
107
|
-
return "<p>".concat(time.toLocaleString(undefined, {
|
|
108
|
-
hour: '2-digit',
|
|
109
|
-
minute: '2-digit',
|
|
110
|
-
year: 'numeric',
|
|
111
|
-
day: 'numeric',
|
|
112
|
-
month: 'numeric',
|
|
113
|
-
timeZoneName: 'short'
|
|
114
|
-
}), "</p><br />\n").concat(showCandles ? "<p><b>".concat(labelCallback('candle'), ":</b></p>\n<p>").concat(labelCallback('open_price'), ": ").concat(candleData[1], " </p>\n<p>").concat(labelCallback('close_price'), ": ").concat(candleData[2], " </p>\n<p>").concat(labelCallback('low'), ": ").concat(candleData[3], " </p>\n<p>").concat(labelCallback('high'), ": ").concat(candleData[4], " </p>\n") : '', "\n").concat(matchedBucket ? "<br /><p><b>".concat(labelCallback(bookType === _graphql.BookType.Order ? 'orders' : 'positions'), ":</b></p>\n<p>").concat(labelCallback('price_range'), ": ").concat(matchedBucket.price.toFixed(precision - 1), " - ").concat(Number(matchedBucket.price + bucketWidth).toFixed(precision - 1), " </p>\n<p>").concat(matchedBucket.sentiment < 0 ? labelCallback(bookType === _graphql.BookType.Order ? 'sell_overbalance' : 'short_overbalance') : labelCallback(bookType === _graphql.BookType.Order ? 'buy_overbalance' : 'long_overbalance'), ": ").concat(Math.abs(matchedBucket.sentiment), "% </p>") : '').concat(showSentiment && sentimentParam ? "<br /><p><b>".concat(labelCallback('sentiment'), ":</b></p>\n<p>").concat(labelCallback('long'), ": ").concat(sentimentParam.value[2].toFixed(2), "% </p>\n<p>").concat(labelCallback('short'), ": ").concat(sentimentParam.value[1].toFixed(2), "% </p>") : '');
|
|
115
|
-
};
|
|
116
|
-
exports.getTooltipFormatter = getTooltipFormatter;
|
|
117
|
-
const formatXAxisLabel = (value, isGreaterThanTwoWeeks) => {
|
|
118
|
-
const date = new Date(value);
|
|
119
|
-
return isGreaterThanTwoWeeks ? "".concat(date.toLocaleTimeString(undefined, {
|
|
120
|
-
hour: '2-digit',
|
|
121
|
-
minute: '2-digit'
|
|
122
|
-
})) : "".concat(_constants.CHART_CONFIG.X_AXIS_DATE_PADDING).concat(date.toLocaleDateString(undefined, {
|
|
123
|
-
day: 'numeric'
|
|
124
|
-
})).concat(_constants.CHART_CONFIG.X_AXIS_DATE_PADDING);
|
|
125
|
-
};
|
|
126
|
-
exports.formatXAxisLabel = formatXAxisLabel;
|
|
127
|
-
//# sourceMappingURL=chartUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chartUtils.js","names":["_chromaJs","_interopRequireDefault","require","_graphql","_constants","e","__esModule","default","getLabelData","_ref","xAxisData","isGreaterThanTwoWeeks","filter","record","index","arr","previousTimestamp","currentDate","Date","previousDate","getDate","getMonth","map","item","name","toLocaleDateString","undefined","month","day","xAxis","y","CHART_CONFIG","MAIN_HEIGHT","X_LABEL_SIZE","silent","emphasis","disabled","label","fontFamily","fontSize","position","align","formatter","exports","isDifferenceGreaterThanTwoWeeks","startDate","endDate","date1","date2","differenceInMs","Math","abs","getTime","TIME_THRESHOLDS","TWO_WEEKS_MS","getTimeSpanForGranularity","granularity","granularityTimeSpanMap","Granularity","M5","TimeSpan","TwoDays","M15","FiveDays","H1","TwentyDays","H4","NinetyDays","getGradientColor","value","startColor","targetColor","startThreshold","BOOKS_THRESHOLDS","MIN","endThreshold","MAX","colorScale","chroma","scale","domain","mode","hex","getRectColor","sentiment","isDark","colorPalette","COLOR_MAP","dark","light","short","long","getTooltipFormatter","_ref2","params","buckets","bucketWidth","selectedPrice","precision","bookType","labelCallback","Array","isArray","length","candleParam","find","series","seriesId","booksParam","sentimentParam","time","axisValue","candleData","bucketsIndex","selectedBuckets","matchedBucket","_ref3","price","showCandles","showSentiment","concat","toLocaleString","hour","minute","year","timeZoneName","BookType","Order","toFixed","Number","formatXAxisLabel","date","toLocaleTimeString","X_AXIS_DATE_PADDING"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/chartUtils.ts"],"sourcesContent":["import chroma from 'chroma-js';\n\nimport { BookType, Granularity, TimeSpan } from '../../../../gql/types/graphql';\nimport {\n BOOKS_THRESHOLDS,\n CHART_CONFIG,\n COLOR_MAP,\n TIME_THRESHOLDS,\n} from '../../../constants';\nimport type { Bucket, GetLabelsDataProps, TooltipParam } from '../types';\n\nexport const getLabelData = ({\n xAxisData,\n isGreaterThanTwoWeeks,\n}: GetLabelsDataProps) =>\n xAxisData\n .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 .map((item) => ({\n name: new Date(item).toLocaleDateString(undefined, {\n month: isGreaterThanTwoWeeks ? 'short' : 'long',\n day: isGreaterThanTwoWeeks ? 'numeric' : undefined,\n }),\n xAxis: item,\n y: CHART_CONFIG.MAIN_HEIGHT + CHART_CONFIG.X_LABEL_SIZE - 22,\n silent: true,\n emphasis: {\n disabled: true,\n },\n label: {\n fontFamily: 'Sofia W03',\n fontSize: 10,\n position: 'bottom',\n align: 'center',\n formatter: '{b}',\n },\n }));\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\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\nconst getGradientColor = (\n value: number,\n startColor: string,\n targetColor: string\n): string => {\n const startThreshold = BOOKS_THRESHOLDS.MIN;\n const endThreshold = BOOKS_THRESHOLDS.MAX;\n\n const colorScale = chroma\n .scale([startColor, targetColor])\n .domain([startThreshold, endThreshold])\n .mode('rgb');\n\n return colorScale(value).hex();\n};\n\nexport const getRectColor = (sentiment: number, isDark: boolean) => {\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 )\n : getGradientColor(sentiment, colorPalette.long[0], colorPalette.long[1]);\n};\n\nexport const getTooltipFormatter = ({\n params,\n buckets,\n bucketWidth,\n selectedPrice,\n precision,\n bookType,\n labelCallback,\n}: {\n params: TooltipParam[];\n buckets: Bucket[][];\n bucketWidth: number;\n selectedPrice: number;\n precision: number;\n bookType: BookType;\n labelCallback: (key: string) => string;\n}) => {\n if (!params || !Array.isArray(params) || params.length === 0) {\n return undefined;\n }\n const candleParam = params.find(\n (series): series is Extract<TooltipParam, { seriesId: 'candlestick' }> =>\n series.seriesId === 'candlestick'\n );\n const booksParam = params.find(\n (series): series is Extract<TooltipParam, { seriesId: 'heatmap' }> =>\n series.seriesId === 'heatmap'\n );\n const sentimentParam = params.find(\n (series): series is Extract<TooltipParam, { seriesId: 'sentiment' }> =>\n series.seriesId === 'sentiment'\n );\n\n if (!candleParam) {\n return undefined;\n }\n const time = new Date(candleParam.axisValue as string);\n\n const candleData = candleParam.value;\n const bucketsIndex = booksParam?.value[2];\n const selectedBuckets =\n bucketsIndex !== undefined ? buckets[bucketsIndex] : undefined;\n\n const matchedBucket = selectedBuckets?.find(\n ({ price }) => selectedPrice >= price && selectedPrice < price + bucketWidth\n );\n const showCandles =\n !!candleData[1] && !!candleData[2] && !!candleData[3] && !!candleData[4];\n\n if (!showCandles && !matchedBucket) {\n return undefined;\n }\n\n const showSentiment =\n !!sentimentParam?.value[1] && !!sentimentParam?.value[2];\n\n return `<p>${time.toLocaleString(undefined, {\n hour: '2-digit',\n minute: '2-digit',\n year: 'numeric',\n day: 'numeric',\n month: 'numeric',\n timeZoneName: 'short',\n })}</p><br />\n${\n showCandles\n ? `<p><b>${labelCallback('candle')}:</b></p>\n<p>${labelCallback('open_price')}: ${candleData[1]} </p>\n<p>${labelCallback('close_price')}: ${candleData[2]} </p>\n<p>${labelCallback('low')}: ${candleData[3]} </p>\n<p>${labelCallback('high')}: ${candleData[4]} </p>\n`\n : ''\n}\n${\n matchedBucket\n ? `<br /><p><b>${labelCallback(bookType === BookType.Order ? 'orders' : 'positions')}:</b></p>\n<p>${labelCallback('price_range')}: ${matchedBucket.price.toFixed(precision - 1)} - ${Number(matchedBucket.price + bucketWidth).toFixed(precision - 1)} </p>\n<p>${\n matchedBucket.sentiment < 0\n ? labelCallback(\n bookType === BookType.Order\n ? 'sell_overbalance'\n : 'short_overbalance'\n )\n : labelCallback(\n bookType === BookType.Order\n ? 'buy_overbalance'\n : 'long_overbalance'\n )\n }: ${Math.abs(matchedBucket.sentiment)}% </p>`\n : ''\n}${\n showSentiment && sentimentParam\n ? `<br /><p><b>${labelCallback('sentiment')}:</b></p>\n<p>${labelCallback('long')}: ${sentimentParam.value[2].toFixed(2)}% </p>\n<p>${labelCallback('short')}: ${sentimentParam.value[1].toFixed(2)}% </p>`\n : ''\n }`;\n};\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,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAK4B,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGrB,MAAMG,YAAY,GAAGC,IAAA;EAAA,IAAC;IAC3BC,SAAS;IACTC;EACkB,CAAC,GAAAF,IAAA;EAAA,OACnBC,SAAS,CACNE,MAAM,CAAC,CAACC,MAAM,EAAEC,KAAK,EAAEC,GAAG,KAAK;IAC9B,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,CAA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AAC,OAAAH,MAAA,CACCzF,uBAAY,CAACsG,mBAAmB,EAAAb,MAAA,CAAGW,IAAI,CAAC1G,kBAAkB,CAACC,SAAS,EAAE;IACvEE,GAAG,EAAE;EACP,CAAC,CAAC,EAAA4F,MAAA,CAAGzF,uBAAY,CAACsG,mBAAmB,CAAE;AAC7C,CAAC;AAAC1F,OAAA,CAAAuF,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getChartStyles.js","names":["_labsWidgetCommon","require","getChartStyles","isDark","sentimentLongColor","colorPalette","darkBlue90","lightBlue90","sentimentShortColor","darkYellow90","lightYellow90","candleLongColor","bottleGreenDark","bottleGreenLight","candleShortColor","orange","raspberryLight","sentimentAreaOpacity","tooltipLinesColor","sentimentLabelColor","white","black","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/getChartStyles.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nexport interface ChartStyles {\n sentimentLongColor: string;\n sentimentShortColor: string;\n candleLongColor: string;\n candleShortColor: string;\n sentimentAreaOpacity: number;\n tooltipLinesColor: string;\n sentimentLabelColor: string;\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 candleLongColor = isDark\n ? colorPalette.bottleGreenDark\n : colorPalette.bottleGreenLight;\n const candleShortColor = isDark\n ? colorPalette.orange\n : colorPalette.raspberryLight;\n const sentimentAreaOpacity = isDark ? 0.5 : 0.2;\n const tooltipLinesColor = isDark\n ? colorPalette.orange\n : colorPalette.bottleGreenLight;\n const sentimentLabelColor = isDark ? colorPalette.white : colorPalette.black;\n\n return {\n sentimentLongColor,\n sentimentShortColor,\n candleLongColor,\n candleShortColor,\n sentimentAreaOpacity,\n tooltipLinesColor,\n sentimentLabelColor,\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,eAAe,GAAGR,MAAM,GAC1BE,8BAAY,CAACO,eAAe,GAC5BP,8BAAY,CAACQ,gBAAgB;EACjC,MAAMC,gBAAgB,GAAGX,MAAM,GAC3BE,8BAAY,CAACU,MAAM,GACnBV,8BAAY,CAACW,cAAc;EAC/B,MAAMC,oBAAoB,GAAGd,MAAM,GAAG,GAAG,GAAG,GAAG;EAC/C,MAAMe,iBAAiB,GAAGf,MAAM,GAC5BE,8BAAY,CAACU,MAAM,GACnBV,8BAAY,CAACQ,gBAAgB;EACjC,MAAMM,mBAAmB,GAAGhB,MAAM,GAAGE,8BAAY,CAACe,KAAK,GAAGf,8BAAY,CAACgB,KAAK;EAE5E,OAAO;IACLjB,kBAAkB;IAClBI,mBAAmB;IACnBG,eAAe;IACfG,gBAAgB;IAChBG,oBAAoB;IACpBC,iBAAiB;IACjBC;EACF,CAAC;AACH,CAAC;AAACG,OAAA,CAAApB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getGridLines.js","names":["_labsWidgetCommon","require","_constants","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","getGridLines","_ref","isDark","isDesktop","WIDTH","MAIN_HEIGHT","MARGIN_BETWEEN","SENTIMENT_HEIGHT","X_LABEL_SIZE","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","CHART_CONFIG","getLineCommons","top","shape","x1","y1","x2","y2","right","left","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/getGridLines.ts"],"sourcesContent":["import { getLineCommons } from '@oanda/labs-widget-common';\n\nimport { CHART_CONFIG } from '../../../constants';\n\nexport const getGridLines = ({\n isDark,\n isDesktop,\n}: {\n isDark: boolean;\n isDesktop: boolean;\n}) => {\n const {\n WIDTH,\n MAIN_HEIGHT,\n MARGIN_BETWEEN,\n SENTIMENT_HEIGHT,\n X_LABEL_SIZE,\n Y_LABEL_SIZE_DESKTOP,\n Y_LABEL_SIZE_MOBILE,\n } = CHART_CONFIG;\n return [\n // Main Top\n {\n ...getLineCommons(isDark),\n top: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n },\n // Main Right\n {\n ...getLineCommons(isDark),\n right: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT + X_LABEL_SIZE + 2,\n },\n },\n // Main Bottom\n {\n ...getLineCommons(isDark),\n top: MAIN_HEIGHT - 2,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n },\n // Main Left\n {\n ...getLineCommons(isDark),\n left: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT + X_LABEL_SIZE + 2,\n },\n },\n // Main Y Label\n {\n ...getLineCommons(isDark),\n right: (isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) - 2,\n top: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT,\n },\n },\n // Main X Label\n {\n ...getLineCommons(isDark),\n top: MAIN_HEIGHT + X_LABEL_SIZE,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n },\n // Sentiment Top\n {\n ...getLineCommons(isDark),\n top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN - 2,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n },\n // Sentiment Right\n {\n ...getLineCommons(isDark),\n top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN - 2,\n right: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: SENTIMENT_HEIGHT,\n },\n },\n // Sentiment Bottom\n {\n ...getLineCommons(isDark),\n top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN + SENTIMENT_HEIGHT - 3,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n },\n // Sentiment Left\n {\n ...getLineCommons(isDark),\n top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN - 2,\n left: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: SENTIMENT_HEIGHT,\n },\n },\n // Sentiment Y Label\n {\n ...getLineCommons(isDark),\n right: (isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) - 3,\n top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN - 2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: SENTIMENT_HEIGHT,\n },\n },\n ];\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAAkD,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,C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