@oanda/labs-crowd-view-widget 1.0.53 → 1.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/CHANGELOG.md +220 -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 +5 -28
  5. package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  6. package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +3 -10
  7. package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  8. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +18 -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 +5 -52
  13. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
  14. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +54 -0
  15. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
  16. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +65 -0
  17. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
  18. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +60 -0
  19. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
  20. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +53 -0
  21. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -0
  22. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +31 -0
  23. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -0
  24. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +42 -0
  25. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
  26. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +75 -0
  27. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
  28. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js +116 -0
  29. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -0
  30. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js +18 -0
  31. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -0
  32. package/dist/main/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.js +4 -4
  33. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -0
  34. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +14 -0
  35. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -0
  36. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +42 -0
  37. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -0
  38. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +14 -0
  39. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -0
  40. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +108 -0
  41. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
  42. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js +83 -0
  43. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -0
  44. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +15 -0
  45. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -0
  46. package/dist/main/CrowdViewWidget/{utils/instrumentUtils.js → components/Chart/dataUtils/getInstrumentConfigForDivision.js} +3 -3
  47. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map +1 -0
  48. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js +18 -0
  49. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -0
  50. package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.js +8 -8
  51. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
  52. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
  53. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
  54. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
  55. package/dist/main/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
  56. package/dist/main/CrowdViewWidget/components/Chart/getOption.js +103 -0
  57. package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
  58. package/dist/main/CrowdViewWidget/components/Chart/index.js +11 -11
  59. package/dist/main/CrowdViewWidget/components/Chart/index.js.map +1 -1
  60. package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +9 -9
  61. package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
  62. package/dist/main/CrowdViewWidget/components/Legend/Legend.js +15 -12
  63. package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  64. package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +5 -16
  65. package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  66. package/dist/main/CrowdViewWidget/constants.js +11 -13
  67. package/dist/main/CrowdViewWidget/constants.js.map +1 -1
  68. package/dist/main/translations/sources/en.json +2 -1
  69. package/dist/module/CrowdViewWidget/Main.js +4 -2
  70. package/dist/module/CrowdViewWidget/Main.js.map +1 -1
  71. package/dist/module/CrowdViewWidget/components/Chart/Chart.js +6 -29
  72. package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  73. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +3 -10
  74. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  75. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +11 -0
  76. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -0
  77. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +23 -0
  78. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -0
  79. package/dist/module/CrowdViewWidget/components/Chart/{utils → chartOptions}/getGridLines.js +5 -52
  80. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -0
  81. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +46 -0
  82. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -0
  83. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +58 -0
  84. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -0
  85. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +53 -0
  86. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -0
  87. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +46 -0
  88. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -0
  89. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +24 -0
  90. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -0
  91. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +35 -0
  92. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -0
  93. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +68 -0
  94. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -0
  95. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +11 -0
  96. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -0
  97. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js +11 -0
  98. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -0
  99. package/dist/module/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.js +4 -4
  100. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -0
  101. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +6 -0
  102. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -0
  103. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +35 -0
  104. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -0
  105. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +7 -0
  106. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -0
  107. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +101 -0
  108. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -0
  109. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +8 -0
  110. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -0
  111. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +8 -0
  112. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -0
  113. package/dist/module/CrowdViewWidget/{utils/instrumentUtils.js → components/Chart/dataUtils/getInstrumentConfigForDivision.js} +3 -3
  114. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfigForDivision.js.map +1 -0
  115. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js +11 -0
  116. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -0
  117. package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.js +2 -2
  118. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -0
  119. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -0
  120. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -0
  121. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -0
  122. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -0
  123. package/dist/module/CrowdViewWidget/components/Chart/getOption.js +96 -0
  124. package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -0
  125. package/dist/module/CrowdViewWidget/components/Chart/index.js +1 -1
  126. package/dist/module/CrowdViewWidget/components/Chart/index.js.map +1 -1
  127. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +2 -2
  128. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
  129. package/dist/module/CrowdViewWidget/components/Legend/Legend.js +15 -12
  130. package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  131. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +5 -16
  132. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  133. package/dist/module/CrowdViewWidget/constants.js +9 -12
  134. package/dist/module/CrowdViewWidget/constants.js.map +1 -1
  135. package/dist/module/translations/sources/en.json +2 -1
  136. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.d.ts +2 -0
  137. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.d.ts +6 -0
  138. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridLines.d.ts +6 -0
  139. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +9 -0
  140. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts +11 -0
  141. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts +7 -0
  142. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +16 -0
  143. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.d.ts +7 -0
  144. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.d.ts +7 -0
  145. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.d.ts +9 -0
  146. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/index.d.ts +10 -0
  147. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.d.ts +1 -0
  148. package/dist/types/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.d.ts +2 -2
  149. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.d.ts +1 -0
  150. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getLabelData.d.ts +17 -0
  151. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getRectColor.d.ts +1 -0
  152. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +10 -0
  153. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/index.d.ts +7 -0
  154. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.d.ts +1 -0
  155. package/dist/types/CrowdViewWidget/{utils/instrumentUtils.d.ts → components/Chart/dataUtils/getInstrumentConfigForDivision.d.ts} +2 -2
  156. package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.d.ts +2 -0
  157. package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.d.ts +2 -2
  158. package/dist/types/CrowdViewWidget/components/Chart/index.d.ts +1 -1
  159. package/dist/types/CrowdViewWidget/components/Legend/Legend.d.ts +1 -4
  160. package/dist/types/CrowdViewWidget/components/Legend/LegendBar.d.ts +1 -3
  161. package/dist/types/CrowdViewWidget/constants.d.ts +3 -7
  162. package/package.json +3 -3
  163. package/src/CrowdViewWidget/Main.tsx +3 -2
  164. package/src/CrowdViewWidget/components/Chart/Chart.tsx +10 -34
  165. package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +2 -15
  166. package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +13 -0
  167. package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +29 -0
  168. package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +84 -0
  169. package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +52 -0
  170. package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts +82 -0
  171. package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts +63 -0
  172. package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +63 -0
  173. package/src/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.ts +32 -0
  174. package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +43 -0
  175. package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +77 -0
  176. package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +10 -0
  177. package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.ts +16 -0
  178. package/src/CrowdViewWidget/components/Chart/{utils → chartUtils}/getChartStyles.ts +9 -6
  179. package/src/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.ts +16 -0
  180. package/src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts +42 -0
  181. package/src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts +27 -0
  182. package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +183 -0
  183. package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +7 -0
  184. package/src/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.ts +13 -0
  185. package/src/CrowdViewWidget/{utils/instrumentUtils.ts → components/Chart/dataUtils/getInstrumentConfigForDivision.ts} +2 -2
  186. package/src/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.ts +14 -0
  187. package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/index.ts +2 -2
  188. package/src/CrowdViewWidget/components/Chart/getOption.ts +114 -0
  189. package/src/CrowdViewWidget/components/Chart/index.ts +1 -1
  190. package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +3 -3
  191. package/src/CrowdViewWidget/components/Legend/Legend.tsx +24 -22
  192. package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +13 -26
  193. package/src/CrowdViewWidget/constants.ts +20 -17
  194. package/src/translations/sources/en.json +2 -1
  195. package/test/components/Chart/utils/chartUtils.test.ts +7 -7
  196. package/test/components/Chart/utils/getChartStyles.test.ts +10 -10
  197. package/test/components/Chart/utils/processSentiments.test.ts +1 -1
  198. package/test/components/Legend.test.tsx +13 -21
  199. package/test/components/LegendBar.test.tsx +31 -51
  200. package/test/utils/instrumentUtils.test.ts +1 -1
  201. package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js +0 -399
  202. package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
  203. package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -126
  204. package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +0 -1
  205. package/dist/main/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +0 -1
  206. package/dist/main/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +0 -1
  207. package/dist/main/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
  208. package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
  209. package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
  210. package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +0 -1
  211. package/dist/main/CrowdViewWidget/components/Chart/utils/validateData.js.map +0 -1
  212. package/dist/main/CrowdViewWidget/utils/instrumentUtils.js.map +0 -1
  213. package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js +0 -391
  214. package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +0 -1
  215. package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +0 -113
  216. package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +0 -1
  217. package/dist/module/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +0 -1
  218. package/dist/module/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +0 -1
  219. package/dist/module/CrowdViewWidget/components/Chart/utils/index.js.map +0 -1
  220. package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +0 -1
  221. package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +0 -1
  222. package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +0 -1
  223. package/dist/module/CrowdViewWidget/components/Chart/utils/validateData.js.map +0 -1
  224. package/dist/module/CrowdViewWidget/utils/instrumentUtils.js.map +0 -1
  225. package/dist/types/CrowdViewWidget/components/Chart/utils/chartUtils.d.ts +0 -30
  226. package/dist/types/CrowdViewWidget/components/Chart/utils/getGridLines.d.ts +0 -97
  227. package/src/CrowdViewWidget/components/Chart/chartOptions.ts +0 -449
  228. package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +0 -228
  229. package/src/CrowdViewWidget/components/Chart/utils/getGridLines.ts +0 -148
  230. /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.js +0 -0
  231. /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.js +0 -0
  232. /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.js +0 -0
  233. /package/dist/main/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +0 -0
  234. /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.js +0 -0
  235. /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.js +0 -0
  236. /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.js +0 -0
  237. /package/dist/module/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.js +0 -0
  238. /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.d.ts +0 -0
  239. /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.d.ts +0 -0
  240. /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.d.ts +0 -0
  241. /package/dist/types/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.d.ts +0 -0
  242. /package/dist/types/CrowdViewWidget/components/Chart/{chartOptions.d.ts → getOption.d.ts} +0 -0
  243. /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processOrderPositionBooks.ts +0 -0
  244. /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processPriceCandles.ts +0 -0
  245. /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/processSentiments.ts +0 -0
  246. /package/src/CrowdViewWidget/components/Chart/{utils → dataUtils}/validateData.ts +0 -0
@@ -7,7 +7,6 @@ import {
7
7
  } from '@oanda/labs-widget-common';
8
8
  import React from 'react';
9
9
 
10
- import { Legend } from '../Legend';
11
10
  import { Chart } from './Chart';
12
11
  import type { ChartWithDataProps } from './types';
13
12
  import { useCrowdViewData } from './useCrowdViewData';
@@ -18,7 +17,7 @@ const ChartWithData = ({
18
17
  division,
19
18
  granularity,
20
19
  }: ChartWithDataProps) => {
21
- const { size, isDark } = useLayoutProvider();
20
+ const { size } = useLayoutProvider();
22
21
  const isDesktop = size === Size.DESKTOP;
23
22
 
24
23
  const { mainData, additionalData, loading, error } = useCrowdViewData({
@@ -30,7 +29,7 @@ const ChartWithData = ({
30
29
 
31
30
  return (
32
31
  <>
33
- <div className="lw-relative lw-h-[610px] lw-w-full">
32
+ <div className="lw-relative lw-h-[440px] lw-w-full lw-overflow-hidden">
34
33
  {error && (
35
34
  <div className="lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full lw-items-center lw-justify-center lw-border lw-border-solid lw-border-border-primary">
36
35
  <ChartError />
@@ -51,18 +50,6 @@ const ChartWithData = ({
51
50
  </div>
52
51
  )}
53
52
  </div>
54
- <Legend
55
- bookType={bookType}
56
- isDark={isDark}
57
- longValues={[
58
- additionalData?.sentimentThresholdMin,
59
- additionalData?.sentimentThresholdMax,
60
- ]}
61
- shortValues={[
62
- additionalData?.sentimentThresholdMin,
63
- additionalData?.sentimentThresholdMax,
64
- ]}
65
- />
66
53
  </>
67
54
  );
68
55
  };
@@ -0,0 +1,13 @@
1
+ import type { DataZoomComponentOption } from 'echarts';
2
+
3
+ import { CHART_CONFIG } from '../../../constants';
4
+
5
+ export const getDataZoomConfig = (): DataZoomComponentOption => ({
6
+ type: 'inside',
7
+ id: 'main',
8
+ xAxisIndex: [0, 1],
9
+ start: CHART_CONFIG.INITIAL_START_ZOOM,
10
+ end: CHART_CONFIG.INITIAL_END_ZOOM,
11
+ filterMode: 'filter',
12
+ minSpan: 10,
13
+ });
@@ -0,0 +1,29 @@
1
+ import type { GridComponentOption } from 'echarts';
2
+
3
+ import { CHART_CONFIG } from '../../../constants';
4
+
5
+ interface GetGridConfigParams {
6
+ isDesktop: boolean;
7
+ }
8
+
9
+ export const getGridConfig = ({
10
+ isDesktop,
11
+ }: GetGridConfigParams): GridComponentOption[] => [
12
+ {
13
+ id: 'main-grid',
14
+ name: 'main-grid',
15
+ left: `${CHART_CONFIG.Y_SENTIMENT_LABEL_SIZE}px`,
16
+ right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,
17
+ top: '0px',
18
+ bottom: `${CHART_CONFIG.X_LABEL_SIZE}px`,
19
+ height: `${CHART_CONFIG.MAIN_HEIGHT}px`,
20
+ },
21
+ {
22
+ id: 'sentiment-grid',
23
+ name: 'sentiment-grid',
24
+ left: `${CHART_CONFIG.Y_SENTIMENT_LABEL_SIZE}px`,
25
+ right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,
26
+ top: `0px`,
27
+ height: `${CHART_CONFIG.MAIN_HEIGHT}px`,
28
+ },
29
+ ];
@@ -0,0 +1,84 @@
1
+ import { getLineCommons } from '@oanda/labs-widget-common';
2
+ import type { GraphicComponentOption } from 'echarts';
3
+
4
+ import { CHART_CONFIG } from '../../../constants';
5
+
6
+ interface GetGridLinesParams {
7
+ isDark: boolean;
8
+ }
9
+
10
+ export const getGridLines = ({
11
+ isDark,
12
+ }: GetGridLinesParams): GraphicComponentOption[] => {
13
+ const { WIDTH, MAIN_HEIGHT, X_LABEL_SIZE, Y_SENTIMENT_LABEL_SIZE } =
14
+ CHART_CONFIG;
15
+ return [
16
+ // Top
17
+ {
18
+ ...getLineCommons(isDark),
19
+ top: -2,
20
+ shape: {
21
+ x1: 0,
22
+ y1: 0,
23
+ x2: WIDTH,
24
+ y2: 0,
25
+ },
26
+ },
27
+ // Right
28
+ {
29
+ ...getLineCommons(isDark),
30
+ right: -2,
31
+ shape: {
32
+ x1: 0,
33
+ y1: 0,
34
+ x2: 0,
35
+ y2: MAIN_HEIGHT + X_LABEL_SIZE + 2,
36
+ },
37
+ },
38
+ // Bottom
39
+ {
40
+ ...getLineCommons(isDark),
41
+ bottom: -2,
42
+ shape: {
43
+ x1: 0,
44
+ y1: 0,
45
+ x2: WIDTH,
46
+ y2: 0,
47
+ },
48
+ },
49
+ // Left
50
+ {
51
+ ...getLineCommons(isDark),
52
+ left: -2,
53
+ shape: {
54
+ x1: 0,
55
+ y1: 0,
56
+ x2: 0,
57
+ y2: MAIN_HEIGHT + X_LABEL_SIZE + 2,
58
+ },
59
+ },
60
+ // Y Sentiment Label
61
+ {
62
+ ...getLineCommons(isDark),
63
+ left: Y_SENTIMENT_LABEL_SIZE - 2,
64
+ top: -2,
65
+ shape: {
66
+ x1: 0,
67
+ y1: 0,
68
+ x2: 0,
69
+ y2: MAIN_HEIGHT,
70
+ },
71
+ },
72
+ // X Label
73
+ {
74
+ ...getLineCommons(isDark),
75
+ top: MAIN_HEIGHT - 2,
76
+ shape: {
77
+ x1: 0,
78
+ y1: 0,
79
+ x2: WIDTH,
80
+ y2: 0,
81
+ },
82
+ },
83
+ ];
84
+ };
@@ -0,0 +1,52 @@
1
+ import chroma from 'chroma-js';
2
+ import type { CandlestickSeriesOption } from 'echarts';
3
+
4
+ import { getLabelData } from '../chartUtils';
5
+ import type { ChartStyles } from '../chartUtils/getChartStyles';
6
+
7
+ interface GetSeriesCandlestickConfigParams {
8
+ dates: string[];
9
+ isGreaterThanTwoWeeks: boolean;
10
+ styles: ChartStyles;
11
+ }
12
+
13
+ export const getSeriesCandlestickConfig = ({
14
+ dates,
15
+ isGreaterThanTwoWeeks,
16
+ styles,
17
+ }: GetSeriesCandlestickConfigParams): CandlestickSeriesOption => {
18
+ const { candleLongColor, candleShortColor } = styles;
19
+ const labelsData = getLabelData({
20
+ dates,
21
+ isGreaterThanTwoWeeks,
22
+ });
23
+
24
+ return {
25
+ type: 'candlestick',
26
+ id: 'candlestick',
27
+ xAxisIndex: 0,
28
+ yAxisIndex: 0,
29
+ encode: {
30
+ x: 'dates',
31
+ y: ['open', 'close', 'low', 'high'],
32
+ },
33
+ itemStyle: {
34
+ color: chroma(candleLongColor).desaturate().css(),
35
+ color0: chroma(candleShortColor).desaturate().css(),
36
+ borderColor: candleLongColor,
37
+ borderColor0: candleShortColor,
38
+ },
39
+ emphasis: {
40
+ itemStyle: {
41
+ color: candleLongColor,
42
+ color0: candleShortColor,
43
+ },
44
+ },
45
+ markPoint: {
46
+ data: labelsData,
47
+ symbol: 'circle',
48
+ symbolSize: 0,
49
+ },
50
+ z: 2,
51
+ };
52
+ };
@@ -0,0 +1,82 @@
1
+ import type {
2
+ CustomSeriesOption,
3
+ CustomSeriesRenderItemAPI,
4
+ CustomSeriesRenderItemParams,
5
+ } from 'echarts';
6
+
7
+ import { getRectColor } from '../chartUtils';
8
+ import type { Bucket } from '../types';
9
+
10
+ interface GetSeriesHeatmapConfigParams {
11
+ bucketWidth: number;
12
+ buckets: Bucket[][];
13
+ isDark: boolean;
14
+ sentimentThresholdMax: number;
15
+ sentimentThresholdMin: number;
16
+ }
17
+
18
+ export const getSeriesHeatmapConfig = ({
19
+ bucketWidth,
20
+ buckets,
21
+ isDark,
22
+ sentimentThresholdMax,
23
+ sentimentThresholdMin,
24
+ }: GetSeriesHeatmapConfigParams): CustomSeriesOption => {
25
+ return {
26
+ type: 'custom',
27
+ id: 'heatmap',
28
+ name: 'heatmap',
29
+ xAxisIndex: 0,
30
+ yAxisIndex: 0,
31
+ encode: {
32
+ x: 'dates',
33
+ y: 'bookPrices',
34
+ },
35
+ dimensions: ['dates', 'bookPrices', 'bookIndexes'],
36
+ clip: true,
37
+ renderItem: (
38
+ _params: CustomSeriesRenderItemParams,
39
+ api: CustomSeriesRenderItemAPI
40
+ ) => {
41
+ const xVal = api.value(0);
42
+ const bucketIndex = api.value(2) as number;
43
+
44
+ if (bucketIndex == null) {
45
+ return null;
46
+ }
47
+
48
+ const metaValues = buckets[bucketIndex];
49
+
50
+ const [rectWidth, rectHeight] = api.size!([0, bucketWidth]) as number[];
51
+
52
+ const items = metaValues.map(({ price, sentiment }: Bucket) => {
53
+ const start = api.coord([xVal, price]);
54
+
55
+ return {
56
+ shape: {
57
+ height: rectHeight,
58
+ width: rectWidth + 1,
59
+ x: start[0] - rectWidth / 2,
60
+ y: start[1] - rectHeight,
61
+ },
62
+ style: {
63
+ fill: getRectColor(
64
+ sentiment,
65
+ isDark,
66
+ sentimentThresholdMin,
67
+ sentimentThresholdMax
68
+ ),
69
+ },
70
+ type: 'rect' as const,
71
+ };
72
+ });
73
+
74
+ return {
75
+ children: items,
76
+ emphasisDisabled: true,
77
+ type: 'group' as const,
78
+ };
79
+ },
80
+ z: 1,
81
+ };
82
+ };
@@ -0,0 +1,63 @@
1
+ import { colorPalette } from '@oanda/labs-widget-common';
2
+ import type { LineSeriesOption } from 'echarts';
3
+
4
+ import type { ChartStyles } from '../chartUtils';
5
+
6
+ interface GetSeriesSentimentConfigParams {
7
+ styles: ChartStyles;
8
+ }
9
+
10
+ export const getSeriesSentimentConfig = ({
11
+ styles,
12
+ }: GetSeriesSentimentConfigParams): LineSeriesOption => {
13
+ return {
14
+ type: 'line',
15
+ id: 'sentiment',
16
+ name: 'sentiment',
17
+ xAxisIndex: 1,
18
+ yAxisIndex: 1,
19
+ encode: {
20
+ x: 'dates',
21
+ y: 'sentimentShorts',
22
+ },
23
+ dimensions: ['dates', 'sentimentShorts', 'sentimentLongs'],
24
+ lineStyle: {
25
+ width: styles.sentimentOutlineWidth,
26
+ opacity: 1,
27
+ shadowColor: styles.sentimentOutlineColor,
28
+ shadowBlur: 3,
29
+ },
30
+ emphasis: {
31
+ disabled: true,
32
+ },
33
+ markLine: {
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
+ {
45
+ yAxis: 20,
46
+ },
47
+ {
48
+ yAxis: 50,
49
+ lineStyle: {
50
+ width: 1,
51
+ },
52
+ },
53
+ {
54
+ yAxis: 80,
55
+ },
56
+ ],
57
+ },
58
+ stack: 'sentiment',
59
+ showSymbol: false,
60
+ symbol: 'none',
61
+ z: 3,
62
+ };
63
+ };
@@ -0,0 +1,63 @@
1
+ import type { TooltipComponentOption } from 'echarts';
2
+
3
+ import type { BookType } from '../../../../gql/types/graphql';
4
+ import { getTooltipFormatter } from '../chartUtils';
5
+ import type { Bucket, TooltipParam } from '../types';
6
+
7
+ interface GetTooltipConfigParams {
8
+ bookType: BookType;
9
+ bucketWidth: number;
10
+ buckets: Bucket[][];
11
+ displayPrecision: number;
12
+ labelCallback: (key: string, params?: Record<string, unknown>) => string;
13
+ selectedPriceRef: { current: number };
14
+ tooltipLinesColor: string;
15
+ }
16
+
17
+ export const getTooltipConfig = ({
18
+ bookType,
19
+ bucketWidth,
20
+ buckets,
21
+ displayPrecision,
22
+ labelCallback,
23
+ selectedPriceRef,
24
+ tooltipLinesColor,
25
+ }: GetTooltipConfigParams): TooltipComponentOption => ({
26
+ trigger: 'axis' as const,
27
+ formatter: (params) =>
28
+ getTooltipFormatter({
29
+ bookType,
30
+ bucketWidth,
31
+ buckets,
32
+ labelCallback,
33
+ params: params as unknown as TooltipParam[],
34
+ selectedPrice: selectedPriceRef.current,
35
+ }),
36
+
37
+ axisPointer: {
38
+ type: 'cross' as const,
39
+ axis: 'x' as const,
40
+ lineStyle: {
41
+ color: tooltipLinesColor,
42
+ },
43
+ crossStyle: {
44
+ color: tooltipLinesColor,
45
+ },
46
+ label: {
47
+ padding: 0,
48
+ lineHeight: 24,
49
+ formatter: (params: {
50
+ axisDimension?: string;
51
+ axisIndex?: number;
52
+ value: unknown;
53
+ }) => {
54
+ if (params.axisDimension === 'y' && params.axisIndex === 0) {
55
+ selectedPriceRef.current = Number(params.value);
56
+ return ` ${Number(params.value).toFixed(displayPrecision)} `;
57
+ }
58
+ return '';
59
+ },
60
+ },
61
+ },
62
+ confine: true,
63
+ });
@@ -0,0 +1,32 @@
1
+ import type { VisualMapComponentOption } from 'echarts';
2
+
3
+ import { CHART_CONFIG } from '../../../constants';
4
+
5
+ interface GetVisualMapConfigParams {
6
+ sentimentLongColor: string;
7
+ sentimentShortColor: string;
8
+ }
9
+
10
+ export const getVisualMapConfig = ({
11
+ sentimentLongColor,
12
+ sentimentShortColor,
13
+ }: GetVisualMapConfigParams): VisualMapComponentOption => ({
14
+ show: false,
15
+ dimension: 1,
16
+ seriesId: 'sentiment',
17
+ pieces: [
18
+ {
19
+ lt: CHART_CONFIG.SENTIMENT_MAX / 2,
20
+ color: sentimentShortColor,
21
+ },
22
+ {
23
+ gte: CHART_CONFIG.SENTIMENT_MAX / 2,
24
+ lte: CHART_CONFIG.SENTIMENT_MAX,
25
+ color: sentimentLongColor,
26
+ },
27
+ {
28
+ gt: CHART_CONFIG.SENTIMENT_MAX,
29
+ color: sentimentLongColor,
30
+ },
31
+ ],
32
+ });
@@ -0,0 +1,43 @@
1
+ import type { XAXisComponentOption } from 'echarts';
2
+
3
+ import { formatXAxisLabel } from '../chartUtils';
4
+
5
+ interface GetXAxisConfigParams {
6
+ dates: string[];
7
+ isGreaterThanTwoWeeks: boolean;
8
+ }
9
+
10
+ export const getXAxisConfig = ({
11
+ dates,
12
+ isGreaterThanTwoWeeks,
13
+ }: GetXAxisConfigParams): XAXisComponentOption[] => [
14
+ {
15
+ type: 'category',
16
+ id: 'main-xAxis',
17
+ name: 'xAxis-less-than-two-weeks',
18
+ nameTextStyle: {
19
+ fontSize: 0,
20
+ },
21
+ axisTick: {
22
+ show: false,
23
+ },
24
+ axisLabel: {
25
+ padding: [8, 16, 8, 16],
26
+ margin: 0,
27
+ formatter: (value: unknown) =>
28
+ formatXAxisLabel(value, isGreaterThanTwoWeeks),
29
+ },
30
+ },
31
+ {
32
+ type: 'category',
33
+ gridIndex: 1,
34
+ show: false,
35
+ axisTick: {
36
+ show: false,
37
+ },
38
+ axisLabel: {
39
+ show: false,
40
+ },
41
+ data: dates,
42
+ },
43
+ ];
@@ -0,0 +1,77 @@
1
+ import type { YAXisComponentOption } from 'echarts';
2
+
3
+ import { BUCKET_CONFIG, CHART_CONFIG } from '../../../constants';
4
+
5
+ interface GetYAxisConfigParams {
6
+ bucketWidth: number;
7
+ displayPrecision: number;
8
+ isDesktop: boolean;
9
+ labelCallback: (key: string, params?: Record<string, unknown>) => string;
10
+ }
11
+
12
+ export const getYAxisConfig = ({
13
+ bucketWidth,
14
+ displayPrecision,
15
+ isDesktop,
16
+ labelCallback,
17
+ }: GetYAxisConfigParams): YAXisComponentOption[] => [
18
+ {
19
+ type: 'value',
20
+ gridIndex: 0,
21
+ position: 'right',
22
+ min: (val: { min: number }) =>
23
+ val.min - bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
24
+ max: (val: { max: number }) =>
25
+ val.max + bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
26
+ axisLine: { show: false },
27
+ axisTick: { show: false },
28
+ axisLabel: {
29
+ showMinLabel: false,
30
+ showMaxLabel: false,
31
+ formatter: (value: number) => value.toFixed(displayPrecision - 1),
32
+ },
33
+ },
34
+ {
35
+ type: 'value',
36
+ gridIndex: 1,
37
+ position: 'left',
38
+ min: CHART_CONFIG.SENTIMENT_MIN,
39
+ max: CHART_CONFIG.SENTIMENT_MAX,
40
+ axisLine: { show: false },
41
+ axisTick: { show: false },
42
+ axisPointer: {
43
+ show: false,
44
+ },
45
+ axisLabel: {
46
+ margin: isDesktop ? 4 : 2,
47
+ lineHeight: 20,
48
+ verticalAlignMinLabel: 'bottom',
49
+ verticalAlignMaxLabel: 'top',
50
+ customValues: [
51
+ CHART_CONFIG.SENTIMENT_MIN,
52
+ CHART_CONFIG.SENTIMENT_MAX / 5,
53
+ CHART_CONFIG.SENTIMENT_MAX / 2,
54
+ (CHART_CONFIG.SENTIMENT_MAX * 4) / 5,
55
+ CHART_CONFIG.SENTIMENT_MAX,
56
+ ],
57
+ formatter: (value: number) => {
58
+ if (value === CHART_CONFIG.SENTIMENT_MIN) {
59
+ return `${labelCallback('short')}`;
60
+ }
61
+ if (value === CHART_CONFIG.SENTIMENT_MAX) {
62
+ return `${labelCallback('long')}`;
63
+ }
64
+ if (value === CHART_CONFIG.SENTIMENT_MAX / 2) {
65
+ return '50%';
66
+ }
67
+ if (value === CHART_CONFIG.SENTIMENT_MAX / 5) {
68
+ return '80%';
69
+ }
70
+ if (value === (CHART_CONFIG.SENTIMENT_MAX * 4) / 5) {
71
+ return '20%';
72
+ }
73
+ return '';
74
+ },
75
+ },
76
+ },
77
+ ];
@@ -0,0 +1,10 @@
1
+ export * from './getDataZoomConfig';
2
+ export * from './getGridConfig';
3
+ export * from './getGridLines';
4
+ export * from './getSeriesCandlestickConfig';
5
+ export * from './getSeriesHeatmapConfig';
6
+ export * from './getSeriesSentimentConfig';
7
+ export * from './getTooltipConfig';
8
+ export * from './getVisualMapConfig';
9
+ export * from './getXAxisConfig';
10
+ export * from './getYAxisConfig';
@@ -0,0 +1,16 @@
1
+ import { CHART_CONFIG } from '../../../constants';
2
+
3
+ export const formatXAxisLabel = (
4
+ value: unknown,
5
+ isGreaterThanTwoWeeks: boolean
6
+ ) => {
7
+ const date = new Date(value as string);
8
+ return isGreaterThanTwoWeeks
9
+ ? `${date.toLocaleTimeString(undefined, {
10
+ hour: '2-digit',
11
+ minute: '2-digit',
12
+ })}`
13
+ : `${CHART_CONFIG.X_AXIS_DATE_PADDING}${date.toLocaleDateString(undefined, {
14
+ day: 'numeric',
15
+ })}${CHART_CONFIG.X_AXIS_DATE_PADDING}`;
16
+ };
@@ -3,11 +3,11 @@ import { colorPalette } from '@oanda/labs-widget-common';
3
3
  export interface ChartStyles {
4
4
  sentimentLongColor: string;
5
5
  sentimentShortColor: string;
6
+ sentimentOutlineColor: string;
6
7
  candleLongColor: string;
7
8
  candleShortColor: string;
8
- sentimentAreaOpacity: number;
9
9
  tooltipLinesColor: string;
10
- sentimentLabelColor: string;
10
+ sentimentOutlineWidth: number;
11
11
  }
12
12
 
13
13
  export const getChartStyles = (isDark: boolean): ChartStyles => {
@@ -18,25 +18,28 @@ export const getChartStyles = (isDark: boolean): ChartStyles => {
18
18
  ? colorPalette.darkYellow90
19
19
  : colorPalette.lightYellow90;
20
20
 
21
+ const sentimentOutlineColor = isDark
22
+ ? colorPalette.black
23
+ : colorPalette.white;
24
+ const sentimentOutlineWidth = isDark ? 3 : 2;
25
+
21
26
  const candleLongColor = isDark
22
27
  ? colorPalette.bottleGreenDark
23
28
  : colorPalette.bottleGreenLight;
24
29
  const candleShortColor = isDark
25
30
  ? colorPalette.orange
26
31
  : colorPalette.raspberryLight;
27
- const sentimentAreaOpacity = isDark ? 0.5 : 0.2;
28
32
  const tooltipLinesColor = isDark
29
33
  ? colorPalette.orange
30
34
  : colorPalette.bottleGreenLight;
31
- const sentimentLabelColor = isDark ? colorPalette.white : colorPalette.black;
32
35
 
33
36
  return {
34
37
  sentimentLongColor,
35
38
  sentimentShortColor,
39
+ sentimentOutlineColor,
36
40
  candleLongColor,
37
41
  candleShortColor,
38
- sentimentAreaOpacity,
39
42
  tooltipLinesColor,
40
- sentimentLabelColor,
43
+ sentimentOutlineWidth,
41
44
  };
42
45
  };
@@ -0,0 +1,16 @@
1
+ import chroma from 'chroma-js';
2
+
3
+ export const getGradientColor = (
4
+ value: number,
5
+ startColor: string,
6
+ targetColor: string,
7
+ minThreshold: number,
8
+ maxThreshold: number
9
+ ): string => {
10
+ const colorScale = chroma
11
+ .scale([startColor, targetColor])
12
+ .domain([minThreshold, maxThreshold])
13
+ .mode('rgb');
14
+
15
+ return colorScale(value).hex();
16
+ };