@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
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGridLines.js","names":["getLineCommons","CHART_CONFIG","getGridLines","_ref","isDark","isDesktop","WIDTH","MAIN_HEIGHT","MARGIN_BETWEEN","SENTIMENT_HEIGHT","X_LABEL_SIZE","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","_objectSpread","top","shape","x1","y1","x2","y2","right","left"],"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,SAASA,cAAc,QAAQ,2BAA2B;AAE1D,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,OAAO,MAAMC,YAAY,GAAGC,IAAA,IAMtB;EAAA,IANuB;IAC3BC,MAAM;IACNC;EAIF,CAAC,GAAAF,IAAA;EACC,MAAM;IACJG,KAAK;IACLC,WAAW;IACXC,cAAc;IACdC,gBAAgB;IAChBC,YAAY;IACZC,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AC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEV;IACN;EAAC,IAAAI,aAAA,CAAAA,aAAA,KAIEb,cAAc,CAACI,MAAM,CAAC;IACzBgB,KAAK,EAAE,CAACf,SAAS,GAAGM,oBAAoB,GAAGC,mBAAmB,IAAI,CAAC;IACnEE,GAAG,EAAEP,WAAW,GAAGG,YAAY,GAAGF,cAAc,GAAG,CAAC;IACpDO,KAAK,EAAE;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEV;IACN;EAAC,GAEJ;AACH,CAAC","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- export * from './chartUtils';
2
- export * from './getChartStyles';
3
- export * from './processOrderPositionBooks';
4
- export * from './processPriceCandles';
5
- export * from './processSentiments';
6
- export * from './validateData';
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/index.ts"],"sourcesContent":["export * from './chartUtils';\nexport * from './getChartStyles';\nexport * from './processOrderPositionBooks';\nexport * from './processPriceCandles';\nexport * from './processSentiments';\nexport * from './validateData';\n"],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,kBAAkB;AAChC,cAAc,6BAA6B;AAC3C,cAAc,uBAAuB;AACrC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"processOrderPositionBooks.js","names":["processOrderPositionBooks","orderPositionData","dates","_orderPositionData$or","_orderPositionData$or2","_orderPositionData$or3","_orderPositionData$or4","Array","isArray","length","bookPrices","bookIndexes","buckets","bucketWidth","sentimentThresholdMin","sentimentThresholdMax","hasValidBooks","orderPositionBooks","books","booksDataMap","Map","map","item","time","price","forEach","date","index","_book$price","book","get","currentBuckets","filter","bucket","sentiment","Math","abs","push"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.ts"],"sourcesContent":["import type { GetOrderPositionBooksQuery } from '../../../../gql/types/graphql';\nimport type { Bucket } from '../types';\n\nexport const processOrderPositionBooks = (\n orderPositionData: GetOrderPositionBooksQuery | undefined,\n dates: string[]\n) => {\n // Input validation\n if (!Array.isArray(dates) || dates.length === 0) {\n return {\n bookPrices: [],\n bookIndexes: [],\n buckets: [],\n bucketWidth: 0,\n sentimentThresholdMin: 0,\n sentimentThresholdMax: 0,\n hasValidBooks: false,\n };\n }\n\n if (\n !orderPositionData?.orderPositionBooks?.books?.length ||\n !orderPositionData?.orderPositionBooks?.sentimentThresholdMin ||\n !orderPositionData?.orderPositionBooks?.sentimentThresholdMax ||\n !orderPositionData?.orderPositionBooks?.bucketWidth\n ) {\n return {\n bookPrices: [],\n bookIndexes: [],\n buckets: [],\n bucketWidth: 0,\n sentimentThresholdMin: 0,\n sentimentThresholdMax: 0,\n hasValidBooks: false,\n };\n }\n\n const { bucketWidth, sentimentThresholdMin, sentimentThresholdMax } =\n orderPositionData.orderPositionBooks;\n\n const booksDataMap = new Map(\n orderPositionData.orderPositionBooks.books.map((item) => [\n item.time,\n {\n price: item.price,\n buckets: item.buckets,\n },\n ])\n );\n\n // Use forEach + push for O(n) performance instead of reduce with spreads (O(n²))\n const bookPrices: (number | null)[] = [];\n const bookIndexes: number[] = [];\n const buckets: Bucket[][] = [];\n\n dates.forEach((date, index) => {\n const book = booksDataMap.get(date);\n\n const currentBuckets =\n book?.buckets\n .filter(\n (\n bucket\n ): bucket is {\n price: number;\n sentiment: number;\n } =>\n bucket !== null &&\n typeof bucket.price === 'number' &&\n typeof bucket.sentiment === 'number' &&\n Math.abs(bucket.sentiment) >= sentimentThresholdMin\n )\n .map((bucket) => ({\n price: bucket.price,\n sentiment: bucket.sentiment,\n })) || [];\n\n bookPrices.push(book?.price ?? null);\n bookIndexes.push(index);\n buckets.push(currentBuckets);\n });\n\n return {\n bookPrices,\n bookIndexes,\n buckets,\n bucketWidth,\n sent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C0B,IAAI,CAACV,KAAK,CAAC;IACvBf,OAAO,CAACyB,IAAI,CAACN,cAAc,CAAC;EAC9B,CAAC,CAAC;EAEF,OAAO;IACLrB,UAAU;IACVC,WAAW;IACXC,OAAO;IACPC,WAAW;IACXC,qBAAqB;IACrBC,qBAAqB;IACrBC,aAAa,EAAE;EACjB,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"processPriceCandles.js","names":["processPriceCandles","priceCandlesData","_priceCandlesData$pri","_priceCandlesData$pri2","errorResult","minPrice","maxPrice","pipsLocation","hasValidCandles","candlesOpen","candlesClose","candlesLow","candlesHigh","dates","priceCandles","candle","length","reduce","acc","point","open","close","low","high","Math","min","max"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/processPriceCandles.ts"],"sourcesContent":["import type { GetPriceCandlesQuery } from '../../../../gql/types/graphql';\n\nexport const processPriceCandles = (\n priceCandlesData: GetPriceCandlesQuery | undefined\n) => {\n const errorResult = {\n minPrice: 0,\n maxPrice: 0,\n pipsLocation: 0,\n hasValidCandles: false,\n candlesOpen: [],\n candlesClose: [],\n candlesLow: [],\n candlesHigh: [],\n dates: [],\n };\n\n if (\n !priceCandlesData?.priceCandles?.candle?.length ||\n !priceCandlesData?.priceCandles?.pipsLocation\n ) {\n return errorResult;\n }\n\n const { dates, candlesOpen, candlesClose, candlesLow, candlesHigh } =\n priceCandlesData.priceCandles.candle.reduce(\n (acc, candle) => {\n if (!candle) {\n return acc;\n }\n\n return {\n dates: [...acc.dates, candle.point],\n candlesOpen: [...acc.candlesOpen, candle.open],\n candlesClose: [...acc.candlesClose, candle.close],\n candlesLow: [...acc.candlesLow, candle.low],\n candlesHigh: [...acc.candlesHigh, candle.high],\n };\n },\n {\n dates: [] as string[],\n candlesOpen: [] as number[],\n candlesClose: [] as number[],\n candlesLow: [] as number[],\n candlesHigh: [] as number[],\n }\n );\n\n if (dates.length === 0) {\n return errorResult;\n }\n\n const minPrice = Math.min(...candlesLow);\n const maxPrice = Math.max(...candlesHigh);\n\n return {\n minPrice,\n maxPrice,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n dates,\n hasValidCandles: true,\n pipsLocation: priceCandlesData.priceCandles.pipsLocation,\n };\n};\n"],"mappings":"AAEA,OAAO,MAAMA,mBAAmB,GAC9BC,gBAAkD,IAC/C;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EACH,MAAMC,WAAW,GAAG;IAClBC,QAAQ,EAAE,CAAC;IACXC,QAAQ,EAAE,CAAC;IACXC,YAAY,EAAE,CAAC;IACfC,eAAe,EAAE,KAAK;IACtBC,WAAW,EAAE,EAAE;IACfC,YAAY,EAAE,EAAE;IAChBC,UAAU,EAAE,EAAE;IACdC,WAAW,EAAE,EAAE;IACfC,KAAK,EAAE;EACT,CAAC;EAED,IACE,EAACZ,gBAAgB,aAAhBA,gBAAgB,gBAAAC,qBAAA,GAAhBD,gBAAgB,CAAEa,YAAY,cAAAZ,qBAAA,gBAAAA,qBAAA,GAA9BA,qBAAA,CAAgCa,MAAM,cAAAb,qBAAA,eAAtCA,qBAAA,CAAwCc,MAAM,KAC/C,EAACf,gBAAgB,aAAhBA,gBAAgB,gBAAAE,sBAAA,GAAhBF,gBAAgB,CAAEa,YAAY,cAAAX,sBAAA,eAA9BA,sBAAA,CAAgCI,YAAY,GAC7C;IACA,OAAOH,WAAW;EACpB;EAEA,MAAM;IAAES,KAAK;IAAEJ,WAAW;IAAEC,YAAY;IAAEC,UAAU;IAAEC;EAAY,CAAC,GACjEX,gBAAgB,CAACa,YAAY,CAACC,MAAM,CAACE,MAAM,CACzC,CAACC,GAAG,EAAEH,MAAM,KAAK;IACf,IAAI,CAACA,MAAM,EAAE;MACX,OAAOG,GAAG;IACZ;IAEA,OAAO;MACLL,KAAK,EAAE,CAAC,GAAGK,GAAG,CAACL,KAAK,EAAEE,MAAM,CAACI,KAAK,CAAC;MACnCV,WAAW,EAAE,CAAC,GAAGS,GAAG,CAACT,WAAW,EAAEM,MAAM,CAACK,IAAI,CAAC;MAC9CV,YAAY,EAAE,CAAC,GAAGQ,GAAG,CAACR,YAAY,EAAEK,MAAM,CAACM,KAAK,CAAC;MACjDV,UAAU,EAAE,CAAC,GAAGO,GAAG,CAACP,UAAU,EAAEI,MAAM,CAACO,GAAG,CAAC;MAC3CV,WAAW,EAAE,CAAC,GAAGM,GAAG,CAACN,WAAW,EAAEG,MAAM,CAACQ,IAAI;IAC/C,CAAC;EACH,CAAC,EACD;IACEV,KAAK,EAAE,EAAc;IACrBJ,WAAW,EAAE,EAAc;IAC3BC,YAAY,EAAE,EAAc;IAC5BC,UAAU,EAAE,EAAc;IAC1BC,WAAW,EAAE;EACf,CACF,CAAC;EAEH,IAAIC,KAAK,CAACG,MAAM,KAAK,CAAC,EAAE;IACtB,OAAOZ,WAAW;EACpB;EAEA,MAAMC,QAAQ,GAAGmB,IAAI,CAACC,GAAG,CAAC,GAAGd,UAAU,CAAC;EACxC,MAAML,QAAQ,GAAGkB,IAAI,CAACE,GAAG,CAAC,GAAGd,WAAW,CAAC;EAEzC,OAAO;IACLP,QAAQ;IACRC,QAAQ;IACRG,WAAW;IACXC,YAAY;IACZC,UAAU;IACVC,WAAW;IACXC,KAAK;IACLL,eAAe,EAAE,IAAI;IACrBD,YAAY,EAAEN,gBAAgB,CAACa,YAAY,CAACP;EAC9C,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"processSentiments.js","names":["processSentiments","sentimentsData","dates","_sentimentsData$senti","Array","isArray","length","sentiments","sentimentLongs","sentimentShorts","hasValidSentiments","sentimentMap","Map","map","item","_item$sentiment$short","_item$sentiment","_item$sentiment$longP","_item$sentiment2","time","sentiment","shortPercent","longPercent","reduce","acc","date","get"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/processSentiments.ts"],"sourcesContent":["import type { GetSentimentsQuery } from '../../../../gql/types/graphql';\n\nexport const processSentiments = (\n sentimentsData: GetSentimentsQuery | undefined,\n dates: string[]\n) => {\n if (\n !Array.isArray(dates) ||\n dates.length === 0 ||\n !sentimentsData?.sentiments?.sentiments?.length\n ) {\n return {\n sentimentLongs: [],\n sentimentShorts: [],\n hasValidSentiments: false,\n };\n }\n\n const sentimentMap = new Map(\n sentimentsData.sentiments.sentiments.map((item) => [\n item?.time,\n {\n sentimentShorts: item?.sentiment?.shortPercent ?? null,\n sentimentLongs: item?.sentiment?.longPercent ?? null,\n },\n ])\n );\n\n const { sentimentLongs, sentimentShorts } = dates.reduce(\n (acc, date) => {\n const sentiment = sentimentMap.get(date);\n\n return {\n sentimentLongs: [\n ...acc.sentimentLongs,\n sentiment?.sentimentLongs || null,\n ],\n sentimentShorts: [\n ...acc.sentimentShorts,\n sentiment?.sentimentShorts || null,\n ],\n };\n },\n {\n sentimentLongs: [] as (number | null)[],\n sentimentShorts: [] as (number | null)[],\n }\n );\n\n return {\n sentimentLongs,\n sentimentShorts,\n hasValidSentiments: true,\n };\n};\n"],"mappings":"AAEA,OAAO,MAAMA,iBAAiB,GAAGA,CAC/BC,cAA8C,EAC9CC,KAAe,KACZ;EAAA,IAAAC,qBAAA;EACH,IACE,CAACC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,IACrBA,KAAK,CAACI,MAAM,KAAK,CAAC,IAClB,EAACL,cAAc,aAAdA,cAAc,gBAAAE,qBAAA,GAAdF,cAAc,CAAEM,UAAU,cAAAJ,qBAAA,gBAAAA,qBAAA,GAA1BA,qBAAA,CAA4BI,UAAU,cAAAJ,qBAAA,eAAtCA,qBAAA,CAAwCG,MAAM,GAC/C;IACA,OAAO;MACLE,cAAc,EAAE,EAAE;MAClBC,eAAe,EAAE,EAAE;MACnBC,kBAAkB,EAAE;IACtB,CAAC;EACH;EAEA,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAC1BX,cAAc,CAACM,UAAU,CAACA,UAAU,CAACM,GAAG,CAAEC,IAAI;IAAA,IAAAC,qBAAA,EAAAC,eAAA,EAAAC,qBAAA,EAAAC,gBAAA;IAAA,OAAK,CACjDJ,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEK,IAAI,EACV;MACEV,eAAe,GAAAM,qBAAA,GAAED,IAAI,aAAJA,IAAI,gBAAAE,eAAA,GAAJF,IAAI,CAAEM,SAAS,cAAAJ,eAAA,uBAAfA,eAAA,CAAiBK,YAAY,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,IAAI;MACtDP,cAAc,GAAAS,qBAAA,GAAEH,IAAI,aAAJA,IAAI,gBAAAI,gBAAA,GAAJJ,IAAI,CAAEM,SAAS,cAAAF,gBAAA,uBAAfA,gBAAA,CAAiBI,WAAW,cAAAL,qBAAA,cAAAA,qBAAA,GAAI;IAClD,CAAC,CACF;EAAA,EACH,CAAC;EAED,MAAM;IAAET,cAAc;IAAEC;EAAgB,CAAC,GAAGP,KAAK,CAACqB,MAAM,CACtD,CAACC,GAAG,EAAEC,IAAI,KAAK;IACb,MAAML,SAAS,GAAGT,YAAY,CAACe,GAAG,CAACD,IAAI,CAAC;IAExC,OAAO;MACLjB,cAAc,EAAE,CACd,GAAGgB,GAAG,CAAChB,cAAc,EACrB,CAAAY,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEZ,cAAc,KAAI,IAAI,CAClC;MACDC,eAAe,EAAE,CACf,GAAGe,GAAG,CAACf,eAAe,EACtB,CAAAW,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEX,eAAe,KAAI,IAAI;IAEtC,CAAC;EACH,CAAC,EACD;IACED,cAAc,EAAE,EAAuB;IACvCC,eAAe,EAAE;EACnB,CACF,CAAC;EAED,OAAO;IACLD,cAAc;IACdC,eAAe;IACfC,kBAAkB,EAAE;EACtB,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateData.js","names":["validateData","priceCandlesData","orderPositionData","hasValidCandles","hasValidBooks","hasValidSentiments","_priceCandlesData$pri","_priceCandlesData$pri2","_orderPositionData$or","_orderPositionData$or2","hasValidPriceData","priceCandles","candle","length","hasValidOrderData","orderPositionBooks","books","Error"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/utils/validateData.ts"],"sourcesContent":["import type {\n GetOrderPositionBooksQuery,\n GetPriceCandlesQuery,\n} from '../../../../gql/types/graphql';\n\nexport const validateData = (\n priceCandlesData: GetPriceCandlesQuery | undefined,\n orderPositionData: GetOrderPositionBooksQuery | undefined,\n hasValidCandles: boolean,\n hasValidBooks: boolean,\n hasValidSentiments: boolean\n): Error | null => {\n const hasValidPriceData =\n (priceCandlesData?.priceCandles?.candle?.length ?? 0) >= 1;\n const hasValidOrderData =\n (orderPositionData?.orderPositionBooks?.books?.length ?? 0) >= 1;\n\n if (!hasValidPriceData) {\n return new Error('Insufficient price candle data');\n }\n if (!hasValidOrderData) {\n return new Error('Insufficient order position data');\n }\n if (!hasValidCandles) {\n return new Error('Invalid candle data');\n }\n if (!hasValidBooks) {\n return new Error('Invalid book data');\n }\n if (!hasValidSentiments) {\n return new Error('Invalid sentiment data');\n }\n\n return null;\n};\n"],"mappings":"AAKA,OAAO,MAAMA,YAAY,GAAGA,CAC1BC,gBAAkD,EAClDC,iBAAyD,EACzDC,eAAwB,EACxBC,aAAsB,EACtBC,kBAA2B,KACV;EAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,qBAAA,EAAAC,sBAAA;EACjB,MAAMC,iBAAiB,GACrB,EAAAJ,qBAAA,GAACL,gBAAgB,aAAhBA,gBAAgB,gBAAAM,sBAAA,GAAhBN,gBAAgB,CAAEU,YAAY,cAAAJ,sBAAA,gBAAAA,sBAAA,GAA9BA,sBAAA,CAAgCK,MAAM,cAAAL,sBAAA,uBAAtCA,sBAAA,CAAwCM,MAAM,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,CAAC,KAAK,CAAC;EAC5D,MAAMQ,iBAAiB,GACrB,EAAAN,qBAAA,GAACN,iBAAiB,aAAjBA,iBAAiB,gBAAAO,sBAAA,GAAjBP,iBAAiB,CAAEa,kBAAkB,cAAAN,sBAAA,gBAAAA,sBAAA,GAArCA,sBAAA,CAAuCO,KAAK,cAAAP,sBAAA,uBAA5CA,sBAAA,CAA8CI,MAAM,cAAAL,qBAAA,cAAAA,qBAAA,GAAI,CAAC,KAAK,CAAC;EAElE,IAAI,CAACE,iBAAiB,EAAE;IACtB,OAAO,IAAIO,KAAK,CAAC,gCAAgC,CAAC;EACpD;EACA,IAAI,CAACH,iBAAiB,EAAE;IACtB,OAAO,IAAIG,KAAK,CAAC,kCAAkC,CAAC;EACtD;EACA,IAAI,CAACd,eAAe,EAAE;IACpB,OAAO,IAAIc,KAAK,CAAC,qBAAqB,CAAC;EACzC;EACA,IAAI,CAACb,aAAa,EAAE;IAClB,OAAO,IAAIa,KAAK,CAAC,mBAAmB,CAAC;EACvC;EACA,IAAI,CAACZ,kBAAkB,EAAE;IACvB,OAAO,IAAIY,KAAK,CAAC,wBAAwB,CAAC;EAC5C;EAEA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"instrumentUtils.js","names":["Division","instrumentSelectConfig","instrumentSelectConfigOC","getInstrumentConfigForDivision","division","Oc"],"sources":["../../../../src/CrowdViewWidget/utils/instrumentUtils.ts"],"sourcesContent":["import { Division } from '../../gql/types/graphql';\nimport {\n instrumentSelectConfig,\n instrumentSelectConfigOC,\n} from '../selectConfig';\n\nexport const getInstrumentConfigForDivision = (division: Division) => {\n return division === Division.Oc\n ? instrumentSelectConfigOC\n : instrumentSelectConfig;\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,yBAAyB;AAClD,SACEC,sBAAsB,EACtBC,wBAAwB,QACnB,iBAAiB;AAExB,OAAO,MAAMC,8BAA8B,GAAIC,QAAkB,IAAK;EACpE,OAAOA,QAAQ,KAAKJ,QAAQ,CAACK,EAAE,GAC3BH,wBAAwB,GACxBD,sBAAsB;AAC5B,CAAC","ignoreList":[]}
@@ -1,30 +0,0 @@
1
- import { BookType, Granularity, TimeSpan } from '../../../../gql/types/graphql';
2
- import type { Bucket, GetLabelsDataProps, TooltipParam } from '../types';
3
- export declare const getLabelData: ({ dates, isGreaterThanTwoWeeks, }: GetLabelsDataProps) => {
4
- name: string;
5
- xAxis: string;
6
- y: number;
7
- silent: boolean;
8
- emphasis: {
9
- disabled: boolean;
10
- };
11
- label: {
12
- fontFamily: string;
13
- fontSize: number;
14
- position: string;
15
- align: string;
16
- formatter: string;
17
- };
18
- }[];
19
- export declare const isDifferenceGreaterThanTwoWeeks: (startDate: string, endDate: string) => boolean;
20
- export declare const getTimeSpanForGranularity: (granularity: Granularity) => TimeSpan;
21
- export declare const getRectColor: (sentiment: number, isDark: boolean, minThreshold: number, maxThreshold: number) => string;
22
- export declare const getTooltipFormatter: ({ params, buckets, bucketWidth, selectedPrice, bookType, labelCallback, }: {
23
- params: TooltipParam[];
24
- buckets: Bucket[][];
25
- bucketWidth: number;
26
- selectedPrice: number;
27
- bookType: BookType;
28
- labelCallback: (key: string) => string;
29
- }) => string | undefined;
30
- export declare const formatXAxisLabel: (value: unknown, isGreaterThanTwoWeeks: boolean) => string;
@@ -1,97 +0,0 @@
1
- export declare const getGridLines: ({ isDark, isDesktop, }: {
2
- isDark: boolean;
3
- isDesktop: boolean;
4
- }) => ({
5
- top: number;
6
- shape: {
7
- x1: number;
8
- y1: number;
9
- x2: 9999;
10
- y2: number;
11
- };
12
- type: string;
13
- silent: boolean;
14
- z: number;
15
- style: {
16
- stroke: string;
17
- lineWidth: number;
18
- };
19
- } | {
20
- right: number;
21
- shape: {
22
- x1: number;
23
- y1: number;
24
- x2: number;
25
- y2: number;
26
- };
27
- type: string;
28
- silent: boolean;
29
- z: number;
30
- style: {
31
- stroke: string;
32
- lineWidth: number;
33
- };
34
- } | {
35
- left: number;
36
- shape: {
37
- x1: number;
38
- y1: number;
39
- x2: number;
40
- y2: number;
41
- };
42
- type: string;
43
- silent: boolean;
44
- z: number;
45
- style: {
46
- stroke: string;
47
- lineWidth: number;
48
- };
49
- } | {
50
- right: number;
51
- top: number;
52
- shape: {
53
- x1: number;
54
- y1: number;
55
- x2: number;
56
- y2: 400;
57
- };
58
- type: string;
59
- silent: boolean;
60
- z: number;
61
- style: {
62
- stroke: string;
63
- lineWidth: number;
64
- };
65
- } | {
66
- top: number;
67
- right: number;
68
- shape: {
69
- x1: number;
70
- y1: number;
71
- x2: number;
72
- y2: 120;
73
- };
74
- type: string;
75
- silent: boolean;
76
- z: number;
77
- style: {
78
- stroke: string;
79
- lineWidth: number;
80
- };
81
- } | {
82
- top: number;
83
- left: number;
84
- shape: {
85
- x1: number;
86
- y1: number;
87
- x2: number;
88
- y2: 120;
89
- };
90
- type: string;
91
- silent: boolean;
92
- z: number;
93
- style: {
94
- stroke: string;
95
- lineWidth: number;
96
- };
97
- })[];
@@ -1,449 +0,0 @@
1
- import chroma from 'chroma-js';
2
-
3
- import {
4
- BUCKET_CONFIG,
5
- CHART_CONFIG,
6
- CHART_CONFIG_CALCULATED,
7
- } from '../../constants';
8
- import type { Bucket, GetOptionType, TooltipParam } from './types';
9
- import {
10
- formatXAxisLabel,
11
- getLabelData,
12
- getRectColor,
13
- getTooltipFormatter,
14
- isDifferenceGreaterThanTwoWeeks,
15
- } from './utils/chartUtils';
16
- import { getChartStyles } from './utils/getChartStyles';
17
- import { getGridLines } from './utils/getGridLines';
18
-
19
- // @ts-expect-error
20
- export const getOption: GetOptionType = ({
21
- mainData: {
22
- dates,
23
- candlesOpen,
24
- candlesClose,
25
- candlesLow,
26
- candlesHigh,
27
- bookPrices,
28
- bookIndexes,
29
- sentimentShorts,
30
- sentimentLongs,
31
- },
32
- additionalData: {
33
- bucketWidth,
34
- buckets,
35
- displayPrecision,
36
- bookType,
37
- sentimentThresholdMin,
38
- sentimentThresholdMax,
39
- },
40
- isDark,
41
- isDesktop,
42
- labelCallback,
43
- }) => {
44
- let selectedPrice: number;
45
- const {
46
- sentimentLongColor,
47
- sentimentShortColor,
48
- candleLongColor,
49
- candleShortColor,
50
- sentimentAreaOpacity,
51
- tooltipLinesColor,
52
- sentimentLabelColor,
53
- } = getChartStyles(isDark);
54
-
55
- const visibleXAxisData = dates.slice(
56
- (dates.length * CHART_CONFIG.INITIAL_START_ZOOM) / 100,
57
- (dates.length * CHART_CONFIG.INITIAL_END_ZOOM) / 100
58
- );
59
-
60
- const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(
61
- visibleXAxisData[0],
62
- visibleXAxisData[visibleXAxisData.length - 1]
63
- );
64
-
65
- const labelsData = getLabelData({
66
- dates,
67
- isGreaterThanTwoWeeks,
68
- });
69
-
70
- const gridMainLines = getGridLines({
71
- isDark,
72
- isDesktop,
73
- });
74
-
75
- return {
76
- animation: false,
77
- dataZoom: [
78
- {
79
- id: 'main',
80
- type: 'inside',
81
- xAxisIndex: 0,
82
- start: CHART_CONFIG.INITIAL_START_ZOOM,
83
- end: CHART_CONFIG.INITIAL_END_ZOOM,
84
- filterMode: 'filter',
85
- },
86
- {
87
- id: 'sentiment',
88
- type: 'inside',
89
- xAxisIndex: 1,
90
- start: CHART_CONFIG.INITIAL_START_ZOOM,
91
- end: CHART_CONFIG.INITIAL_END_ZOOM,
92
- filterMode: 'none',
93
- },
94
- ],
95
- tooltip: {
96
- trigger: 'axis',
97
- axisPointer: {
98
- type: 'cross',
99
- axis: 'x',
100
- lineStyle: {
101
- color: tooltipLinesColor,
102
- },
103
- crossStyle: {
104
- color: tooltipLinesColor,
105
- },
106
- label: {
107
- padding: 0,
108
- lineHeight: 24,
109
- formatter: (params) => {
110
- if (params.axisDimension === 'y' && params.axisIndex === 0) {
111
- selectedPrice = Number(params.value);
112
- return ` ${Number(params.value).toFixed(displayPrecision)} `;
113
- }
114
-
115
- return null;
116
- },
117
- },
118
- },
119
- confine: true,
120
- formatter: (params: TooltipParam[]) =>
121
- getTooltipFormatter({
122
- params,
123
- buckets,
124
- bucketWidth,
125
- selectedPrice,
126
- labelCallback,
127
- bookType,
128
- }),
129
- },
130
- xAxis: [
131
- {
132
- type: 'category',
133
- name: 'xAxis-less-than-two-weeks',
134
- nameTextStyle: {
135
- fontSize: 0,
136
- },
137
- id: 'main-xAxis',
138
- splitNumber: 1,
139
- axisTick: {
140
- show: false,
141
- },
142
- axisLabel: {
143
- padding: [8, 16, 8, 16],
144
- margin: 0,
145
- formatter: (value) => formatXAxisLabel(value, isGreaterThanTwoWeeks),
146
- },
147
- },
148
- {
149
- type: 'category',
150
- gridIndex: 1,
151
- show: false,
152
- data: dates,
153
- splitNumber: 1,
154
- axisTick: {
155
- show: false,
156
- },
157
- axisLabel: {
158
- show: false,
159
- },
160
- },
161
- ],
162
- yAxis: [
163
- {
164
- type: 'value',
165
- gridIndex: 0,
166
- position: 'right',
167
- min: (val) =>
168
- val.min - bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
169
- max: (val) =>
170
- val.max + bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
171
- axisLine: { show: false },
172
- axisTick: { show: false },
173
- axisLabel: {
174
- showMaxLabel: false,
175
- showMinLabel: false,
176
- formatter: (value: number) => value.toFixed(displayPrecision - 1),
177
- },
178
- },
179
- {
180
- type: 'value',
181
- gridIndex: 1,
182
- position: 'right',
183
- min: CHART_CONFIG.SENTIMENT_MIN,
184
- max: CHART_CONFIG.SENTIMENT_MAX,
185
- interval: CHART_CONFIG.SENTIMENT_INTERVAL,
186
- axisLine: { show: false },
187
- axisTick: { show: false },
188
- axisLabel: {
189
- verticalAlignMaxLabel: 'top',
190
- verticalAlignMinLabel: 'bottom',
191
- lineHeight: 20,
192
- margin: isDesktop ? 4 : 2,
193
- rich: {
194
- shortRect: {
195
- backgroundColor: chroma(sentimentShortColor).alpha(0.3).css(),
196
- borderColor: sentimentShortColor,
197
- borderWidth: 1,
198
- width: 8,
199
- height: 8,
200
- },
201
- longRect: {
202
- backgroundColor: chroma(sentimentLongColor).alpha(0.3).css(),
203
- borderColor: sentimentLongColor,
204
- borderWidth: 1,
205
- width: 8,
206
- height: 8,
207
- },
208
- },
209
- formatter: (value: number) => {
210
- if (value === CHART_CONFIG.SENTIMENT_MIN) {
211
- return `{shortRect| } ${labelCallback('short')}`;
212
- }
213
-
214
- if (value === CHART_CONFIG.SENTIMENT_MAX) {
215
- return `{longRect| } ${labelCallback('long')}`;
216
- }
217
-
218
- if (value === CHART_CONFIG.SENTIMENT_MAX / 2) {
219
- return '50%';
220
- }
221
-
222
- return undefined;
223
- },
224
- },
225
- },
226
- ],
227
- axisPointer: {
228
- link: [
229
- {
230
- xAxisIndex: 'all',
231
- },
232
- ],
233
- },
234
- visualMap: {
235
- show: false,
236
- seriesId: 'sentiment',
237
- dimension: 1,
238
- pieces: [
239
- {
240
- lt: CHART_CONFIG.SENTIMENT_MAX / 2,
241
- color: sentimentShortColor,
242
- },
243
- {
244
- gte: CHART_CONFIG.SENTIMENT_MAX / 2,
245
- lte: CHART_CONFIG.SENTIMENT_MAX,
246
- color: sentimentLongColor,
247
- },
248
- {
249
- gt: CHART_CONFIG.SENTIMENT_MAX,
250
- color: sentimentLongColor,
251
- },
252
- ],
253
- },
254
- dataset: {
255
- source: {
256
- dates,
257
- candlesOpen,
258
- candlesClose,
259
- candlesLow,
260
- candlesHigh,
261
- bookPrices,
262
- bookIndexes,
263
- sentimentShorts,
264
- sentimentLongs,
265
- },
266
- },
267
- series: [
268
- {
269
- type: 'candlestick',
270
- id: 'candlestick',
271
- gridIndex: 0,
272
- xAxisIndex: 0,
273
- yAxisIndex: 0,
274
- encode: {
275
- x: 'dates',
276
- y: ['open', 'close', 'low', 'high'],
277
- },
278
- itemStyle: {
279
- color: chroma(candleShortColor).desaturate().css(),
280
- color0: chroma(candleLongColor).desaturate().css(),
281
- borderColor: candleShortColor,
282
- borderColor0: candleLongColor,
283
- },
284
- emphasis: {
285
- itemStyle: {
286
- color: candleShortColor,
287
- color0: candleLongColor,
288
- },
289
- },
290
- markPoint: {
291
- symbol: 'circle',
292
- symbolSize: 0,
293
- data: labelsData,
294
- },
295
- },
296
- {
297
- type: 'custom',
298
- gridIndex: 0,
299
- name: 'heatmap',
300
- id: 'heatmap',
301
- xAxisIndex: 0,
302
- yAxisIndex: 0,
303
- silent: true,
304
- clip: true,
305
- encode: {
306
- x: 'dates',
307
- y: 'bookPrices',
308
- },
309
- dimensions: ['dates', 'bookPrices', 'bookIndexes'],
310
- renderItem: (_params, api) => {
311
- const xVal = api.value(0);
312
- const bucketIndex = api.value(2) as number;
313
-
314
- if (!bucketIndex) {
315
- return null;
316
- }
317
-
318
- const metaValues = buckets[bucketIndex];
319
-
320
- const [rectWidth, rectHeight] = api.size!([
321
- 0,
322
- bucketWidth,
323
- ]) as number[];
324
-
325
- const items = metaValues.map(({ price, sentiment }: Bucket) => {
326
- const start = api.coord([xVal, price]);
327
-
328
- return {
329
- type: 'rect',
330
- shape: {
331
- x: start[0] - rectWidth / 2,
332
- y: start[1] - rectHeight,
333
- width: rectWidth + 1,
334
- height: rectHeight,
335
- },
336
- style: {
337
- fill: getRectColor(
338
- sentiment,
339
- isDark,
340
- sentimentThresholdMin,
341
- sentimentThresholdMax
342
- ),
343
- },
344
- silent: true,
345
- emphasisDisabled: true,
346
- };
347
- });
348
-
349
- return {
350
- type: 'group',
351
- children: items,
352
- silent: true,
353
- emphasisDisabled: true,
354
- };
355
- },
356
- },
357
- {
358
- type: 'line',
359
- name: 'sentiment-short',
360
- id: 'sentiment',
361
- xAxisIndex: 1,
362
- yAxisIndex: 1,
363
- showSymbol: false,
364
- symbol: 'none',
365
- lineStyle: {
366
- width: 3,
367
- opacity: 1,
368
- },
369
- areaStyle: {
370
- color: sentimentShortColor,
371
- opacity: sentimentAreaOpacity,
372
- },
373
- emphasis: {
374
- disabled: true,
375
- },
376
- stack: 'sentiment',
377
- dimensions: ['dates', 'sentimentShorts', 'sentimentLongs'],
378
- encode: {
379
- x: 'dates',
380
- y: 'sentimentShorts',
381
- },
382
- },
383
- {
384
- type: 'line',
385
- name: 'sentiment-long',
386
- id: 'sentiment-long',
387
- xAxisIndex: 1,
388
- yAxisIndex: 1,
389
- symbol: 'none',
390
- lineStyle: {
391
- color: 'transparent',
392
- width: 0,
393
- },
394
- areaStyle: {
395
- color: sentimentLongColor,
396
- opacity: sentimentAreaOpacity,
397
- },
398
- stack: 'sentiment',
399
- emphasis: {
400
- disabled: true,
401
- },
402
- tooltip: {
403
- show: false,
404
- },
405
- dimensions: ['dates', 'sentimentLongs'],
406
- encode: {
407
- x: 'dates',
408
- y: 'sentimentLongs',
409
- },
410
- },
411
- ],
412
- grid: [
413
- {
414
- name: 'main-grid',
415
- id: 'main-grid',
416
- height: `${CHART_CONFIG.MAIN_HEIGHT}px`,
417
- top: '0px',
418
- left: '0px',
419
- right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,
420
- bottom: `${CHART_CONFIG.X_LABEL_SIZE}px`,
421
- },
422
- {
423
- name: 'sentiment-grid',
424
- id: 'sentiment-grid',
425
- height: `${CHART_CONFIG.SENTIMENT_HEIGHT}px`,
426
- bottom: `0px`,
427
- left: '0px',
428
- right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,
429
- },
430
- ],
431
- graphic: [
432
- ...gridMainLines,
433
- {
434
- type: 'text',
435
- silent: true,
436
- z: 1,
437
- left: 4,
438
- bottom: CHART_CONFIG_CALCULATED.SENTIMENT_TEXT_POSITION,
439
- style: {
440
- text: `${labelCallback('sentiment')}:`,
441
- fontFamily: 'Sofia W03',
442
- fontSize: 14,
443
- fontWeight: 'bold',
444
- fill: sentimentLabelColor,
445
- },
446
- },
447
- ],
448
- };
449
- };