@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.
Files changed (289) hide show
  1. package/CHANGELOG.md +444 -0
  2. package/dist/main/CrowdViewWidget/Main.js +4 -2
  3. package/dist/main/CrowdViewWidget/Main.js.map +1 -1
  4. package/dist/main/CrowdViewWidget/components/Chart/Chart.js +41 -83
  5. package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  6. package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +23 -17
  7. package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  8. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +24 -0
  9. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -0
  10. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +30 -0
  11. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -0
  12. package/dist/main/CrowdViewWidget/components/Chart/{utils → chartOptions}/getGridLines.js +30 -49
  13. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
  14. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +159 -0
  15. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -0
  16. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +47 -0
  17. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
  18. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +83 -0
  19. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
  20. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +68 -0
  21. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
  22. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +60 -0
  23. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -0
  24. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +31 -0
  25. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -0
  26. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +57 -0
  27. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
  28. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +66 -0
  29. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
  30. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js +127 -0
  31. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -0
  32. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +18 -0
  33. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -0
  34. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js +18 -0
  35. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -0
  36. package/dist/main/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.js +4 -4
  37. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -0
  38. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +14 -0
  39. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -0
  40. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +23 -0
  41. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -0
  42. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +14 -0
  43. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -0
  44. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +120 -0
  45. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
  46. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +59 -0
  47. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -0
  48. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +34 -0
  49. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -0
  50. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js +116 -0
  51. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -0
  52. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +15 -0
  53. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -0
  54. package/dist/main/CrowdViewWidget/{utils/instrumentUtils.js → components/Chart/dataUtils/getInstrumentConfigForDivision.js} +3 -3
  55. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map +1 -0
  56. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js +19 -0
  57. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map +1 -0
  58. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js +18 -0
  59. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -0
  60. package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.js +19 -8
  61. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
  62. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
  63. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
  64. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
  65. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
  66. package/dist/main/CrowdViewWidget/components/Chart/getOption.js +115 -0
  67. package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
  68. package/dist/main/CrowdViewWidget/components/Chart/index.js +11 -11
  69. package/dist/main/CrowdViewWidget/components/Chart/index.js.map +1 -1
  70. package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -1
  71. package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +15 -12
  72. package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
  73. package/dist/main/CrowdViewWidget/components/Legend/Legend.js +15 -12
  74. package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  75. package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +15 -16
  76. package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  77. package/dist/main/CrowdViewWidget/constants.js +20 -14
  78. package/dist/main/CrowdViewWidget/constants.js.map +1 -1
  79. package/dist/main/CrowdViewWidget/selectConfig.js +0 -6
  80. package/dist/main/CrowdViewWidget/selectConfig.js.map +1 -1
  81. package/dist/main/translations/sources/en.json +3 -1
  82. package/dist/module/CrowdViewWidget/Main.js +4 -2
  83. package/dist/module/CrowdViewWidget/Main.js.map +1 -1
  84. package/dist/module/CrowdViewWidget/components/Chart/Chart.js +43 -84
  85. package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  86. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +22 -16
  87. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  88. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +17 -0
  89. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -0
  90. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +23 -0
  91. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -0
  92. package/dist/module/CrowdViewWidget/components/Chart/{utils → chartOptions}/getGridLines.js +30 -49
  93. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
  94. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +151 -0
  95. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -0
  96. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +39 -0
  97. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
  98. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +76 -0
  99. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
  100. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +61 -0
  101. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
  102. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +53 -0
  103. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -0
  104. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +24 -0
  105. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -0
  106. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +50 -0
  107. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
  108. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +59 -0
  109. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
  110. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +12 -0
  111. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -0
  112. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +11 -0
  113. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -0
  114. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js +11 -0
  115. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -0
  116. package/dist/module/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.js +4 -4
  117. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -0
  118. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +6 -0
  119. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -0
  120. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +16 -0
  121. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -0
  122. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +7 -0
  123. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -0
  124. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +113 -0
  125. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
  126. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +52 -0
  127. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -0
  128. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +27 -0
  129. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -0
  130. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +11 -0
  131. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -0
  132. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +8 -0
  133. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -0
  134. package/dist/module/CrowdViewWidget/{utils/instrumentUtils.js → components/Chart/dataUtils/getInstrumentConfigForDivision.js} +3 -3
  135. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map +1 -0
  136. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js +12 -0
  137. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map +1 -0
  138. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js +11 -0
  139. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -0
  140. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js +8 -0
  141. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
  142. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
  143. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
  144. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
  145. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
  146. package/dist/module/CrowdViewWidget/components/Chart/getOption.js +108 -0
  147. package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
  148. package/dist/module/CrowdViewWidget/components/Chart/index.js +1 -1
  149. package/dist/module/CrowdViewWidget/components/Chart/index.js.map +1 -1
  150. package/dist/module/CrowdViewWidget/components/Chart/types.js.map +1 -1
  151. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +8 -5
  152. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
  153. package/dist/module/CrowdViewWidget/components/Legend/Legend.js +15 -12
  154. package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  155. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +15 -16
  156. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  157. package/dist/module/CrowdViewWidget/constants.js +18 -13
  158. package/dist/module/CrowdViewWidget/constants.js.map +1 -1
  159. package/dist/module/CrowdViewWidget/selectConfig.js +0 -6
  160. package/dist/module/CrowdViewWidget/selectConfig.js.map +1 -1
  161. package/dist/module/translations/sources/en.json +3 -1
  162. package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
  163. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.d.ts +6 -0
  164. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.d.ts +6 -0
  165. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridLines.d.ts +7 -0
  166. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.d.ts +8 -0
  167. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +8 -0
  168. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts +12 -0
  169. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts +8 -0
  170. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +18 -0
  171. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.d.ts +7 -0
  172. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.d.ts +7 -0
  173. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.d.ts +7 -0
  174. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/index.d.ts +11 -0
  175. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.d.ts +1 -0
  176. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.d.ts +1 -0
  177. package/dist/types/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.d.ts +2 -2
  178. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.d.ts +1 -0
  179. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getLabelData.d.ts +2 -0
  180. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getRectColor.d.ts +1 -0
  181. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +12 -0
  182. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.d.ts +4 -0
  183. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.d.ts +3 -0
  184. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/index.d.ts +10 -0
  185. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.d.ts +1 -0
  186. package/dist/types/CrowdViewWidget/{utils/instrumentUtils.d.ts → components/Chart/dataUtils/getInstrumentConfigForDivision.d.ts} +2 -2
  187. package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.d.ts +2 -0
  188. package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.d.ts +2 -0
  189. package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.d.ts +3 -2
  190. package/dist/types/CrowdViewWidget/components/Chart/index.d.ts +1 -1
  191. package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +5 -0
  192. package/dist/types/CrowdViewWidget/components/Legend/Legend.d.ts +1 -4
  193. package/dist/types/CrowdViewWidget/components/Legend/LegendBar.d.ts +1 -3
  194. package/dist/types/CrowdViewWidget/constants.d.ts +13 -9
  195. package/package.json +3 -3
  196. package/src/CrowdViewWidget/Main.tsx +3 -2
  197. package/src/CrowdViewWidget/components/Chart/Chart.tsx +76 -109
  198. package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +33 -28
  199. package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +22 -0
  200. package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +29 -0
  201. package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +126 -0
  202. package/src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts +191 -0
  203. package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +44 -0
  204. package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts +103 -0
  205. package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts +72 -0
  206. package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +74 -0
  207. package/src/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.ts +32 -0
  208. package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +68 -0
  209. package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +60 -0
  210. package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +11 -0
  211. package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.ts +13 -0
  212. package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.ts +16 -0
  213. package/src/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.ts +9 -6
  214. package/src/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.ts +16 -0
  215. package/src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts +18 -0
  216. package/src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts +27 -0
  217. package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +212 -0
  218. package/src/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.ts +75 -0
  219. package/src/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.ts +37 -0
  220. package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +10 -0
  221. package/src/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.ts +13 -0
  222. package/src/CrowdViewWidget/{utils/instrumentUtils.ts → components/Chart/dataUtils/getInstrumentConfigForDivision.ts} +2 -2
  223. package/src/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.ts +13 -0
  224. package/src/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.ts +14 -0
  225. package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.ts +3 -2
  226. package/src/CrowdViewWidget/components/Chart/getOption.ts +138 -0
  227. package/src/CrowdViewWidget/components/Chart/index.ts +1 -1
  228. package/src/CrowdViewWidget/components/Chart/types.ts +5 -0
  229. package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +14 -7
  230. package/src/CrowdViewWidget/components/Legend/Legend.tsx +24 -22
  231. package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +29 -26
  232. package/src/CrowdViewWidget/constants.ts +30 -19
  233. package/src/CrowdViewWidget/selectConfig.ts +0 -8
  234. package/src/translations/sources/en.json +3 -1
  235. package/test/components/Chart/utils/chartUtils.test.ts +20 -9
  236. package/test/components/Chart/utils/getChartStyles.test.ts +10 -10
  237. package/test/components/Chart/utils/handleLabelUpdate.test.ts +419 -0
  238. package/test/components/Chart/utils/handleTooltipUpdate.test.ts +140 -0
  239. package/test/components/Chart/utils/processSentiments.test.ts +1 -1
  240. package/test/components/Legend.test.tsx +15 -23
  241. package/test/components/LegendBar.test.tsx +45 -63
  242. package/test/utils/instrumentUtils.test.ts +1 -1
  243. package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js +0 -399
  244. package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
  245. package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -126
  246. package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +0 -1
  247. package/dist/main/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +0 -1
  248. package/dist/main/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +0 -1
  249. package/dist/main/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
  250. package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
  251. package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
  252. package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +0 -1
  253. package/dist/main/CrowdViewWidget/components/Chart/utils/validateData.js.map +0 -1
  254. package/dist/main/CrowdViewWidget/utils/instrumentUtils.js.map +0 -1
  255. package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js +0 -391
  256. package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
  257. package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -113
  258. package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +0 -1
  259. package/dist/module/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +0 -1
  260. package/dist/module/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +0 -1
  261. package/dist/module/CrowdViewWidget/components/Chart/utils/index.js +0 -7
  262. package/dist/module/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
  263. package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
  264. package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
  265. package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +0 -1
  266. package/dist/module/CrowdViewWidget/components/Chart/utils/validateData.js.map +0 -1
  267. package/dist/module/CrowdViewWidget/utils/instrumentUtils.js.map +0 -1
  268. package/dist/types/CrowdViewWidget/components/Chart/utils/chartUtils.d.ts +0 -30
  269. package/dist/types/CrowdViewWidget/components/Chart/utils/getGridLines.d.ts +0 -97
  270. package/src/CrowdViewWidget/components/Chart/chartOptions.ts +0 -449
  271. package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +0 -228
  272. package/src/CrowdViewWidget/components/Chart/utils/getGridLines.ts +0 -148
  273. /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.js +0 -0
  274. /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.js +0 -0
  275. /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.js +0 -0
  276. /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +0 -0
  277. /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.js +0 -0
  278. /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.js +0 -0
  279. /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.js +0 -0
  280. /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +0 -0
  281. /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.d.ts +0 -0
  282. /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.d.ts +0 -0
  283. /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.d.ts +0 -0
  284. /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.d.ts +0 -0
  285. /package/dist/types/CrowdViewWidget/components/Chart/{chartOptions.d.ts → getOption.d.ts} +0 -0
  286. /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.ts +0 -0
  287. /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.ts +0 -0
  288. /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.ts +0 -0
  289. /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.ts +0 -0
@@ -0,0 +1,23 @@
1
+ import { CHART_CONFIG } from '../../../constants';
2
+ export const getGridConfig = _ref => {
3
+ let {
4
+ isDesktop
5
+ } = _ref;
6
+ return [{
7
+ id: 'main-grid',
8
+ name: 'main-grid',
9
+ left: "".concat(isDesktop ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE, "px"),
10
+ right: "".concat(isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE, "px"),
11
+ top: "".concat(isDesktop ? CHART_CONFIG.TOP_MARGIN_DESKTOP : CHART_CONFIG.TOP_MARGIN_MOBILE, "px"),
12
+ bottom: "".concat(CHART_CONFIG.X_LABEL_SIZE, "px"),
13
+ height: "".concat(isDesktop ? CHART_CONFIG.MAIN_HEIGHT - CHART_CONFIG.TOP_MARGIN_DESKTOP : CHART_CONFIG.MAIN_HEIGHT - CHART_CONFIG.TOP_MARGIN_MOBILE, "px")
14
+ }, {
15
+ id: 'sentiment-grid',
16
+ name: 'sentiment-grid',
17
+ left: "".concat(isDesktop ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE, "px"),
18
+ right: "".concat(isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE, "px"),
19
+ top: "".concat(isDesktop ? CHART_CONFIG.TOP_MARGIN_DESKTOP : CHART_CONFIG.TOP_MARGIN_MOBILE, "px"),
20
+ height: "".concat(isDesktop ? CHART_CONFIG.MAIN_HEIGHT - CHART_CONFIG.TOP_MARGIN_DESKTOP : CHART_CONFIG.MAIN_HEIGHT - CHART_CONFIG.TOP_MARGIN_MOBILE, "px")
21
+ }];
22
+ };
23
+ //# sourceMappingURL=getGridConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGridConfig.js","names":["CHART_CONFIG","getGridConfig","_ref","isDesktop","id","name","left","concat","Y_SENTIMENT_LABEL_DESKTOP_SIZE","Y_SENTIMENT_LABEL_MOBILE_SIZE","right","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","top","TOP_MARGIN_DESKTOP","TOP_MARGIN_MOBILE","bottom","X_LABEL_SIZE","height","MAIN_HEIGHT"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts"],"sourcesContent":["import type { GridComponentOption } from 'echarts';\n\nimport { CHART_CONFIG } from '../../../constants';\n\ninterface GetGridConfigParams {\n isDesktop: boolean;\n}\n\nexport const getGridConfig = ({\n isDesktop,\n}: GetGridConfigParams): GridComponentOption[] => [\n {\n id: 'main-grid',\n name: 'main-grid',\n left: `${isDesktop ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE}px`,\n right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,\n top: `${isDesktop ? CHART_CONFIG.TOP_MARGIN_DESKTOP : CHART_CONFIG.TOP_MARGIN_MOBILE}px`,\n bottom: `${CHART_CONFIG.X_LABEL_SIZE}px`,\n height: `${isDesktop ? CHART_CONFIG.MAIN_HEIGHT - CHART_CONFIG.TOP_MARGIN_DESKTOP : CHART_CONFIG.MAIN_HEIGHT - CHART_CONFIG.TOP_MARGIN_MOBILE}px`,\n },\n {\n id: 'sentiment-grid',\n name: 'sentiment-grid',\n left: `${isDesktop ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE}px`,\n right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,\n top: `${isDesktop ? CHART_CONFIG.TOP_MARGIN_DES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AY,CAACc,kBAAkB,GAAGd,YAAY,CAACe,iBAAiB,OAAI;IACxFG,MAAM,KAAAX,MAAA,CAAKJ,SAAS,GAAGH,YAAY,CAACmB,WAAW,GAAGnB,YAAY,CAACc,kBAAkB,GAAGd,YAAY,CAACmB,WAAW,GAAGnB,YAAY,CAACe,iBAAiB;EAC/I,CAAC,CACF;AAAA","ignoreList":[]}
@@ -13,12 +13,11 @@ export const getGridLines = _ref => {
13
13
  const {
14
14
  WIDTH,
15
15
  MAIN_HEIGHT,
16
- MARGIN_BETWEEN,
17
- SENTIMENT_HEIGHT,
18
- X_LABEL_SIZE,
19
- Y_LABEL_SIZE_DESKTOP,
20
- Y_LABEL_SIZE_MOBILE
16
+ X_LABEL_SIZE
21
17
  } = CHART_CONFIG;
18
+ const ySentimentLabelSize = isDesktop ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;
19
+ const yLabelSize = isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE;
20
+ const topMargin = isDesktop ? 0 : CHART_CONFIG.TOP_MARGIN_MOBILE;
22
21
  return [_objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
23
22
  top: -2,
24
23
  shape: {
@@ -26,7 +25,8 @@ export const getGridLines = _ref => {
26
25
  y1: 0,
27
26
  x2: WIDTH,
28
27
  y2: 0
29
- }
28
+ },
29
+ z: 30
30
30
  }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
31
31
  right: -2,
32
32
  shape: {
@@ -34,15 +34,17 @@ export const getGridLines = _ref => {
34
34
  y1: 0,
35
35
  x2: 0,
36
36
  y2: MAIN_HEIGHT + X_LABEL_SIZE + 2
37
- }
37
+ },
38
+ z: 30
38
39
  }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
39
- top: MAIN_HEIGHT - 2,
40
+ bottom: -2,
40
41
  shape: {
41
42
  x1: 0,
42
43
  y1: 0,
43
44
  x2: WIDTH,
44
45
  y2: 0
45
- }
46
+ },
47
+ z: 30
46
48
  }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
47
49
  left: -2,
48
50
  shape: {
@@ -50,67 +52,46 @@ export const getGridLines = _ref => {
50
52
  y1: 0,
51
53
  x2: 0,
52
54
  y2: MAIN_HEIGHT + X_LABEL_SIZE + 2
53
- }
55
+ },
56
+ z: 30
54
57
  }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
55
- right: (isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) - 2,
56
- top: -2,
58
+ right: yLabelSize - 3,
59
+ top: topMargin - 2,
57
60
  shape: {
58
61
  x1: 0,
59
62
  y1: 0,
60
63
  x2: 0,
61
- y2: MAIN_HEIGHT
62
- }
64
+ y2: MAIN_HEIGHT - topMargin
65
+ },
66
+ z: 30
63
67
  }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
64
- top: MAIN_HEIGHT + X_LABEL_SIZE,
68
+ left: ySentimentLabelSize - 2,
69
+ top: topMargin - 2,
65
70
  shape: {
66
71
  x1: 0,
67
72
  y1: 0,
68
- x2: WIDTH,
69
- y2: 0
70
- }
73
+ x2: 0,
74
+ y2: MAIN_HEIGHT - topMargin
75
+ },
76
+ z: 30
71
77
  }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
72
- top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN - 2,
78
+ bottom: X_LABEL_SIZE - 3,
73
79
  shape: {
74
80
  x1: 0,
75
81
  y1: 0,
76
82
  x2: WIDTH,
77
83
  y2: 0
78
- }
84
+ },
85
+ z: 30
79
86
  }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
80
- top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN - 2,
81
- right: -2,
82
- shape: {
83
- x1: 0,
84
- y1: 0,
85
- x2: 0,
86
- y2: SENTIMENT_HEIGHT
87
- }
88
- }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
89
- top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN + SENTIMENT_HEIGHT - 3,
87
+ top: topMargin - 3,
90
88
  shape: {
91
89
  x1: 0,
92
90
  y1: 0,
93
91
  x2: WIDTH,
94
92
  y2: 0
95
- }
96
- }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
97
- top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN - 2,
98
- left: -2,
99
- shape: {
100
- x1: 0,
101
- y1: 0,
102
- x2: 0,
103
- y2: SENTIMENT_HEIGHT
104
- }
105
- }), _objectSpread(_objectSpread({}, getLineCommons(isDark)), {}, {
106
- right: (isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE) - 3,
107
- top: MAIN_HEIGHT + X_LABEL_SIZE + MARGIN_BETWEEN - 2,
108
- shape: {
109
- x1: 0,
110
- y1: 0,
111
- x2: 0,
112
- y2: SENTIMENT_HEIGHT
113
- }
93
+ },
94
+ z: 30
114
95
  })];
115
96
  };
116
97
  //# sourceMappingURL=getGridLines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getGridLines.js","names":["getLineCommons","CHART_CONFIG","getGridLines","_ref","isDark","isDesktop","WIDTH","MAIN_HEIGHT","X_LABEL_SIZE","ySentimentLabelSize","Y_SENTIMENT_LABEL_DESKTOP_SIZE","Y_SENTIMENT_LABEL_MOBILE_SIZE","yLabelSize","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","topMargin","TOP_MARGIN_MOBILE","_objectSpread","top","shape","x1","y1","x2","y2","z","right","bottom","left"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts"],"sourcesContent":["import { getLineCommons } from '@oanda/labs-widget-common';\nimport type { GraphicComponentOption } from 'echarts';\n\nimport { CHART_CONFIG } from '../../../constants';\n\ninterface GetGridLinesParams {\n isDark: boolean;\n isDesktop: boolean;\n}\n\nexport const getGridLines = ({\n isDark,\n isDesktop,\n}: GetGridLinesParams): GraphicComponentOption[] => {\n const { WIDTH, MAIN_HEIGHT, X_LABEL_SIZE } = CHART_CONFIG;\n const ySentimentLabelSize = isDesktop\n ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE\n : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;\n\n const yLabelSize = isDesktop\n ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP\n : CHART_CONFIG.Y_LABEL_SIZE_MOBILE;\n\n const topMargin = isDesktop ? 0 : CHART_CONFIG.TOP_MARGIN_MOBILE;\n\n return [\n // Top\n {\n ...getLineCommons(isDark),\n top: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n z: 30,\n },\n // 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 z: 30,\n },\n // Bottom\n {\n ...getLineCommons(isDark),\n bottom: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n z: 30,\n },\n // 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 z: 30,\n },\n // Y Label\n {\n ...getLineCommons(isDark),\n right: yLabelSize - 3,\n top: topMargin - 2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT - topMargin,\n },\n z: 30,\n },\n // Y Sentiment Label\n {\n ...getLineCommons(isDark),\n left: ySentimentLabelSize - 2,\n top: topMargin - 2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: MAIN_HEIGHT - topMargin,\n },\n z: 30,\n },\n // X Label\n {\n ...getLineCommons(isDark),\n bottom: X_LABEL_SIZE - 3,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n z: 30,\n },\n // X Mobile Label\n {\n ...getLineCommons(isDark),\n top: topMargin - 3,\n shape: {\n x1: 0,\n y1: 0,\n x2: WIDTH,\n y2: 0,\n },\n z: 30,\n },\n ];\n};\n"],"mappings":";;;;;AAAA,SAASA,cAAc,QAAQ,2BAA2B;AAG1D,SAASC,YAAY,QAAQ,oBAAoB;AAOjD,OAAO,MAAMC,YAAY,GAAGC,IAAA,IAGwB;EAAA,IAHvB;IAC3BC,MAAM;IACNC;EACkB,CAAC,GAAAF,IAAA;EACnB,MAAM;IAAEG,KAAK;IAAEC,WAAW;IAAEC;EAAa,CAAC,GAAGP,YAAY;EACzD,MAAMQ,mBAAmB,GAAGJ,SAAS,GACjCJ,YAAY,CAACS,8BAA8B,GAC3CT,YAAY,CAACU,6BAA6B;EAE9C,MAAMC,UAAU,GAAGP,SAAS,GACxBJ,YAAY,CAACY,oBAAoB,GACjCZ,YAAY,CAACa,mBAAmB;EAEpC,MAAMC,SAAS,GAAGV,SAAS,GAAG,CAAC,GAAGJ,YAAY,CAACe,iBAAiB;EAEhE,OAAO,CAAAC,aAAA,CAAAA,aAAA,KAGAjB,cAAc,CAACI,MAAM,CAAC;IACzBc,GAAG,EAAE,CAAC,CAAC;IACPC,KAAK,EAAE;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEhB,KAAK;MACTiB,EAAE,EAAE;IACN,CAAC;IACDC,CAAC,EAAE;EAAE,IAAAP,aAAA,CAAAA,aAAA,KAIFjB,cAAc,CAACI,MAAM,CAAC;IACzBqB,KAAK,EAAE,CAAC,CAAC;IACTN,KAAK,EAAE;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEhB,WAAW,GAAGC,YAAY,GAAG;IACnC,CAAC;I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BW,KAAK,EAAE;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEhB,KAAK;MACTiB,EAAE,EAAE;IACN,CAAC;IACDC,CAAC,EAAE;EAAE,IAAAP,aAAA,CAAAA,aAAA,KAIFjB,cAAc,CAACI,MAAM,CAAC;IACzBc,GAAG,EAAEH,SAAS,GAAG,CAAC;IAClBI,KAAK,EAAE;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEhB,KAAK;MACTiB,EAAE,EAAE;IACN,CAAC;IACDC,CAAC,EAAE;EAAE,GAER;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,151 @@
1
+ import { colorPalette } from '@oanda/labs-widget-common';
2
+ import chroma from 'chroma-js';
3
+ import { CHART_CONFIG } from '../../../constants';
4
+ export const getLabelsConfig = _ref => {
5
+ let {
6
+ isDark,
7
+ isDesktop,
8
+ labelCallback
9
+ } = _ref;
10
+ const ySentimentLabelSize = isDesktop ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;
11
+ const yMainLabelSize = isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE;
12
+ const textColor = isDark ? colorPalette.white : colorPalette.black;
13
+ const labelBackgroundColor = isDark ? colorPalette.darkGray : colorPalette.white;
14
+ const backgroundColor = isDark ? colorPalette.black : colorPalette.white;
15
+ const shadowColor = chroma(colorPalette.black).alpha(0.1).hex();
16
+ const sentimentText = labelCallback('sentiment').toUpperCase();
17
+ const priceText = labelCallback('price').toUpperCase();
18
+ const sentimentEstimatedWidth = 10 * sentimentText.length * 0.65;
19
+ const priceEstimatedWidth = 10 * priceText.length * 0.65;
20
+ const sentimentVerticalOffset = sentimentEstimatedWidth / 2;
21
+ const priceVerticalOffset = priceEstimatedWidth / 2;
22
+ const topMargin = isDesktop ? CHART_CONFIG.TOP_MARGIN_DESKTOP : CHART_CONFIG.TOP_MARGIN_MOBILE;
23
+ return [{
24
+ type: 'group',
25
+ left: "".concat(ySentimentLabelSize + 5, "px'"),
26
+ top: "".concat(topMargin + 5, "px"),
27
+ silent: true,
28
+ children: [{
29
+ type: 'rect',
30
+ z: 100,
31
+ right: 'center',
32
+ top: 'middle',
33
+ shape: {
34
+ width: 50,
35
+ height: 24
36
+ },
37
+ style: {
38
+ fill: labelBackgroundColor,
39
+ shadowBlur: 8,
40
+ shadowOffsetX: 0,
41
+ shadowOffsetY: 1,
42
+ shadowColor: shadowColor
43
+ }
44
+ }, {
45
+ type: 'text',
46
+ z: 100,
47
+ right: 'center',
48
+ top: 'middle',
49
+ style: {
50
+ fontSize: 11,
51
+ fontFamily: 'Sofia W03',
52
+ fontWeight: 500,
53
+ fill: textColor,
54
+ width: 70,
55
+ height: 30,
56
+ text: labelCallback('short')
57
+ }
58
+ }]
59
+ }, {
60
+ type: 'group',
61
+ left: "".concat(ySentimentLabelSize + 5, "px'"),
62
+ top: "".concat(CHART_CONFIG.MAIN_HEIGHT - 24 - 5, "px"),
63
+ silent: true,
64
+ children: [{
65
+ type: 'rect',
66
+ z: 100,
67
+ right: 'center',
68
+ top: 'middle',
69
+ shape: {
70
+ width: 50,
71
+ height: 24
72
+ },
73
+ style: {
74
+ fill: labelBackgroundColor,
75
+ shadowBlur: 8,
76
+ shadowOffsetX: 0,
77
+ shadowOffsetY: 1,
78
+ shadowColor: shadowColor
79
+ }
80
+ }, {
81
+ type: 'text',
82
+ z: 100,
83
+ right: 'center',
84
+ top: 'middle',
85
+ style: {
86
+ fontSize: 11,
87
+ fontFamily: 'Sofia W03',
88
+ fontWeight: 500,
89
+ fill: textColor,
90
+ width: 70,
91
+ height: 30,
92
+ text: labelCallback('long')
93
+ }
94
+ }]
95
+ }, {
96
+ type: 'text',
97
+ z: 30,
98
+ rotation: isDesktop ? Math.PI / 2 : 0,
99
+ left: "5px",
100
+ top: isDesktop ? "".concat(topMargin + CHART_CONFIG.MAIN_HEIGHT / 2 - sentimentVerticalOffset, "px") : "".concat(topMargin - 18, "px"),
101
+ silent: true,
102
+ style: {
103
+ fontSize: 10,
104
+ fontFamily: 'Sofia W03',
105
+ fontWeight: 300,
106
+ fill: textColor,
107
+ text: sentimentText
108
+ }
109
+ }, {
110
+ type: 'text',
111
+ z: 30,
112
+ rotation: isDesktop ? -Math.PI / 2 : 0,
113
+ right: "5px",
114
+ top: isDesktop ? "".concat(topMargin + CHART_CONFIG.MAIN_HEIGHT / 2 - priceVerticalOffset, "px") : "".concat(topMargin - 18, "px"),
115
+ silent: true,
116
+ style: {
117
+ fontSize: 10,
118
+ fontFamily: 'Sofia W03',
119
+ fontWeight: 300,
120
+ fill: textColor,
121
+ text: priceText
122
+ }
123
+ }, {
124
+ type: 'rect',
125
+ z: 20,
126
+ right: '0px',
127
+ top: '0px',
128
+ shape: {
129
+ width: yMainLabelSize,
130
+ height: CHART_CONFIG.MAIN_HEIGHT
131
+ },
132
+ silent: true,
133
+ style: {
134
+ fill: backgroundColor
135
+ }
136
+ }, {
137
+ type: 'rect',
138
+ z: 20,
139
+ left: '0px',
140
+ top: '0px',
141
+ shape: {
142
+ width: ySentimentLabelSize,
143
+ height: CHART_CONFIG.MAIN_HEIGHT
144
+ },
145
+ silent: true,
146
+ style: {
147
+ fill: backgroundColor
148
+ }
149
+ }];
150
+ };
151
+ //# sourceMappingURL=getLabelsConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLabelsConfig.js","names":["colorPalette","chroma","CHART_CONFIG","getLabelsConfig","_ref","isDark","isDesktop","labelCallback","ySentimentLabelSize","Y_SENTIMENT_LABEL_DESKTOP_SIZE","Y_SENTIMENT_LABEL_MOBILE_SIZE","yMainLabelSize","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","textColor","white","black","labelBackgroundColor","darkGray","backgroundColor","shadowColor","alpha","hex","sentimentText","toUpperCase","priceText","sentimentEstimatedWidth","length","priceEstimatedWidth","sentimentVerticalOffset","priceVerticalOffset","topMargin","TOP_MARGIN_DESKTOP","TOP_MARGIN_MOBILE","type","left","concat","top","silent","children","z","right","shape","width","height","style","fill","shadowBlur","shadowOffsetX","shadowOffsetY","fontSize","fontFamily","fontWeight","text","MAIN_HEIGHT","rotation","Math","PI"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport chroma from 'chroma-js';\nimport type { GraphicComponentOption } from 'echarts';\n\nimport { CHART_CONFIG } from '../../../constants';\n\ninterface getLabelsConfigParams {\n isDark: boolean;\n isDesktop: boolean;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n}\n\nexport const getLabelsConfig = ({\n isDark,\n isDesktop,\n labelCallback,\n}: getLabelsConfigParams): GraphicComponentOption[] => {\n const ySentimentLabelSize = isDesktop\n ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE\n : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;\n\n const yMainLabelSize = isDesktop\n ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP\n : CHART_CONFIG.Y_LABEL_SIZE_MOBILE;\n\n const textColor = isDark ? colorPalette.white : colorPalette.black;\n const labelBackgroundColor = isDark\n ? colorPalette.darkGray\n : colorPalette.white;\n const backgroundColor = isDark ? colorPalette.black : colorPalette.white;\n const shadowColor = chroma(colorPalette.black).alpha(0.1).hex();\n\n // Estimate text width for centering rotated text\n // Approximate: fontSize * characterCount * 0.65 (typical character width ratio)\n const sentimentText = labelCallback('sentiment').toUpperCase();\n const priceText = labelCallback('price').toUpperCase();\n const sentimentEstimatedWidth = 10 * sentimentText.length * 0.65;\n const priceEstimatedWidth = 10 * priceText.length * 0.65;\n const sentimentVerticalOffset = sentimentEstimatedWidth / 2;\n const priceVerticalOffset = priceEstimatedWidth / 2;\n\n const topMargin = isDesktop\n ? CHART_CONFIG.TOP_MARGIN_DESKTOP\n : CHART_CONFIG.TOP_MARGIN_MOBILE;\n\n return [\n {\n type: 'group',\n left: `${ySentimentLabelSize + 5}px'`,\n top: `${topMargin + 5}px`,\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 50,\n height: 24,\n },\n style: {\n fill: labelBackgroundColor,\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: shadowColor,\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n fontSize: 11,\n fontFamily: 'Sofia W03',\n fontWeight: 500,\n fill: textColor,\n width: 70,\n height: 30,\n text: labelCallback('short'),\n },\n },\n ],\n },\n {\n type: 'group',\n left: `${ySentimentLabelSize + 5}px'`,\n top: `${CHART_CONFIG.MAIN_HEIGHT - 24 - 5}px`,\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 50,\n height: 24,\n },\n style: {\n fill: labelBackgroundColor,\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: shadowColor,\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n fontSize: 11,\n fontFamily: 'Sofia W03',\n fontWeight: 500,\n fill: textColor,\n width: 70,\n height: 30,\n text: labelCallback('long'),\n },\n },\n ],\n },\n\n {\n type: 'text',\n z: 30,\n rotation: isDesktop ? Math.PI / 2 : 0,\n left: `5px`,\n top: isDesktop\n ? `${topMargin + CHART_CONFIG.MAIN_HEIGHT / 2 - sentimentVerticalOffset}px`\n : `${topMargin - 18}px`,\n silent: true,\n style: {\n fontSize: 10,\n fontFamily: 'Sofia W03',\n fontWeight: 300,\n fill: textColor,\n text: sentimentText,\n },\n },\n {\n type: 'text',\n z: 30,\n rotation: isDesktop ? -Math.PI / 2 : 0,\n right: `5px`,\n top: isDesktop\n ? `${topMargin + CHART_CONFIG.MAIN_HEIGHT / 2 - priceVerticalOffset}px`\n : `${topMargin - 18}px`,\n silent: true,\n style: {\n fontSize: 10,\n fontFamily: 'Sofia W03',\n fontWeight: 300,\n fill: textColor,\n text: priceText,\n },\n },\n {\n type: 'rect',\n z: 20,\n right: '0px',\n top: '0px',\n shape: {\n width: yMainLabelSize,\n height: CHART_CONFIG.MAIN_HEIGHT,\n },\n silent: true,\n style: {\n fill: backgroundColor,\n },\n },\n {\n type: 'rect',\n z: 20,\n left: '0px',\n top: '0px',\n shape: {\n width: ySentimentLabelSize,\n height: CHART_CONFIG.MAIN_HEIGHT,\n },\n silent: true,\n style: {\n fill: backgroundColor,\n },\n },\n ];\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AACxD,OAAOC,MAAM,MAAM,WAAW;AAG9B,SAASC,YAAY,QAAQ,oBAAoB;AAQjD,OAAO,MAAMC,eAAe,GAAGC,IAAA,IAIwB;EAAA,IAJvB;IAC9BC,MAAM;IACNC,SAAS;IACTC;EACqB,CAAC,GAAAH,IAAA;EACtB,MAAMI,mBAAmB,GAAGF,SAAS,GACjCJ,YAAY,CAACO,8BAA8B,GAC3CP,YAAY,CAACQ,6BAA6B;EAE9C,MAAMC,cAAc,GAAGL,SAAS,GAC5BJ,YAAY,CAACU,oBAAoB,GACjCV,YAAY,CAACW,mBAAmB;EAEpC,MAAMC,SAAS,GAAGT,MAAM,GAAGL,YAAY,CAACe,KAAK,GAAGf,YAAY,CAACgB,KAAK;EAClE,MAAMC,oBAAoB,GAAGZ,MAAM,GAC/BL,YAAY,CAACkB,QAAQ,GACrBlB,YAAY,CAACe,KAAK;EACtB,MAAMI,eAAe,GAAGd,MAAM,GAAGL,YAAY,CAACgB,KAAK,GAAGhB,YAAY,CAACe,KAAK;EACxE,MAAMK,WAAW,GAAGnB,MAAM,CAACD,YAAY,CAACgB,KAAK,CAAC,CAACK,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC;EAI/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AAE1C,YAAY,CAACoD;IACvB,CAAC;IACDhB,MAAM,EAAE,IAAI;IACZO,KAAK,EAAE;MACLC,IAAI,EAAE3B;IACR;EACF,CAAC,CACF;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ import chroma from 'chroma-js';
2
+ export const getSeriesCandlestickConfig = _ref => {
3
+ let {
4
+ styles,
5
+ isLoading
6
+ } = _ref;
7
+ const {
8
+ candleLongColor,
9
+ candleShortColor
10
+ } = styles;
11
+ return {
12
+ animation: isLoading,
13
+ type: 'candlestick',
14
+ id: 'candlestick',
15
+ xAxisIndex: 0,
16
+ yAxisIndex: 0,
17
+ silent: true,
18
+ clip: true,
19
+ large: true,
20
+ encode: {
21
+ x: 'dates',
22
+ y: ['open', 'close', 'low', 'high']
23
+ },
24
+ itemStyle: {
25
+ color: chroma(candleLongColor).desaturate().css(),
26
+ color0: chroma(candleShortColor).desaturate().css(),
27
+ borderColor: candleLongColor,
28
+ borderColor0: candleShortColor
29
+ },
30
+ emphasis: {
31
+ itemStyle: {
32
+ color: candleLongColor,
33
+ color0: candleShortColor
34
+ }
35
+ },
36
+ z: 3
37
+ };
38
+ };
39
+ //# sourceMappingURL=getSeriesCandlestickConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSeriesCandlestickConfig.js","names":["chroma","getSeriesCandlestickConfig","_ref","styles","isLoading","candleLongColor","candleShortColor","animation","type","id","xAxisIndex","yAxisIndex","silent","clip","large","encode","x","y","itemStyle","color","desaturate","css","color0","borderColor","borderColor0","emphasis","z"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts"],"sourcesContent":["import chroma from 'chroma-js';\nimport type { CandlestickSeriesOption } from 'echarts';\n\nimport type { ChartStyles } from '../chartUtils/getChartStyles';\n\ninterface GetSeriesCandlestickConfigParams {\n styles: ChartStyles;\n isLoading: boolean;\n}\n\nexport const getSeriesCandlestickConfig = ({\n styles,\n isLoading,\n}: GetSeriesCandlestickConfigParams): CandlestickSeriesOption => {\n const { candleLongColor, candleShortColor } = styles;\n\n return {\n animation: isLoading,\n type: 'candlestick',\n id: 'candlestick',\n xAxisIndex: 0,\n yAxisIndex: 0,\n silent: true,\n clip: true,\n large: true,\n encode: {\n x: 'dates',\n y: ['open', 'close', 'low', 'high'],\n },\n itemStyle: {\n color: chroma(candleLongColor).desaturate().css(),\n color0: chroma(candleShortColor).desaturate().css(),\n borderColor: candleLongColor,\n borderColor0: candleShortColor,\n },\n emphasis: {\n itemStyle: {\n color: candleLongColor,\n color0: candleShortColor,\n },\n },\n z: 3,\n };\n};\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,WAAW;AAU9B,OAAO,MAAMC,0BAA0B,GAAGC,IAAA,IAGuB;EAAA,IAHtB;IACzCC,MAAM;IACNC;EACgC,CAAC,GAAAF,IAAA;EACjC,MAAM;IAAEG,eAAe;IAAEC;EAAiB,CAAC,GAAGH,MAAM;EAEpD,OAAO;IACLI,SAAS,EAAEH,SAAS;IACpBI,IAAI,EAAE,aAAa;IACnBC,EAAE,EAAE,aAAa;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,CAAC;IACbC,MAAM,EAAE,IAAI;IACZC,IAAI,EAAE,IAAI;IACVC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE;MACNC,CAAC,EAAE,OAAO;MACVC,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;IACpC,CAAC;IACDC,SAAS,EAAE;MACTC,KAAK,EAAEnB,MAAM,CAACK,eAAe,CAAC,CAACe,UAAU,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC;MACjDC,MAAM,EAAEtB,MAAM,CAACM,gBAAgB,CAAC,CAACc,UAAU,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC;MACnDE,WAAW,EAAElB,eAAe;MAC5BmB,YAAY,EAAElB;IAChB,CAAC;IACDmB,QAAQ,EAAE;MACRP,SAAS,EAAE;QACTC,KAAK,EAAEd,eAAe;QACtBiB,MAAM,EAAEhB;MACV;IACF,CAAC;IACDoB,CAAC,EAAE;EACL,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,76 @@
1
+ import { getRectColor } from '../chartUtils';
2
+ export const getSeriesHeatmapConfig = _ref => {
3
+ let {
4
+ bucketWidth,
5
+ buckets,
6
+ isDark,
7
+ sentimentThresholdMax,
8
+ sentimentThresholdMin,
9
+ isLoading
10
+ } = _ref;
11
+ return {
12
+ animation: isLoading,
13
+ type: 'custom',
14
+ id: 'heatmap',
15
+ name: 'heatmap',
16
+ xAxisIndex: 0,
17
+ yAxisIndex: 0,
18
+ encode: {
19
+ x: 'dates',
20
+ y: 'bookPrices'
21
+ },
22
+ dimensions: ['dates', 'bookPrices', 'bookIndexes'],
23
+ clip: true,
24
+ renderItem: (params, api) => {
25
+ const animationDelay = 350 * params.dataIndexInside / params.dataInsideLength;
26
+ const xVal = api.value(0);
27
+ const bucketIndex = api.value(2);
28
+ if (bucketIndex == null) {
29
+ return null;
30
+ }
31
+ const metaValues = buckets[bucketIndex];
32
+ if (!metaValues) {
33
+ return null;
34
+ }
35
+ const [rectWidth, rectHeight] = api.size([0, bucketWidth]);
36
+ const items = metaValues.map(_ref2 => {
37
+ let {
38
+ price,
39
+ sentiment
40
+ } = _ref2;
41
+ const start = api.coord([xVal, price]);
42
+ return {
43
+ silent: true,
44
+ shape: {
45
+ height: rectHeight,
46
+ width: rectWidth + 1,
47
+ x: start[0] - rectWidth / 2,
48
+ y: start[1] - rectHeight
49
+ },
50
+ style: {
51
+ fill: getRectColor(sentiment, isDark, sentimentThresholdMin, sentimentThresholdMax)
52
+ },
53
+ enterFrom: {
54
+ shape: {},
55
+ style: {
56
+ opacity: 0
57
+ }
58
+ },
59
+ enterAnimation: {
60
+ duration: 150,
61
+ delay: animationDelay
62
+ },
63
+ type: 'rect'
64
+ };
65
+ });
66
+ return {
67
+ children: items,
68
+ emphasisDisabled: true,
69
+ silent: true,
70
+ type: 'group'
71
+ };
72
+ },
73
+ z: 1
74
+ };
75
+ };
76
+ //# sourceMappingURL=getSeriesHeatmapConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSeriesHeatmapConfig.js","names":["getRectColor","getSeriesHeatmapConfig","_ref","bucketWidth","buckets","isDark","sentimentThresholdMax","sentimentThresholdMin","isLoading","animation","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","clip","renderItem","params","api","animationDelay","dataIndexInside","dataInsideLength","xVal","value","bucketIndex","metaValues","rectWidth","rectHeight","size","items","map","_ref2","price","sentiment","start","coord","silent","shape","height","width","style","fill","enterFrom","opacity","enterAnimation","duration","delay","children","emphasisDisabled","z"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts"],"sourcesContent":["import type {\n CustomSeriesOption,\n CustomSeriesRenderItemAPI,\n CustomSeriesRenderItemParams,\n} from 'echarts';\n\nimport { getRectColor } from '../chartUtils';\nimport type { Bucket } from '../types';\n\ninterface GetSeriesHeatmapConfigParams {\n bucketWidth: number;\n buckets: Bucket[][];\n isDark: boolean;\n sentimentThresholdMax: number;\n sentimentThresholdMin: number;\n isLoading: boolean;\n}\n\nexport const getSeriesHeatmapConfig = ({\n bucketWidth,\n buckets,\n isDark,\n sentimentThresholdMax,\n sentimentThresholdMin,\n isLoading,\n}: GetSeriesHeatmapConfigParams): CustomSeriesOption => {\n return {\n animation: isLoading,\n type: 'custom',\n id: 'heatmap',\n name: 'heatmap',\n xAxisIndex: 0,\n yAxisIndex: 0,\n encode: {\n x: 'dates',\n y: 'bookPrices',\n },\n dimensions: ['dates', 'bookPrices', 'bookIndexes'],\n clip: true,\n renderItem: (\n params: CustomSeriesRenderItemParams,\n api: CustomSeriesRenderItemAPI\n ) => {\n const animationDelay =\n (350 * params.dataIndexInside) / params.dataInsideLength;\n const xVal = api.value(0);\n const bucketIndex = api.value(2) as number;\n\n if (bucketIndex == null) {\n return null;\n }\n\n const metaValues = buckets[bucketIndex];\n\n if (!metaValues) {\n return null;\n }\n\n const [rectWidth, rectHeight] = api.size!([0, bucketWidth]) as number[];\n\n const items = metaValues.map(({ price, sentiment }: Bucket) => {\n const start = api.coord([xVal, price]);\n\n return {\n silent: true,\n shape: {\n height: rectHeight,\n width: rectWidth + 1,\n x: start[0] - rectWidth / 2,\n y: start[1] - rectHeight,\n },\n style: {\n fill: getRectColor(\n sentiment,\n isDark,\n sentimentThresholdMin,\n sentimentThresholdMax\n ),\n },\n enterFrom: {\n shape: {},\n style: {\n opacity: 0,\n },\n },\n enterAnimation: {\n duration: 150,\n delay: animationDelay,\n },\n type: 'rect' as const,\n };\n });\n\n return {\n children: items,\n emphasisDisabled: true,\n silent: true,\n type: 'group' as const,\n };\n },\n z: 1,\n };\n};\n"],"mappings":"AAMA,SAASA,YAAY,QAAQ,eAAe;AAY5C,OAAO,MAAMC,sBAAsB,GAAGC,IAAA,IAOkB;EAAA,IAPjB;IACrCC,WAAW;IACXC,OAAO;IACPC,MAAM;IACNC,qBAAqB;IACrBC,qBAAqB;IACrBC;EAC4B,CAAC,GAAAN,IAAA;EAC7B,OAAO;IACLO,SAAS,EAAED,SAAS;IACpBE,IAAI,EAAE,QAAQ;IACdC,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,SAAS;IACfC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,CAAC;IACbC,MAAM,EAAE;MACNC,CAAC,EAAE,OAAO;MACVC,CAAC,EAAE;IACL,CAAC;IACDC,UAAU,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,aAAa,CAAC;IAClDC,IAAI,EAAE,IAAI;IACVC,UAAU,EAAEA,CACVC,MAAoC,EACpCC,GAA8B,KAC3B;MACH,MAAMC,cAAc,GACjB,GAAG,GAAGF,MAAM,CAACG,eAAe,GAAIH,MAAM,CAACI,gBAAgB;MAC1D,MAAMC,IAAI,GAAGJ,GAAG,CAACK,KAAK,CAAC,CAAC,CAAC;MACzB,MAAMC,W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9B,IAAI,EAAE;MACR,CAAC;IACH,CAAC;IACD2C,CAAC,EAAE;EACL,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,61 @@
1
+ import { colorPalette } from '@oanda/labs-widget-common';
2
+ export const getSeriesSentimentConfig = _ref => {
3
+ let {
4
+ styles,
5
+ isLoading
6
+ } = _ref;
7
+ return {
8
+ animation: isLoading,
9
+ animationDelay: 350,
10
+ type: 'line',
11
+ id: 'sentiment',
12
+ name: 'sentiment',
13
+ xAxisIndex: 1,
14
+ yAxisIndex: 1,
15
+ encode: {
16
+ x: 'dates',
17
+ y: 'sentimentLongs'
18
+ },
19
+ dimensions: ['dates', 'sentimentLongs', 'sentimentShorts'],
20
+ lineStyle: {
21
+ width: styles.sentimentOutlineWidth,
22
+ opacity: 1,
23
+ shadowColor: styles.sentimentOutlineColor,
24
+ shadowBlur: 3
25
+ },
26
+ emphasis: {
27
+ disabled: true
28
+ },
29
+ tooltip: {
30
+ show: false
31
+ },
32
+ markLine: {
33
+ animation: isLoading,
34
+ silent: true,
35
+ symbol: ['none', 'none'],
36
+ label: {
37
+ show: false
38
+ },
39
+ lineStyle: {
40
+ color: colorPalette.grayLight,
41
+ width: 1
42
+ },
43
+ data: [{
44
+ yAxis: 20
45
+ }, {
46
+ yAxis: 50,
47
+ lineStyle: {
48
+ width: 1
49
+ }
50
+ }, {
51
+ yAxis: 80
52
+ }]
53
+ },
54
+ showSymbol: false,
55
+ symbol: 'none',
56
+ z: 2,
57
+ connectNulls: true,
58
+ silent: true
59
+ };
60
+ };
61
+ //# sourceMappingURL=getSeriesSentimentConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSeriesSentimentConfig.js","names":["colorPalette","getSeriesSentimentConfig","_ref","styles","isLoading","animation","animationDelay","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","lineStyle","width","sentimentOutlineWidth","opacity","shadowColor","sentimentOutlineColor","shadowBlur","emphasis","disabled","tooltip","show","markLine","silent","symbol","label","color","grayLight","data","yAxis","showSymbol","z","connectNulls"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport type { LineSeriesOption } from 'echarts';\n\nimport type { ChartStyles } from '../chartUtils';\n\ninterface GetSeriesSentimentConfigParams {\n styles: ChartStyles;\n isLoading: boolean;\n}\n\nexport const getSeriesSentimentConfig = ({\n styles,\n isLoading,\n}: GetSeriesSentimentConfigParams): LineSeriesOption => {\n return {\n animation: isLoading,\n animationDelay: 350,\n type: 'line',\n id: 'sentiment',\n name: 'sentiment',\n xAxisIndex: 1,\n yAxisIndex: 1,\n encode: {\n x: 'dates',\n y: 'sentimentLongs',\n },\n dimensions: ['dates', 'sentimentLongs', 'sentimentShorts'],\n lineStyle: {\n width: styles.sentimentOutlineWidth,\n opacity: 1,\n shadowColor: styles.sentimentOutlineColor,\n shadowBlur: 3,\n },\n emphasis: {\n disabled: true,\n },\n tooltip: {\n show: false,\n },\n markLine: {\n animation: isLoading,\n silent: true,\n symbol: ['none', 'none'],\n label: {\n show: false,\n },\n lineStyle: {\n color: colorPalette.grayLight,\n width: 1,\n },\n data: [\n {\n yAxis: 20,\n },\n {\n yAxis: 50,\n lineStyle: {\n width: 1,\n },\n },\n {\n yAxis: 80,\n },\n ],\n },\n showSymbol: false,\n symbol: 'none',\n z: 2,\n connectNulls: true,\n silent: true,\n };\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAUxD,OAAO,MAAMC,wBAAwB,GAAGC,IAAA,IAGgB;EAAA,IAHf;IACvCC,MAAM;IACNC;EAC8B,CAAC,GAAAF,IAAA;EAC/B,OAAO;IACLG,SAAS,EAAED,SAAS;IACpBE,cAAc,EAAE,GAAG;IACnBC,IAAI,EAAE,MAAM;IACZC,EAAE,EAAE,WAAW;IACfC,IAAI,EAAE,WAAW;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,CAAC;IACbC,MAAM,EAAE;MACNC,CAAC,EAAE,OAAO;MACVC,CAAC,EAAE;IACL,CAAC;IACDC,UAAU,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,CAAC;IAC1DC,SAAS,EAAE;MACTC,KAAK,EAAEd,MAAM,CAACe,qBAAqB;MACnCC,OAAO,EAAE,CAAC;MACVC,WAAW,EAAEjB,MAAM,CAACkB,qBAAqB;MACzCC,UAAU,EAAE;IACd,CAAC;IACDC,QAAQ,EAAE;MACRC,QAAQ,EAAE;IACZ,CAAC;IACDC,OAAO,EAAE;MACPC,IAAI,EAAE;IACR,CAAC;IACDC,QAAQ,EAAE;MACRtB,SAAS,EAAED,SAAS;MACpBwB,MAAM,EAAE,IAAI;MACZC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;MACxBC,KAAK,EAAE;QACLJ,IAAI,EAAE;MACR,CAAC;MACDV,SAAS,EAAE;QACTe,KAAK,EAAE/B,YAAY,CAACgC,SAAS;QAC7Bf,KAAK,EAAE;MACT,CAAC;MACDgB,IAAI,EAAE,CACJ;QACEC,KAAK,EAAE;MACT,CAAC,EACD;QACEA,KAAK,EAAE,EAAE;QACTlB,SAAS,EAAE;UACTC,KAAK,EAAE;QACT;MACF,CAAC,EACD;QACEiB,KAAK,EAAE;MACT,CAAC;IAEL,CAAC;IACDC,UAAU,EAAE,KAAK;IACjBN,MAAM,EAAE,MAAM;IACdO,CAAC,EAAE,CAAC;IACJC,YAAY,EAAE,IAAI;IAClBT,MAAM,EAAE;EACV,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ import { CHART_CONFIG } from '../../../constants';
2
+ import { getTooltipFormatter } from '../chartUtils';
3
+ export const getTooltipConfig = _ref => {
4
+ let {
5
+ bookType,
6
+ bucketWidth,
7
+ buckets,
8
+ displayPrecision,
9
+ labelCallback,
10
+ selectedPriceRef,
11
+ tooltipLinesColor,
12
+ sentimentLongs,
13
+ sentimentShorts
14
+ } = _ref;
15
+ return {
16
+ trigger: 'axis',
17
+ formatter: params => getTooltipFormatter({
18
+ bookType,
19
+ bucketWidth,
20
+ buckets,
21
+ labelCallback,
22
+ params: params,
23
+ selectedPrice: selectedPriceRef.current,
24
+ sentimentLongs,
25
+ sentimentShorts
26
+ }),
27
+ hideDelay: 0,
28
+ axisPointer: {
29
+ type: 'cross',
30
+ axis: 'x',
31
+ lineStyle: {
32
+ color: tooltipLinesColor
33
+ },
34
+ crossStyle: {
35
+ color: tooltipLinesColor
36
+ },
37
+ label: {
38
+ padding: 0,
39
+ lineHeight: 24,
40
+ formatter: params => {
41
+ if (params.axisDimension === 'y' && params.axisIndex === 0) {
42
+ selectedPriceRef.current = Number(params.value);
43
+ return " ".concat(Number(params.value).toFixed(displayPrecision), " ");
44
+ }
45
+ return '';
46
+ }
47
+ }
48
+ },
49
+ confine: true,
50
+ position: point => [point[0] + CHART_CONFIG.TOOLTIP_OFFSET, point[1] + CHART_CONFIG.TOOLTIP_OFFSET]
51
+ };
52
+ };
53
+ //# sourceMappingURL=getTooltipConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTooltipConfig.js","names":["CHART_CONFIG","getTooltipFormatter","getTooltipConfig","_ref","bookType","bucketWidth","buckets","displayPrecision","labelCallback","selectedPriceRef","tooltipLinesColor","sentimentLongs","sentimentShorts","trigger","formatter","params","selectedPrice","current","hideDelay","axisPointer","type","axis","lineStyle","color","crossStyle","label","padding","lineHeight","axisDimension","axisIndex","Number","value","concat","toFixed","confine","position","point","TOOLTIP_OFFSET"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts"],"sourcesContent":["import type { TooltipComponentOption } from 'echarts';\n\nimport type { BookType } from '../../../../gql/types/graphql';\nimport { CHART_CONFIG } from '../../../constants';\nimport { getTooltipFormatter } from '../chartUtils';\nimport type { Bucket, TooltipParam } from '../types';\n\ninterface GetTooltipConfigParams {\n bookType: BookType;\n bucketWidth: number;\n buckets: Bucket[][];\n displayPrecision: number;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n selectedPriceRef: { current: number };\n tooltipLinesColor: string;\n sentimentLongs: (number | null)[];\n sentimentShorts: (number | null)[];\n}\n\nexport const getTooltipConfig = ({\n bookType,\n bucketWidth,\n buckets,\n displayPrecision,\n labelCallback,\n selectedPriceRef,\n tooltipLinesColor,\n sentimentLongs,\n sentimentShorts,\n}: GetTooltipConfigParams): TooltipComponentOption => ({\n trigger: 'axis' as const,\n formatter: (params) =>\n getTooltipFormatter({\n bookType,\n bucketWidth,\n buckets,\n labelCallback,\n params: params as unknown as TooltipParam[],\n selectedPrice: selectedPriceRef.current,\n sentimentLongs,\n sentimentShorts,\n }),\n hideDelay: 0,\n axisPointer: {\n type: 'cross' as const,\n axis: 'x' as const,\n lineStyle: {\n color: tooltipLinesColor,\n },\n crossStyle: {\n color: tooltipLinesColor,\n },\n label: {\n padding: 0,\n lineHeight: 24,\n formatter: (params: {\n axisDimension?: string;\n axisIndex?: number;\n value: unknown;\n }) => {\n if (params.axisDimension === 'y' && params.axisIndex === 0) {\n selectedPriceRef.current = Number(params.value);\n return ` ${Number(params.value).toFixed(displayPrecision)} `;\n }\n return '';\n },\n },\n },\n confine: true,\n position: (point) => [\n point[0] + CHART_CONFIG.TOOLTIP_OFFSET,\n point[1] + CHART_CONFIG.TOOLTIP_OFFSET,\n ],\n});\n"],"mappings":"AAGA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,eAAe;AAenD,OAAO,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IAC/BC,QAAQ;IACRC,WAAW;IACXC,OAAO;IACPC,gBAAgB;IAChBC,aAAa;IACbC,gBAAgB;IAChBC,iBAAiB;IACjBC,cAAc;IACdC;EACsB,CAAC,GAAAT,IAAA;EAAA,OAA8B;IACrDU,OAAO,EAAE,MAAe;IACxBC,SAAS,EAAGC,MAAM,IAChBd,mBAAmB,CAAC;MAClBG,QAAQ;MACRC,WAAW;MACXC,OAAO;MACPE,aAAa;MACbO,MAAM,EAAEA,MAAmC;MAC3CC,aAAa,EAAEP,gBAAgB,CAACQ,OAAO;MACvCN,cAAc;MACdC;IACF,CAAC,CAAC;IACJM,SAAS,EAAE,CAAC;IACZC,WAAW,EAAE;MACXC,IAAI,EAAE,OAAgB;MACtBC,IAAI,EAAE,GAAY;MAClBC,SAAS,EAAE;QACTC,KAAK,EAAEb;MACT,CAAC;MACDc,UAAU,EAAE;QACVD,KAAK,EAAEb;MACT,CAAC;MACDe,KAAK,EAAE;QACLC,OAAO,EAAE,CAAC;QACVC,UAAU,EAAE,EAAE;QACdb,SAAS,EAAGC,MAIX,IAAK;UACJ,IAAIA,MAAM,CAACa,aAAa,KAAK,GAAG,IAAIb,MAAM,CAACc,SAAS,KAAK,CAAC,EAAE;YAC1DpB,gBAAgB,CAACQ,OAAO,GAAGa,MAAM,CAACf,MAAM,CAACgB,KAAK,CAAC;YAC/C,WAAAC,MAAA,CAAWF,MAAM,CAACf,MAAM,CAACgB,KAAK,CAAC,CAACE,OAAO,CAAC1B,gBAAgB,CAAC;UAC3D;UACA,OAAO,EAAE;QACX;MACF;IACF,CAAC;IACD2B,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAGC,KAAK,IAAK,CACnBA,KAAK,CAAC,CAAC,CAAC,GAAGpC,YAAY,CAACqC,cAAc,EACtCD,KAAK,CAAC,CAAC,CAAC,GAAGpC,YAAY,CAACqC,cAAc;EAE1C,CAAC;AAAA,CAAC","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ import { CHART_CONFIG } from '../../../constants';
2
+ export const getVisualMapConfig = _ref => {
3
+ let {
4
+ sentimentLongColor,
5
+ sentimentShortColor
6
+ } = _ref;
7
+ return {
8
+ show: false,
9
+ dimension: 1,
10
+ seriesId: 'sentiment',
11
+ pieces: [{
12
+ lt: CHART_CONFIG.SENTIMENT_MAX / 2,
13
+ color: sentimentShortColor
14
+ }, {
15
+ gte: CHART_CONFIG.SENTIMENT_MAX / 2,
16
+ lte: CHART_CONFIG.SENTIMENT_MAX,
17
+ color: sentimentLongColor
18
+ }, {
19
+ gt: CHART_CONFIG.SENTIMENT_MAX,
20
+ color: sentimentLongColor
21
+ }]
22
+ };
23
+ };
24
+ //# sourceMappingURL=getVisualMapConfig.js.map