@oanda/labs-crowd-view-widget 1.0.56 → 1.0.57

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 (71) hide show
  1. package/CHANGELOG.md +232 -0
  2. package/dist/main/CrowdViewWidget/components/Chart/Chart.js +1 -6
  3. package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  4. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +5 -4
  5. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
  6. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +13 -6
  7. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
  8. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +4 -4
  9. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -1
  10. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +9 -43
  11. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
  12. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +19 -4
  13. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
  14. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +15 -2
  15. package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -1
  16. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatFullDate.js +27 -0
  17. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatFullDate.js.map +1 -0
  18. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +14 -23
  19. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
  20. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js +11 -0
  21. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
  22. package/dist/main/CrowdViewWidget/components/Chart/getOption.js +4 -4
  23. package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
  24. package/dist/main/CrowdViewWidget/constants.js +6 -5
  25. package/dist/main/CrowdViewWidget/constants.js.map +1 -1
  26. package/dist/main/translations/sources/en.json +2 -1
  27. package/dist/module/CrowdViewWidget/components/Chart/Chart.js +2 -7
  28. package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  29. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +5 -4
  30. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
  31. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +13 -6
  32. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
  33. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +4 -4
  34. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -1
  35. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +9 -42
  36. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
  37. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +20 -5
  38. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
  39. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +15 -2
  40. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -1
  41. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatFullDate.js +20 -0
  42. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatFullDate.js.map +1 -0
  43. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +14 -23
  44. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
  45. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +1 -0
  46. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
  47. package/dist/module/CrowdViewWidget/components/Chart/getOption.js +4 -4
  48. package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
  49. package/dist/module/CrowdViewWidget/constants.js +6 -5
  50. package/dist/module/CrowdViewWidget/constants.js.map +1 -1
  51. package/dist/module/translations/sources/en.json +2 -1
  52. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +1 -2
  53. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.d.ts +2 -1
  54. package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.d.ts +4 -2
  55. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatFullDate.d.ts +1 -0
  56. package/dist/types/CrowdViewWidget/components/Chart/chartUtils/index.d.ts +1 -0
  57. package/dist/types/CrowdViewWidget/constants.d.ts +4 -3
  58. package/package.json +3 -3
  59. package/src/CrowdViewWidget/components/Chart/Chart.tsx +1 -7
  60. package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +5 -4
  61. package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +19 -10
  62. package/src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts +9 -5
  63. package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +38 -79
  64. package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +26 -2
  65. package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +20 -3
  66. package/src/CrowdViewWidget/components/Chart/chartUtils/formatFullDate.ts +26 -0
  67. package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +49 -35
  68. package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +1 -0
  69. package/src/CrowdViewWidget/components/Chart/getOption.ts +2 -2
  70. package/src/CrowdViewWidget/constants.ts +9 -7
  71. package/src/translations/sources/en.json +2 -1
@@ -17,20 +17,29 @@ export const getGridLines = ({
17
17
  MAIN_HEIGHT_DESKTOP,
18
18
  MAIN_HEIGHT_MOBILE,
19
19
  X_LABEL_SIZE,
20
- MOBILE_TOOLTIP_HEIGHT,
20
+ TOOLTIP_HEIGHT_MOBILE,
21
+ TOOLTIP_HEIGHT_DESKTOP,
22
+ Y_SENTIMENT_LABEL_DESKTOP_SIZE,
23
+ Y_SENTIMENT_LABEL_MOBILE_SIZE,
24
+ Y_LABEL_SIZE_DESKTOP,
25
+ Y_LABEL_SIZE_MOBILE,
26
+ TOP_LABEL_SPACE_MOBILE,
21
27
  } = CHART_CONFIG;
28
+
22
29
  const mainHeight = isDesktop ? MAIN_HEIGHT_DESKTOP : MAIN_HEIGHT_MOBILE;
23
30
  const ySentimentLabelSize = isDesktop
24
- ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE
25
- : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;
31
+ ? Y_SENTIMENT_LABEL_DESKTOP_SIZE
32
+ : Y_SENTIMENT_LABEL_MOBILE_SIZE;
26
33
 
27
- const yLabelSize = isDesktop
28
- ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP
29
- : CHART_CONFIG.Y_LABEL_SIZE_MOBILE;
34
+ const yLabelSize = isDesktop ? Y_LABEL_SIZE_DESKTOP : Y_LABEL_SIZE_MOBILE;
30
35
 
31
36
  const topMargin = isDesktop
32
- ? CHART_CONFIG.TOP_MARGIN_DESKTOP
33
- : CHART_CONFIG.TOP_MARGIN_MOBILE + CHART_CONFIG.MOBILE_TOOLTIP_HEIGHT;
37
+ ? CHART_CONFIG.TOP_LABEL_SPACE_DESKTOP + TOOLTIP_HEIGHT_DESKTOP
38
+ : TOP_LABEL_SPACE_MOBILE + TOOLTIP_HEIGHT_MOBILE;
39
+
40
+ const tooltipHeight = isDesktop
41
+ ? TOOLTIP_HEIGHT_DESKTOP
42
+ : TOOLTIP_HEIGHT_MOBILE;
34
43
 
35
44
  return [
36
45
  // Top
@@ -134,11 +143,11 @@ export const getGridLines = ({
134
143
  // Mobile tooltip,
135
144
  {
136
145
  ...getLineCommons(isDark),
137
- top: MOBILE_TOOLTIP_HEIGHT - 2,
146
+ top: tooltipHeight - 3,
138
147
  shape: {
139
148
  x1: 0,
140
149
  y1: 0,
141
- x2: isDesktop ? 0 : WIDTH,
150
+ x2: WIDTH,
142
151
  y2: 0,
143
152
  },
144
153
  z: 30,
@@ -40,8 +40,8 @@ export const getLabelsConfig = ({
40
40
  const priceVerticalOffset = priceEstimatedWidth / 2;
41
41
 
42
42
  const topMargin = isDesktop
43
- ? CHART_CONFIG.TOP_MARGIN_DESKTOP
44
- : CHART_CONFIG.TOP_MARGIN_MOBILE + CHART_CONFIG.MOBILE_TOOLTIP_HEIGHT;
43
+ ? CHART_CONFIG.TOP_LABEL_SPACE_DESKTOP + CHART_CONFIG.TOOLTIP_HEIGHT_DESKTOP
44
+ : CHART_CONFIG.TOP_LABEL_SPACE_MOBILE + CHART_CONFIG.TOOLTIP_HEIGHT_MOBILE;
45
45
 
46
46
  const mainHeight = isDesktop
47
47
  ? CHART_CONFIG.MAIN_HEIGHT_DESKTOP
@@ -195,12 +195,16 @@ export const getLabelsConfig = ({
195
195
  type: 'text',
196
196
  z: 20,
197
197
  left: 'center',
198
- top: CHART_CONFIG.MOBILE_TOOLTIP_HEIGHT / 2 - 5,
198
+ top: isDesktop
199
+ ? CHART_CONFIG.TOOLTIP_HEIGHT_DESKTOP / 2 - 5
200
+ : CHART_CONFIG.TOOLTIP_HEIGHT_MOBILE / 2 - 5,
199
201
  silent: true,
200
202
  style: {
201
- fontSize: isDesktop ? 0 : 11,
203
+ fontSize: isDesktop ? 12 : 11,
202
204
  fill: textColor,
203
- text: isDesktop ? '' : labelCallback('tap_chart_to_see_more_details'),
205
+ text: isDesktop
206
+ ? labelCallback('hover_chart_to_see_more_details')
207
+ : labelCallback('tap_chart_to_see_more_details'),
204
208
  },
205
209
  },
206
210
  ];
@@ -1,9 +1,6 @@
1
- import { colorPalette } from '@oanda/labs-widget-common';
2
- import chroma from 'chroma-js';
3
1
  import type { TooltipComponentOption } from 'echarts';
4
2
 
5
3
  import type { BookType } from '../../../../gql/types/graphql';
6
- import { CHART_CONFIG } from '../../../constants';
7
4
  import { getTooltipFormatter } from '../chartUtils';
8
5
  import type { Bucket, TooltipParam } from '../types';
9
6
 
@@ -11,7 +8,6 @@ interface GetTooltipConfigParams {
11
8
  bookType: BookType;
12
9
  bucketWidth: number;
13
10
  buckets: Bucket[][];
14
- displayPrecision: number;
15
11
  labelCallback: (key: string, params?: Record<string, unknown>) => string;
16
12
  selectedPriceRef: { current: number };
17
13
  tooltipLinesColor: string;
@@ -26,7 +22,6 @@ export const getTooltipConfig = ({
26
22
  bookType,
27
23
  bucketWidth,
28
24
  buckets,
29
- displayPrecision,
30
25
  labelCallback,
31
26
  selectedPriceRef,
32
27
  tooltipLinesColor,
@@ -35,83 +30,47 @@ export const getTooltipConfig = ({
35
30
  isDesktop,
36
31
  isDark,
37
32
  locale,
38
- }: GetTooltipConfigParams): TooltipComponentOption => {
39
- const styles = isDesktop
33
+ }: GetTooltipConfigParams): TooltipComponentOption => ({
34
+ backgroundColor: 'transparent',
35
+ shadowColor: 'transparent',
36
+ extraCssText: 'width: 100%; z-index: 5;',
37
+ padding: 4,
38
+ textStyle: isDesktop
40
39
  ? {
41
- backgroundColor: isDark
42
- ? chroma(colorPalette.darkGray).alpha(0.95).hex()
43
- : chroma(colorPalette.darkWhite).alpha(0.95).hex(),
44
- shadowColor: colorPalette.black10,
45
- extraCssText: 'z-index: 5;',
46
- padding: 8,
47
- alwaysShowContent: false,
48
- textStyle: {
49
- fontSize: 11,
50
- },
40
+ fontSize: 12,
51
41
  }
52
42
  : {
53
- backgroundColor: 'transparent',
54
- shadowColor: 'transparent',
55
- extraCssText: 'width: 100%; z-index: 5;',
56
- padding: 4,
57
- alwaysShowContent: true,
58
- textStyle: {
59
- fontSize: 10,
60
- lineHeight: 12,
61
- },
62
- };
63
- return {
64
- ...styles,
65
- trigger: 'axis' as const,
66
- formatter: (params) =>
67
- getTooltipFormatter({
68
- bookType,
69
- bucketWidth,
70
- buckets,
71
- labelCallback,
72
- params: params as unknown as TooltipParam[],
73
- selectedPrice: selectedPriceRef.current,
74
- sentimentLongs,
75
- sentimentShorts,
76
- isDesktop,
77
- locale,
78
- isDark,
79
- }),
80
- hideDelay: 0,
81
- axisPointer: {
82
- type: 'cross' as const,
83
- axis: 'x' as const,
84
- lineStyle: {
85
- color: tooltipLinesColor,
86
- },
87
- crossStyle: {
88
- color: tooltipLinesColor,
89
- },
90
- label: {
91
- padding: 0,
92
- lineHeight: 24,
93
- formatter: (params: {
94
- axisDimension?: string;
95
- axisIndex?: number;
96
- value: unknown;
97
- }) => {
98
- if (params.axisDimension === 'y' && params.axisIndex === 0) {
99
- selectedPriceRef.current = Number(params.value);
100
- return ` ${Number(params.value).toFixed(displayPrecision)} `;
101
- }
102
- return '';
103
- },
43
+ fontSize: 10,
44
+ lineHeight: 12,
104
45
  },
46
+ alwaysShowContent: true,
47
+ trigger: 'axis' as const,
48
+ formatter: (params) =>
49
+ getTooltipFormatter({
50
+ bookType,
51
+ bucketWidth,
52
+ buckets,
53
+ labelCallback,
54
+ params: params as unknown as TooltipParam[],
55
+ selectedPrice: selectedPriceRef.current,
56
+ sentimentLongs,
57
+ sentimentShorts,
58
+ isDesktop,
59
+ locale,
60
+ isDark,
61
+ }),
62
+ hideDelay: 0,
63
+ axisPointer: {
64
+ type: 'cross' as const,
65
+ axis: 'x' as const,
66
+ lineStyle: {
67
+ color: tooltipLinesColor,
105
68
  },
106
- confine: true,
107
- position: (point) => {
108
- if (isDesktop) {
109
- return [
110
- point[0] + CHART_CONFIG.TOOLTIP_OFFSET,
111
- point[1] + CHART_CONFIG.TOOLTIP_OFFSET,
112
- ];
113
- }
114
- return [0, 0];
69
+ crossStyle: {
70
+ color: tooltipLinesColor,
115
71
  },
116
- };
117
- };
72
+ z: 30,
73
+ },
74
+ confine: true,
75
+ position: [0, 0],
76
+ });
@@ -1,6 +1,7 @@
1
1
  import type { XAXisComponentOption } from 'echarts';
2
2
 
3
3
  import {
4
+ formatFullDate,
4
5
  formatXAxisAdditionalLabel,
5
6
  formatXAxisLabel,
6
7
  getLabelData,
@@ -10,12 +11,14 @@ interface GetXAxisConfigParams {
10
11
  dates: string[];
11
12
  isGreaterThanTwoWeeks: boolean;
12
13
  locale: string;
14
+ isDesktop: boolean;
13
15
  }
14
16
 
15
17
  export const getXAxisConfig = ({
16
18
  dates,
17
19
  isGreaterThanTwoWeeks,
18
20
  locale,
21
+ isDesktop,
19
22
  }: GetXAxisConfigParams): XAXisComponentOption[] => {
20
23
  const labelsData = getLabelData({
21
24
  dates,
@@ -38,14 +41,32 @@ export const getXAxisConfig = ({
38
41
  },
39
42
  },
40
43
  axisLabel: {
41
- showMaxLabel: false,
42
44
  padding: [8, 16, 8, 16],
43
45
  margin: 0,
44
46
  formatter: (value: unknown) =>
45
- formatXAxisLabel(value, isGreaterThanTwoWeeks, locale),
47
+ value === dates[dates.length - 1]
48
+ ? ''
49
+ : formatXAxisLabel(value, isGreaterThanTwoWeeks, locale),
46
50
  },
47
51
  boundaryGap: false,
48
52
  z: 2,
53
+ axisPointer: {
54
+ label: {
55
+ lineHeight: 22,
56
+ margin: -22,
57
+ padding: [0, 8, 0, 8],
58
+ formatter: (params: {
59
+ axisDimension?: string;
60
+ axisIndex?: number;
61
+ value: unknown;
62
+ }) => {
63
+ const date = new Date(params.value as string);
64
+
65
+ return isDesktop ? formatFullDate(date, locale) : '';
66
+ },
67
+ },
68
+ z: 100,
69
+ },
49
70
  },
50
71
  {
51
72
  type: 'category',
@@ -67,6 +88,9 @@ export const getXAxisConfig = ({
67
88
  formatter: (value: unknown) =>
68
89
  formatXAxisAdditionalLabel(value, isGreaterThanTwoWeeks, locale),
69
90
  },
91
+ axisPointer: {
92
+ show: false,
93
+ },
70
94
  data: dates,
71
95
  boundaryGap: false,
72
96
  z: 2,
@@ -5,13 +5,13 @@ import { CHART_CONFIG } from '../../../constants';
5
5
  interface GetYAxisConfigParams {
6
6
  bucketWidth: number;
7
7
  displayPrecision: number;
8
- isDesktop: boolean;
8
+ selectedPriceRef: { current: number };
9
9
  }
10
10
 
11
11
  export const getYAxisConfig = ({
12
12
  bucketWidth,
13
13
  displayPrecision,
14
- isDesktop,
14
+ selectedPriceRef,
15
15
  }: GetYAxisConfigParams): YAXisComponentOption[] => [
16
16
  {
17
17
  type: 'value',
@@ -35,6 +35,23 @@ export const getYAxisConfig = ({
35
35
  verticalAlignMaxLabel: 'top',
36
36
  formatter: (value: number) => value.toFixed(displayPrecision),
37
37
  },
38
+ axisPointer: {
39
+ label: {
40
+ padding: [4, 4, 4, 4],
41
+ margin: -1,
42
+ formatter: (params: {
43
+ axisDimension?: string;
44
+ axisIndex?: number;
45
+ value: unknown;
46
+ }) => {
47
+ if (params.axisDimension === 'y' && params.axisIndex === 0) {
48
+ selectedPriceRef.current = Number(params.value);
49
+ return Number(params.value).toFixed(displayPrecision);
50
+ }
51
+ return '';
52
+ },
53
+ },
54
+ },
38
55
  z: 30,
39
56
  },
40
57
  {
@@ -51,7 +68,7 @@ export const getYAxisConfig = ({
51
68
  margin: 4,
52
69
  lineHeight: 20,
53
70
  verticalAlignMinLabel: 'bottom',
54
- verticalAlignMaxLabel: isDesktop ? 'middle' : 'top',
71
+ verticalAlignMaxLabel: 'top',
55
72
  customValues: [
56
73
  CHART_CONFIG.SENTIMENT_MIN,
57
74
  CHART_CONFIG.SENTIMENT_MAX / 5,
@@ -0,0 +1,26 @@
1
+ export const formatFullDate = (date: Date, locale: string): string => {
2
+ const formattedDate = date
3
+ .toLocaleDateString(locale, {
4
+ day: 'numeric',
5
+ month: '2-digit',
6
+ year: '2-digit',
7
+ })
8
+ .replace(/\//g, '.');
9
+
10
+ const formattedTime = date.toLocaleTimeString(locale, {
11
+ hour: 'numeric',
12
+ minute: '2-digit',
13
+ hour12: false,
14
+ });
15
+
16
+ const formatter = new Intl.DateTimeFormat('en-US', {
17
+ timeZoneName: 'shortOffset',
18
+ });
19
+
20
+ const parts = formatter.formatToParts(date);
21
+ const timeZoneOffset = parts.find(
22
+ (part) => part.type === 'timeZoneName'
23
+ )?.value;
24
+
25
+ return `${formattedDate} ${formattedTime} ${timeZoneOffset}`;
26
+ };
@@ -2,18 +2,7 @@ import { colorPalette } from '@oanda/labs-widget-common';
2
2
 
3
3
  import { BookType } from '../../../../gql/types/graphql';
4
4
  import type { Bucket, TooltipParam } from '../types';
5
-
6
- const DATE_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {
7
- day: 'numeric',
8
- month: 'numeric',
9
- year: 'numeric',
10
-
11
- hour: 'numeric',
12
- minute: '2-digit',
13
- hour12: false,
14
-
15
- timeZoneName: 'shortOffset',
16
- };
5
+ import { formatFullDate } from './formatFullDate';
17
6
 
18
7
  const SENTIMENT_DISPLAY_PRECISION = 2;
19
8
 
@@ -67,7 +56,8 @@ const getSentimentOverbalanceLabel = (
67
56
 
68
57
  const formatCandleData = (
69
58
  candleData: [number, number, number, number, number],
70
- labelCallback: (key: string) => string
59
+ labelCallback: (key: string) => string,
60
+ isDesktop: boolean
71
61
  ): string => {
72
62
  const [, open, close, low, high] = candleData;
73
63
  const candleLabel = labelCallback('candle');
@@ -76,12 +66,19 @@ const formatCandleData = (
76
66
  const lowLabel = labelCallback('low');
77
67
  const highLabel = labelCallback('high');
78
68
 
79
- return `<div><b>${candleLabel}:</b></div>
69
+ return isDesktop
70
+ ? `<div><b>${candleLabel}:</b></div>
71
+ <div style="display: flex; gap: 4px; margin-right: 4px;">
80
72
  <div>${openLabel}: ${open} </div>
81
73
  <div>${closeLabel}: ${close} </div>
82
74
  <div>${lowLabel}: ${low} </div>
83
75
  <div>${highLabel}: ${high} </div>
84
- `;
76
+ </div>`
77
+ : `<div><b>${candleLabel}:</b></div>
78
+ <div>${openLabel}: ${open} </div>
79
+ <div>${closeLabel}: ${close} </div>
80
+ <div>${lowLabel}: ${low} </div>
81
+ <div>${highLabel}: ${high} </div>`;
85
82
  };
86
83
 
87
84
  const formatBookData = ({
@@ -112,8 +109,8 @@ const formatBookData = ({
112
109
 
113
110
  return isDesktop
114
111
  ? `<div><b>${labelCallback(bookLabelKey)}:</b></div>
115
- <div>${labelCallback('price_range')}: ${priceRangeStart} - ${priceRangeEnd} </div>
116
- <div>${labelCallback(sentimentLabel)}: ${sentimentValue}% </div>`
112
+ <span style="margin-right: 4px;">${labelCallback('price_range')}: ${priceRangeStart} - ${priceRangeEnd} </span>
113
+ <span style="margin-right: 4px;">${labelCallback(sentimentLabel)}: ${sentimentValue}% </span>`
117
114
  : `<div><b>${labelCallback(bookLabelKey)}:</b></div>
118
115
  <div>${labelCallback('price_range')}:</div>
119
116
  <div>${priceRangeStart} - ${priceRangeEnd} </div>
@@ -124,9 +121,14 @@ const formatBookData = ({
124
121
  const formatSentimentData = (
125
122
  sentimentLong: number,
126
123
  sentimentShort: number,
127
- labelCallback: (key: string) => string
124
+ labelCallback: (key: string) => string,
125
+ isDesktop: boolean
128
126
  ): string => {
129
- return `<div><b>${labelCallback('sentiment')}:</b></div>
127
+ return isDesktop
128
+ ? `<div><b>${labelCallback('sentiment')}:</b></div>
129
+ <span style="margin-right: 4px;">${labelCallback('long')}: ${sentimentLong.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </span>
130
+ <span style="margin-right: 4px;">${labelCallback('short')}: ${sentimentShort.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </span>`
131
+ : `<div><b>${labelCallback('sentiment')}:</b></div>
130
132
  <div>${labelCallback('long')}: ${sentimentLong.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </div>
131
133
  <div>${labelCallback('short')}: ${sentimentShort.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </div>`;
132
134
  };
@@ -214,11 +216,9 @@ export const getTooltipFormatter = ({
214
216
  return '';
215
217
  }
216
218
 
217
- const timeFormatted = time
218
- .toLocaleString(locale, DATE_FORMAT_OPTIONS)
219
- .replace(/\//g, '.');
219
+ const timeFormatted = formatFullDate(time, locale);
220
220
  const candleSection = showCandles
221
- ? formatCandleData(candleData, labelCallback)
221
+ ? formatCandleData(candleData, labelCallback, isDesktop)
222
222
  : '';
223
223
 
224
224
  const bookSection = matchedBucket
@@ -234,7 +234,12 @@ export const getTooltipFormatter = ({
234
234
 
235
235
  const sentimentSection =
236
236
  showSentiment && sentimentLong && sentimentShort
237
- ? formatSentimentData(sentimentLong, sentimentShort, labelCallback)
237
+ ? formatSentimentData(
238
+ sentimentLong,
239
+ sentimentShort,
240
+ labelCallback,
241
+ isDesktop
242
+ )
238
243
  : '';
239
244
 
240
245
  if (isDesktop) {
@@ -243,7 +248,7 @@ export const getTooltipFormatter = ({
243
248
  candleSection,
244
249
  sentimentSection,
245
250
  bookSection,
246
- hasMatchedBucket: !!matchedBucket,
251
+ isDark,
247
252
  });
248
253
  }
249
254
 
@@ -264,20 +269,29 @@ interface TooltipSections {
264
269
  }
265
270
 
266
271
  const buildDesktopTooltip = ({
267
- timeFormatted,
268
272
  candleSection,
269
273
  sentimentSection,
270
274
  bookSection,
271
- hasMatchedBucket,
272
- }: TooltipSections & { hasMatchedBucket: boolean }): string => {
273
- const padding = TOOLTIP_STYLES.PADDING_BOTTOM;
274
- const sentimentPadding = hasMatchedBucket ? padding : '0px';
275
+ isDark,
276
+ }: TooltipSections & {
277
+ isDark: boolean;
278
+ }): string => {
279
+ const backgroundColor = isDark ? colorPalette.black : colorPalette.white;
280
+ const fullWidth = TOOLTIP_STYLES.FULL_WIDTH;
275
281
 
276
- return `<div style="padding-bottom: ${padding};">${timeFormatted}</div>
277
- <div style="padding-bottom: ${padding};">${candleSection}</div>
278
- <div style="padding-bottom: ${sentimentPadding};">${sentimentSection}</div>
279
- <div>${bookSection}</div>
280
- `;
282
+ return `<div style="width: ${fullWidth}; background-color: ${backgroundColor};">
283
+ <div style="width: ${fullWidth}; display: flex; justify-content: space-between;">
284
+ <div style="width: 40%;">
285
+ ${candleSection}
286
+ </div>
287
+ <div style="width: 22%;">
288
+ ${sentimentSection}
289
+ </div>
290
+ <div style="width: 38%;">
291
+ ${bookSection}
292
+ </div>
293
+ </div>
294
+ </div>`;
281
295
  };
282
296
 
283
297
  const buildMobileTooltip = ({
@@ -1,3 +1,4 @@
1
+ export * from './formatFullDate';
1
2
  export * from './formatXAxisAdditionalLabel';
2
3
  export * from './formatXAxisLabel';
3
4
  export * from './getChartStyles';
@@ -89,7 +89,6 @@ export const getOption: GetOptionType = ({
89
89
  bookType,
90
90
  bucketWidth,
91
91
  buckets,
92
- displayPrecision,
93
92
  labelCallback,
94
93
  selectedPriceRef,
95
94
  tooltipLinesColor: styles.tooltipLinesColor,
@@ -104,11 +103,12 @@ export const getOption: GetOptionType = ({
104
103
  dates,
105
104
  isGreaterThanTwoWeeks,
106
105
  locale,
106
+ isDesktop,
107
107
  }),
108
108
  yAxis: getYAxisConfig({
109
- isDesktop,
110
109
  bucketWidth,
111
110
  displayPrecision,
111
+ selectedPriceRef,
112
112
  }),
113
113
  dataZoom: getDataZoomConfig({ isDesktop }),
114
114
  visualMap: getVisualMapConfig({
@@ -32,22 +32,24 @@ const CHART_CONFIG_STATIC = {
32
32
  X_AXIS_DATE_PADDING: ' ',
33
33
  SENTIMENT_MIN: 0,
34
34
  SENTIMENT_MAX: 100,
35
- TOP_MARGIN_DESKTOP: 0,
36
- TOP_MARGIN_MOBILE: 24,
37
- MOBILE_TOOLTIP_HEIGHT: 85,
35
+ TOP_LABEL_SPACE_DESKTOP: 0,
36
+ TOP_LABEL_SPACE_MOBILE: 24,
37
+ TOOLTIP_HEIGHT_MOBILE: 85,
38
+ TOOLTIP_HEIGHT_DESKTOP: 46,
38
39
  TOOLTIP_OFFSET: 8,
39
40
  };
40
41
 
41
42
  const CHART_CONFIG_CALCULATED = {
42
43
  HEIGHT_DESKTOP:
43
44
  CHART_CONFIG_STATIC.MAIN_HEIGHT_DESKTOP +
44
- CHART_CONFIG_STATIC.TOP_MARGIN_DESKTOP +
45
- CHART_CONFIG_STATIC.X_LABEL_SIZE,
45
+ CHART_CONFIG_STATIC.TOP_LABEL_SPACE_DESKTOP +
46
+ CHART_CONFIG_STATIC.X_LABEL_SIZE +
47
+ CHART_CONFIG_STATIC.TOOLTIP_HEIGHT_DESKTOP,
46
48
  HEIGHT_MOBILE:
47
49
  CHART_CONFIG_STATIC.MAIN_HEIGHT_MOBILE +
48
50
  CHART_CONFIG_STATIC.X_LABEL_SIZE +
49
- CHART_CONFIG_STATIC.TOP_MARGIN_MOBILE +
50
- CHART_CONFIG_STATIC.MOBILE_TOOLTIP_HEIGHT,
51
+ CHART_CONFIG_STATIC.TOP_LABEL_SPACE_MOBILE +
52
+ CHART_CONFIG_STATIC.TOOLTIP_HEIGHT_MOBILE,
51
53
  };
52
54
  export const CHART_CONFIG = {
53
55
  ...CHART_CONFIG_STATIC,
@@ -29,6 +29,7 @@
29
29
  "sentiment": "Sentiment",
30
30
  "short": "Short",
31
31
  "short_overbalance": "Short overbalance",
32
- "tap_chart_to_see_more_details": "Tap chart to see more details",
32
+ "tap_chart_to_see_more_details": "Tap the chart to see more details",
33
+ "hover_chart_to_see_more_details": "Hover over the chart to see more details",
33
34
  "trades": "Trades"
34
35
  }