@oanda/labs-crowd-view-widget 1.0.51 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +428 -0
- package/dist/main/CrowdViewWidget/Main.js +1 -5
- package/dist/main/CrowdViewWidget/Main.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +73 -24
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +18 -9
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js +265 -59
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +68 -26
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js +20 -19
- package/dist/main/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/getChartStyles.js +27 -0
- package/dist/main/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/utils/getGridLines.js +123 -0
- package/dist/main/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/utils/index.js +15 -26
- package/dist/main/CrowdViewWidget/components/Chart/utils/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js +54 -12
- package/dist/main/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js +49 -27
- package/dist/main/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js +43 -0
- package/dist/main/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/utils/validateData.js +8 -2
- package/dist/main/CrowdViewWidget/components/Chart/utils/validateData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js +3 -4
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +2 -2
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/main/CrowdViewWidget/constants.js +14 -8
- package/dist/main/CrowdViewWidget/constants.js.map +1 -1
- package/dist/main/gql/getOrderPositionBooks.js +1 -1
- package/dist/main/gql/getOrderPositionBooks.js.map +1 -1
- package/dist/main/gql/getPriceCandles.js +1 -1
- package/dist/main/gql/getPriceCandles.js.map +1 -1
- package/dist/main/gql/getSentiments.js +11 -0
- package/dist/main/gql/getSentiments.js.map +1 -0
- package/dist/main/gql/types/gql.js +3 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +273 -19
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/module/CrowdViewWidget/Main.js +2 -6
- package/dist/module/CrowdViewWidget/Main.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +76 -27
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +18 -9
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js +265 -60
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +69 -27
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js +21 -20
- package/dist/module/CrowdViewWidget/components/Chart/utils/chartUtils.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/getChartStyles.js +20 -0
- package/dist/module/CrowdViewWidget/components/Chart/utils/getChartStyles.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/utils/getGridLines.js +116 -0
- package/dist/module/CrowdViewWidget/components/Chart/utils/getGridLines.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js +2 -3
- package/dist/module/CrowdViewWidget/components/Chart/utils/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js +54 -12
- package/dist/module/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js +49 -27
- package/dist/module/CrowdViewWidget/components/Chart/utils/processPriceCandles.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js +36 -0
- package/dist/module/CrowdViewWidget/components/Chart/utils/processSentiments.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/utils/validateData.js +8 -2
- package/dist/module/CrowdViewWidget/components/Chart/utils/validateData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js +3 -4
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +2 -2
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/module/CrowdViewWidget/constants.js +13 -7
- package/dist/module/CrowdViewWidget/constants.js.map +1 -1
- package/dist/module/gql/getOrderPositionBooks.js +1 -1
- package/dist/module/gql/getOrderPositionBooks.js.map +1 -1
- package/dist/module/gql/getPriceCandles.js +1 -1
- package/dist/module/gql/getPriceCandles.js.map +1 -1
- package/dist/module/gql/getSentiments.js +6 -0
- package/dist/module/gql/getSentiments.js.map +1 -0
- package/dist/module/gql/types/gql.js +3 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +272 -18
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +69 -9
- package/dist/types/CrowdViewWidget/components/Chart/utils/chartUtils.d.ts +5 -6
- package/dist/types/CrowdViewWidget/components/Chart/utils/getChartStyles.d.ts +10 -0
- package/dist/types/CrowdViewWidget/components/Chart/utils/getGridLines.d.ts +97 -0
- package/dist/types/CrowdViewWidget/components/Chart/utils/index.d.ts +2 -3
- package/dist/types/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.d.ts +10 -7
- package/dist/types/CrowdViewWidget/components/Chart/utils/processPriceCandles.d.ts +6 -21
- package/dist/types/CrowdViewWidget/components/Chart/utils/processSentiments.d.ts +6 -0
- package/dist/types/CrowdViewWidget/components/Chart/utils/validateData.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Legend/Legend.d.ts +2 -2
- package/dist/types/CrowdViewWidget/components/Legend/LegendBar.d.ts +1 -1
- package/dist/types/CrowdViewWidget/constants.d.ts +12 -6
- package/dist/types/gql/getSentiments.d.ts +2 -0
- package/dist/types/gql/types/gql.d.ts +15 -4
- package/dist/types/gql/types/graphql.d.ts +66 -11
- package/package.json +3 -3
- package/src/CrowdViewWidget/Main.tsx +2 -4
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +99 -38
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +24 -7
- package/src/CrowdViewWidget/components/Chart/chartOptions.ts +305 -87
- package/src/CrowdViewWidget/components/Chart/types.ts +82 -16
- package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +105 -56
- package/src/CrowdViewWidget/components/Chart/utils/chartUtils.ts +65 -34
- package/src/CrowdViewWidget/components/Chart/utils/getChartStyles.ts +42 -0
- package/src/CrowdViewWidget/components/Chart/utils/getGridLines.ts +148 -0
- package/src/CrowdViewWidget/components/Chart/utils/index.ts +2 -3
- package/src/CrowdViewWidget/components/Chart/utils/processOrderPositionBooks.ts +84 -22
- package/src/CrowdViewWidget/components/Chart/utils/processPriceCandles.ts +52 -38
- package/src/CrowdViewWidget/components/Chart/utils/processSentiments.ts +55 -0
- package/src/CrowdViewWidget/components/Chart/utils/validateData.ts +10 -2
- package/src/CrowdViewWidget/components/Legend/Legend.tsx +5 -6
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +3 -3
- package/src/CrowdViewWidget/constants.ts +18 -7
- package/src/gql/getOrderPositionBooks.ts +13 -5
- package/src/gql/getPriceCandles.ts +1 -0
- package/src/gql/getSentiments.ts +25 -0
- package/src/gql/types/gql.ts +14 -6
- package/src/gql/types/graphql.ts +259 -16
- package/test/components/Chart/utils/chartUtils.test.ts +105 -13
- package/test/components/Chart/utils/getChartStyles.test.ts +64 -0
- package/test/components/Chart/utils/processSentiments.test.ts +238 -0
- package/test/utils/processOrderPositionBooks.test.ts +201 -84
- package/test/utils/processPriceCandles.test.ts +93 -67
- package/test/utils/validateData.test.ts +136 -38
- package/dist/main/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js +0 -37
- package/dist/main/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js +0 -14
- package/dist/main/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js.map +0 -1
- package/dist/main/CrowdViewWidget/components/Chart/utils/processBuckets.js +0 -29
- package/dist/main/CrowdViewWidget/components/Chart/utils/processBuckets.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js +0 -29
- package/dist/module/CrowdViewWidget/components/Chart/utils/aggregateBuckets.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js +0 -7
- package/dist/module/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.js.map +0 -1
- package/dist/module/CrowdViewWidget/components/Chart/utils/processBuckets.js +0 -22
- package/dist/module/CrowdViewWidget/components/Chart/utils/processBuckets.js.map +0 -1
- package/dist/types/CrowdViewWidget/components/Chart/utils/aggregateBuckets.d.ts +0 -2
- package/dist/types/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.d.ts +0 -3
- package/dist/types/CrowdViewWidget/components/Chart/utils/processBuckets.d.ts +0 -3
- package/src/CrowdViewWidget/components/Chart/utils/aggregateBuckets.ts +0 -44
- package/src/CrowdViewWidget/components/Chart/utils/getTargetBucketWidth.ts +0 -13
- package/src/CrowdViewWidget/components/Chart/utils/processBuckets.ts +0 -43
- package/test/utils/aggregateBuckets.test.ts +0 -82
- package/test/utils/getTargetBucketWidth.test.ts +0 -37
- package/test/utils/processBuckets.test.ts +0 -153
|
@@ -1,66 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
import { colorPalette, getGridLines, getLineCommons, themeColors } from '@oanda/labs-widget-common';
|
|
7
|
-
import { CHART_CONFIG } from '../../constants';
|
|
1
|
+
import chroma from 'chroma-js';
|
|
2
|
+
import { BUCKET_CONFIG, CHART_CONFIG, CHART_CONFIG_CALCULATED } from '../../constants';
|
|
8
3
|
import { formatXAxisLabel, getLabelData, getRectColor, getTooltipFormatter, isDifferenceGreaterThanTwoWeeks } from './utils/chartUtils';
|
|
9
|
-
|
|
4
|
+
import { getChartStyles } from './utils/getChartStyles';
|
|
5
|
+
import { getGridLines } from './utils/getGridLines';
|
|
6
|
+
export const getOption = _ref => {
|
|
10
7
|
let {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
mainData: {
|
|
9
|
+
dates,
|
|
10
|
+
candlesOpen,
|
|
11
|
+
candlesClose,
|
|
12
|
+
candlesLow,
|
|
13
|
+
candlesHigh,
|
|
14
|
+
bookPrices,
|
|
15
|
+
bookIndexes,
|
|
16
|
+
sentimentShorts,
|
|
17
|
+
sentimentLongs
|
|
18
|
+
},
|
|
19
|
+
additionalData: {
|
|
20
|
+
bucketWidth,
|
|
21
|
+
buckets,
|
|
22
|
+
displayPrecision,
|
|
23
|
+
bookType,
|
|
24
|
+
sentimentThresholdMin,
|
|
25
|
+
sentimentThresholdMax
|
|
26
|
+
},
|
|
27
|
+
isDark,
|
|
28
|
+
isDesktop,
|
|
29
|
+
labelCallback
|
|
18
30
|
} = _ref;
|
|
19
31
|
let selectedPrice;
|
|
20
|
-
const
|
|
32
|
+
const {
|
|
33
|
+
sentimentLongColor,
|
|
34
|
+
sentimentShortColor,
|
|
35
|
+
candleLongColor,
|
|
36
|
+
candleShortColor,
|
|
37
|
+
sentimentAreaOpacity,
|
|
38
|
+
tooltipLinesColor,
|
|
39
|
+
sentimentLabelColor
|
|
40
|
+
} = getChartStyles(isDark);
|
|
41
|
+
const visibleXAxisData = dates.slice(dates.length * CHART_CONFIG.INITIAL_START_ZOOM / 100, dates.length * CHART_CONFIG.INITIAL_END_ZOOM / 100);
|
|
21
42
|
const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(visibleXAxisData[0], visibleXAxisData[visibleXAxisData.length - 1]);
|
|
22
43
|
const labelsData = getLabelData({
|
|
23
|
-
|
|
44
|
+
dates,
|
|
24
45
|
isGreaterThanTwoWeeks
|
|
25
46
|
});
|
|
26
|
-
const
|
|
47
|
+
const gridMainLines = getGridLines({
|
|
27
48
|
isDark,
|
|
28
|
-
|
|
29
|
-
chartHeight: CHART_CONFIG.HEIGHT,
|
|
30
|
-
xLabelsSize: CHART_CONFIG.X_LABEL_SIZE,
|
|
31
|
-
yLabelSize: isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE,
|
|
32
|
-
bottomLeftBox: false
|
|
49
|
+
isDesktop
|
|
33
50
|
});
|
|
34
51
|
return {
|
|
35
52
|
animation: false,
|
|
36
53
|
dataZoom: [{
|
|
54
|
+
id: 'main',
|
|
37
55
|
type: 'inside',
|
|
38
56
|
xAxisIndex: 0,
|
|
39
57
|
start: CHART_CONFIG.INITIAL_START_ZOOM,
|
|
40
|
-
end: CHART_CONFIG.INITIAL_END_ZOOM
|
|
58
|
+
end: CHART_CONFIG.INITIAL_END_ZOOM,
|
|
59
|
+
filterMode: 'filter'
|
|
60
|
+
}, {
|
|
61
|
+
id: 'sentiment',
|
|
62
|
+
type: 'inside',
|
|
63
|
+
xAxisIndex: 1,
|
|
64
|
+
start: CHART_CONFIG.INITIAL_START_ZOOM,
|
|
65
|
+
end: CHART_CONFIG.INITIAL_END_ZOOM,
|
|
66
|
+
filterMode: 'none'
|
|
41
67
|
}],
|
|
42
68
|
tooltip: {
|
|
43
69
|
trigger: 'axis',
|
|
44
70
|
axisPointer: {
|
|
45
71
|
type: 'cross',
|
|
46
72
|
axis: 'x',
|
|
73
|
+
lineStyle: {
|
|
74
|
+
color: tooltipLinesColor
|
|
75
|
+
},
|
|
47
76
|
crossStyle: {
|
|
48
|
-
color:
|
|
77
|
+
color: tooltipLinesColor
|
|
49
78
|
},
|
|
50
79
|
label: {
|
|
80
|
+
padding: 0,
|
|
81
|
+
lineHeight: 24,
|
|
51
82
|
formatter: params => {
|
|
52
|
-
if (params.axisDimension === 'y') {
|
|
83
|
+
if (params.axisDimension === 'y' && params.axisIndex === 0) {
|
|
53
84
|
selectedPrice = Number(params.value);
|
|
54
|
-
return Number(params.value).toFixed(
|
|
55
|
-
}
|
|
56
|
-
if (params.axisDimension === 'x') {
|
|
57
|
-
const date = new Date(params.value);
|
|
58
|
-
return date.toLocaleString(undefined, {
|
|
59
|
-
hour: '2-digit',
|
|
60
|
-
minute: '2-digit',
|
|
61
|
-
day: 'numeric',
|
|
62
|
-
month: 'short'
|
|
63
|
-
});
|
|
85
|
+
return " ".concat(Number(params.value).toFixed(displayPrecision), " ");
|
|
64
86
|
}
|
|
65
87
|
return null;
|
|
66
88
|
}
|
|
@@ -73,13 +95,16 @@ export const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
73
95
|
bucketWidth,
|
|
74
96
|
selectedPrice,
|
|
75
97
|
labelCallback,
|
|
76
|
-
precision,
|
|
77
98
|
bookType
|
|
78
99
|
})
|
|
79
100
|
},
|
|
80
|
-
xAxis: {
|
|
101
|
+
xAxis: [{
|
|
81
102
|
type: 'category',
|
|
82
|
-
|
|
103
|
+
name: 'xAxis-less-than-two-weeks',
|
|
104
|
+
nameTextStyle: {
|
|
105
|
+
fontSize: 0
|
|
106
|
+
},
|
|
107
|
+
id: 'main-xAxis',
|
|
83
108
|
splitNumber: 1,
|
|
84
109
|
axisTick: {
|
|
85
110
|
show: false
|
|
@@ -89,12 +114,25 @@ export const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
89
114
|
margin: 0,
|
|
90
115
|
formatter: value => formatXAxisLabel(value, isGreaterThanTwoWeeks)
|
|
91
116
|
}
|
|
92
|
-
},
|
|
93
|
-
|
|
117
|
+
}, {
|
|
118
|
+
type: 'category',
|
|
119
|
+
gridIndex: 1,
|
|
120
|
+
show: false,
|
|
121
|
+
data: dates,
|
|
122
|
+
splitNumber: 1,
|
|
123
|
+
axisTick: {
|
|
124
|
+
show: false
|
|
125
|
+
},
|
|
126
|
+
axisLabel: {
|
|
127
|
+
show: false
|
|
128
|
+
}
|
|
129
|
+
}],
|
|
130
|
+
yAxis: [{
|
|
94
131
|
type: 'value',
|
|
132
|
+
gridIndex: 0,
|
|
95
133
|
position: 'right',
|
|
96
|
-
min: val => val.min - bucketWidth *
|
|
97
|
-
max: val => val.max + bucketWidth *
|
|
134
|
+
min: val => val.min - bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
|
|
135
|
+
max: val => val.max + bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
|
|
98
136
|
axisLine: {
|
|
99
137
|
show: false
|
|
100
138
|
},
|
|
@@ -104,19 +142,111 @@ export const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
104
142
|
axisLabel: {
|
|
105
143
|
showMaxLabel: false,
|
|
106
144
|
showMinLabel: false,
|
|
145
|
+
formatter: value => value.toFixed(displayPrecision - 1)
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
type: 'value',
|
|
149
|
+
gridIndex: 1,
|
|
150
|
+
position: 'right',
|
|
151
|
+
min: CHART_CONFIG.SENTIMENT_MIN,
|
|
152
|
+
max: CHART_CONFIG.SENTIMENT_MAX,
|
|
153
|
+
interval: CHART_CONFIG.SENTIMENT_INTERVAL,
|
|
154
|
+
axisLine: {
|
|
155
|
+
show: false
|
|
156
|
+
},
|
|
157
|
+
axisTick: {
|
|
158
|
+
show: false
|
|
159
|
+
},
|
|
160
|
+
axisLabel: {
|
|
161
|
+
verticalAlignMaxLabel: 'top',
|
|
162
|
+
verticalAlignMinLabel: 'bottom',
|
|
163
|
+
lineHeight: 20,
|
|
107
164
|
margin: isDesktop ? 4 : 2,
|
|
108
|
-
|
|
165
|
+
rich: {
|
|
166
|
+
shortRect: {
|
|
167
|
+
backgroundColor: chroma(sentimentShortColor).alpha(0.3).css(),
|
|
168
|
+
borderColor: sentimentShortColor,
|
|
169
|
+
borderWidth: 1,
|
|
170
|
+
width: 8,
|
|
171
|
+
height: 8
|
|
172
|
+
},
|
|
173
|
+
longRect: {
|
|
174
|
+
backgroundColor: chroma(sentimentLongColor).alpha(0.3).css(),
|
|
175
|
+
borderColor: sentimentLongColor,
|
|
176
|
+
borderWidth: 1,
|
|
177
|
+
width: 8,
|
|
178
|
+
height: 8
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
formatter: value => {
|
|
182
|
+
if (value === CHART_CONFIG.SENTIMENT_MIN) {
|
|
183
|
+
return "{shortRect| } ".concat(labelCallback('short'));
|
|
184
|
+
}
|
|
185
|
+
if (value === CHART_CONFIG.SENTIMENT_MAX) {
|
|
186
|
+
return "{longRect| } ".concat(labelCallback('long'));
|
|
187
|
+
}
|
|
188
|
+
if (value === CHART_CONFIG.SENTIMENT_MAX / 2) {
|
|
189
|
+
return '50%';
|
|
190
|
+
}
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}],
|
|
195
|
+
axisPointer: {
|
|
196
|
+
link: [{
|
|
197
|
+
xAxisIndex: 'all'
|
|
198
|
+
}]
|
|
199
|
+
},
|
|
200
|
+
visualMap: {
|
|
201
|
+
show: false,
|
|
202
|
+
seriesId: 'sentiment',
|
|
203
|
+
dimension: 1,
|
|
204
|
+
pieces: [{
|
|
205
|
+
lt: CHART_CONFIG.SENTIMENT_MAX / 2,
|
|
206
|
+
color: sentimentShortColor
|
|
207
|
+
}, {
|
|
208
|
+
gte: CHART_CONFIG.SENTIMENT_MAX / 2,
|
|
209
|
+
lte: CHART_CONFIG.SENTIMENT_MAX,
|
|
210
|
+
color: sentimentLongColor
|
|
211
|
+
}, {
|
|
212
|
+
gt: CHART_CONFIG.SENTIMENT_MAX,
|
|
213
|
+
color: sentimentLongColor
|
|
214
|
+
}]
|
|
215
|
+
},
|
|
216
|
+
dataset: {
|
|
217
|
+
source: {
|
|
218
|
+
dates,
|
|
219
|
+
candlesOpen,
|
|
220
|
+
candlesClose,
|
|
221
|
+
candlesLow,
|
|
222
|
+
candlesHigh,
|
|
223
|
+
bookPrices,
|
|
224
|
+
bookIndexes,
|
|
225
|
+
sentimentShorts,
|
|
226
|
+
sentimentLongs
|
|
109
227
|
}
|
|
110
228
|
},
|
|
111
229
|
series: [{
|
|
112
230
|
type: 'candlestick',
|
|
113
231
|
id: 'candlestick',
|
|
114
|
-
|
|
232
|
+
gridIndex: 0,
|
|
233
|
+
xAxisIndex: 0,
|
|
234
|
+
yAxisIndex: 0,
|
|
235
|
+
encode: {
|
|
236
|
+
x: 'dates',
|
|
237
|
+
y: ['open', 'close', 'low', 'high']
|
|
238
|
+
},
|
|
115
239
|
itemStyle: {
|
|
116
|
-
color:
|
|
117
|
-
color0:
|
|
118
|
-
borderColor:
|
|
119
|
-
borderColor0:
|
|
240
|
+
color: chroma(candleShortColor).desaturate().css(),
|
|
241
|
+
color0: chroma(candleLongColor).desaturate().css(),
|
|
242
|
+
borderColor: candleShortColor,
|
|
243
|
+
borderColor0: candleLongColor
|
|
244
|
+
},
|
|
245
|
+
emphasis: {
|
|
246
|
+
itemStyle: {
|
|
247
|
+
color: candleShortColor,
|
|
248
|
+
color0: candleLongColor
|
|
249
|
+
}
|
|
120
250
|
},
|
|
121
251
|
markPoint: {
|
|
122
252
|
symbol: 'circle',
|
|
@@ -125,13 +255,24 @@ export const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
125
255
|
}
|
|
126
256
|
}, {
|
|
127
257
|
type: 'custom',
|
|
258
|
+
gridIndex: 0,
|
|
128
259
|
name: 'heatmap',
|
|
129
260
|
id: 'heatmap',
|
|
261
|
+
xAxisIndex: 0,
|
|
262
|
+
yAxisIndex: 0,
|
|
130
263
|
silent: true,
|
|
131
264
|
clip: true,
|
|
265
|
+
encode: {
|
|
266
|
+
x: 'dates',
|
|
267
|
+
y: 'bookPrices'
|
|
268
|
+
},
|
|
269
|
+
dimensions: ['dates', 'bookPrices', 'bookIndexes'],
|
|
132
270
|
renderItem: (_params, api) => {
|
|
133
271
|
const xVal = api.value(0);
|
|
134
272
|
const bucketIndex = api.value(2);
|
|
273
|
+
if (!bucketIndex) {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
135
276
|
const metaValues = buckets[bucketIndex];
|
|
136
277
|
const [rectWidth, rectHeight] = api.size([0, bucketWidth]);
|
|
137
278
|
const items = metaValues.map(_ref2 => {
|
|
@@ -149,7 +290,7 @@ export const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
149
290
|
height: rectHeight
|
|
150
291
|
},
|
|
151
292
|
style: {
|
|
152
|
-
fill: getRectColor(sentiment, isDark)
|
|
293
|
+
fill: getRectColor(sentiment, isDark, sentimentThresholdMin, sentimentThresholdMax)
|
|
153
294
|
},
|
|
154
295
|
silent: true,
|
|
155
296
|
emphasisDisabled: true
|
|
@@ -161,26 +302,90 @@ export const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
161
302
|
silent: true,
|
|
162
303
|
emphasisDisabled: true
|
|
163
304
|
};
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
type: 'line',
|
|
308
|
+
name: 'sentiment-short',
|
|
309
|
+
id: 'sentiment',
|
|
310
|
+
xAxisIndex: 1,
|
|
311
|
+
yAxisIndex: 1,
|
|
312
|
+
showSymbol: false,
|
|
313
|
+
symbol: 'none',
|
|
314
|
+
lineStyle: {
|
|
315
|
+
width: 3,
|
|
316
|
+
opacity: 1
|
|
317
|
+
},
|
|
318
|
+
areaStyle: {
|
|
319
|
+
color: sentimentShortColor,
|
|
320
|
+
opacity: sentimentAreaOpacity
|
|
321
|
+
},
|
|
322
|
+
emphasis: {
|
|
323
|
+
disabled: true
|
|
324
|
+
},
|
|
325
|
+
stack: 'sentiment',
|
|
326
|
+
dimensions: ['dates', 'sentimentShorts', 'sentimentLongs'],
|
|
327
|
+
encode: {
|
|
328
|
+
x: 'dates',
|
|
329
|
+
y: 'sentimentShorts'
|
|
330
|
+
}
|
|
331
|
+
}, {
|
|
332
|
+
type: 'line',
|
|
333
|
+
name: 'sentiment-long',
|
|
334
|
+
id: 'sentiment-long',
|
|
335
|
+
xAxisIndex: 1,
|
|
336
|
+
yAxisIndex: 1,
|
|
337
|
+
symbol: 'none',
|
|
338
|
+
lineStyle: {
|
|
339
|
+
color: 'transparent',
|
|
340
|
+
width: 0
|
|
341
|
+
},
|
|
342
|
+
areaStyle: {
|
|
343
|
+
color: sentimentLongColor,
|
|
344
|
+
opacity: sentimentAreaOpacity
|
|
164
345
|
},
|
|
165
|
-
|
|
346
|
+
stack: 'sentiment',
|
|
347
|
+
emphasis: {
|
|
348
|
+
disabled: true
|
|
349
|
+
},
|
|
350
|
+
tooltip: {
|
|
351
|
+
show: false
|
|
352
|
+
},
|
|
353
|
+
dimensions: ['dates', 'sentimentLongs'],
|
|
354
|
+
encode: {
|
|
355
|
+
x: 'dates',
|
|
356
|
+
y: 'sentimentLongs'
|
|
357
|
+
}
|
|
166
358
|
}],
|
|
167
359
|
grid: [{
|
|
168
360
|
name: 'main-grid',
|
|
361
|
+
id: 'main-grid',
|
|
362
|
+
height: "".concat(CHART_CONFIG.MAIN_HEIGHT, "px"),
|
|
169
363
|
top: '0px',
|
|
170
364
|
left: '0px',
|
|
171
365
|
right: "".concat(isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE, "px"),
|
|
172
366
|
bottom: "".concat(CHART_CONFIG.X_LABEL_SIZE, "px")
|
|
367
|
+
}, {
|
|
368
|
+
name: 'sentiment-grid',
|
|
369
|
+
id: 'sentiment-grid',
|
|
370
|
+
height: "".concat(CHART_CONFIG.SENTIMENT_HEIGHT, "px"),
|
|
371
|
+
bottom: "0px",
|
|
372
|
+
left: '0px',
|
|
373
|
+
right: "".concat(isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE, "px")
|
|
173
374
|
}],
|
|
174
|
-
graphic: [...
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
375
|
+
graphic: [...gridMainLines, {
|
|
376
|
+
type: 'text',
|
|
377
|
+
silent: true,
|
|
378
|
+
z: 1,
|
|
379
|
+
left: 4,
|
|
380
|
+
bottom: CHART_CONFIG_CALCULATED.SENTIMENT_TEXT_POSITION,
|
|
381
|
+
style: {
|
|
382
|
+
text: "".concat(labelCallback('sentiment'), ":"),
|
|
383
|
+
fontFamily: 'Sofia W03',
|
|
384
|
+
fontSize: 14,
|
|
385
|
+
fontWeight: 'bold',
|
|
386
|
+
fill: sentimentLabelColor
|
|
182
387
|
}
|
|
183
|
-
}
|
|
388
|
+
}]
|
|
184
389
|
};
|
|
185
390
|
};
|
|
186
391
|
//# sourceMappingURL=chartOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chartOptions.js","names":["colorPalette","getGridLines","getLineCommons","themeColors","CHART_CONFIG","formatXAxisLabel","getLabelData","getRectColor","getTooltipFormatter","isDifferenceGreaterThanTwoWeeks","getOption","_ref","isDark","isDesktop","labelCallback","xAxisData","candlesSeriesData","orderPositionBooks","bucketWidth","buckets","precision","bookType","selectedPrice","visibleXAxisData","slice","length","INITIAL_START_ZOOM","INITIAL_END_ZOOM","isGreaterThanTwoWeeks","labelsData","gridLines","chartWidth","WIDTH","chartHeight","HEIGHT","xLabelsSize","X_LABEL_SIZE","yLabelSize","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","bottomLeftBox","animation","dataZoom","type","xAxisIndex","start","end","tooltip","trigger","axisPointer","axis","crossStyle","color","orange","borderPrimary","light","label","formatter","params","axisDimension","Number","value","toFixed","date","Date","toLocaleString","undefined","hour","minute","day","month","confine","xAxis","data","splitNumber","axisTick","show","axisLabel","padding","margin","yAxis","position","min","val","max","axisLine","showMaxLabel","showMinLabel","series","id","itemStyle","raspberryLight","color0","bottleGreenDark","bottleGreenLight","borderColor","borderColor0","markPoint","symbol","symbolSize","name","silent","clip","renderItem","_params","api","xVal","bucketIndex","metaValues","rectWidth","rectHeight","size","items","map","_ref2","price","sentiment","coord","shape","x","y","width","height","style","fill","emphasisDisabled","children","grid","top","left","right","concat","bottom","graphic","_objectSpread","x1","y1","x2","y2"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/chartOptions.ts"],"sourcesContent":["import {\n colorPalette,\n getGridLines,\n getLineCommons,\n themeColors,\n} from '@oanda/labs-widget-common';\n\nimport { CHART_CONFIG } from '../../constants';\nimport type { Bucket, GetOptionType } from './types';\nimport {\n formatXAxisLabel,\n getLabelData,\n getRectColor,\n getTooltipFormatter,\n isDifferenceGreaterThanTwoWeeks,\n} from './utils/chartUtils';\n\n// @ts-expect-error\nexport const getOption: GetOptionType = (\n {\n xAxisData,\n candlesSeriesData,\n orderPositionBooks,\n bucketWidth,\n buckets,\n precision,\n bookType,\n },\n isDark,\n isDesktop,\n labelCallback\n) => {\n let selectedPrice: number;\n const visibleXAxisData = xAxisData.slice(\n (xAxisData.length * CHART_CONFIG.INITIAL_START_ZOOM) / 100,\n (xAxisData.length * CHART_CONFIG.INITIAL_END_ZOOM) / 100\n );\n\n const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(\n visibleXAxisData[0],\n visibleXAxisData[visibleXAxisData.length - 1]\n );\n\n const labelsData = getLabelData({\n xAxisData,\n isGreaterThanTwoWeeks,\n });\n\n const gridLines = getGridLines({\n isDark,\n chartWidth: CHART_CONFIG.WIDTH,\n chartHeight: CHART_CONFIG.HEIGHT,\n xLabelsSize: CHART_CONFIG.X_LABEL_SIZE,\n yLabelSize: isDesktop\n ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP\n : CHART_CONFIG.Y_LABEL_SIZE_MOBILE,\n bottomLeftBox: false,\n });\n\n return {\n animation: false,\n dataZoom: [\n {\n type: 'inside',\n xAxisIndex: 0,\n start: CHART_CONFIG.INITIAL_START_ZOOM,\n end: CHART_CONFIG.INITIAL_END_ZOOM,\n },\n ],\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n type: 'cross',\n axis: 'x',\n crossStyle: {\n color: isDark ? colorPalette.orange : themeColors.borderPrimary.light,\n },\n label: {\n formatter: (params) => {\n if (params.axisDimension === 'y') {\n selectedPrice = Number(params.value);\n return Number(params.value).toFixed(precision);\n }\n\n if (params.axisDimension === 'x') {\n const date = new Date(params.value as string);\n return date.toLocaleString(undefined, {\n hour: '2-digit',\n minute: '2-digit',\n day: 'numeric',\n month: 'short',\n });\n }\n\n return null;\n },\n },\n },\n confine: true,\n formatter: (params) =>\n getTooltipFormatter({\n params,\n buckets,\n bucketWidth,\n selectedPrice,\n labelCallback,\n precision,\n bookType,\n }),\n },\n xAxis: {\n type: 'category',\n data: xAxisData,\n splitNumber: 1,\n axisTick: {\n show: false,\n },\n axisLabel: {\n padding: [8, 16, 8, 16],\n margin: 0,\n formatter: (value) => formatXAxisLabel(value, isGreaterThanTwoWeeks),\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n min: (val) => val.min - bucketWidth * 2,\n max: (val) => val.max + bucketWidth * 2,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n margin: isDesktop ? 4 : 2,\n formatter: (value: number) => value.toFixed(precision - 1),\n },\n },\n series: [\n {\n type: 'candlestick',\n id: 'candlestick',\n data: candlesSeriesData,\n itemStyle: {\n color: isDark ? colorPalette.orange : colorPalette.raspberryLight,\n color0: isDark\n ? colorPalette.bottleGreenDark\n : colorPalette.bottleGreenLight,\n borderColor: isDark\n ? colorPalette.orange\n : colorPalette.raspberryLight,\n borderColor0: isDark\n ? colorPalette.bottleGreenDark\n : colorPalette.bottleGreenLight,\n },\n\n markPoint: {\n symbol: 'circle',\n symbolSize: 0,\n data: labelsData,\n },\n },\n {\n type: 'custom',\n name: 'heatmap',\n id: 'heatmap',\n silent: true,\n clip: true,\n renderItem: (_params, api) => {\n const xVal = api.value(0);\n const bucketIndex = api.value(2) as number;\n const metaValues = buckets[bucketIndex];\n\n const [rectWidth, rectHeight] = api.size!([\n 0,\n bucketWidth,\n ]) as number[];\n\n const items = metaValues.map(({ price, sentiment }: Bucket) => {\n const start = api.coord([xVal, price]);\n\n return {\n type: 'rect',\n shape: {\n x: start[0] - rectWidth / 2,\n y: start[1] - rectHeight,\n width: rectWidth + 1,\n height: rectHeight,\n },\n style: {\n fill: getRectColor(sentiment, isDark),\n },\n silent: true,\n emphasisDisabled: true,\n };\n });\n\n return {\n type: 'group',\n children: items,\n silent: true,\n emphasisDisabled: true,\n };\n },\n data: orderPositionBooks,\n },\n ],\n grid: [\n {\n name: 'main-grid',\n top: '0px',\n left: '0px',\n right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,\n bottom: `${CHART_CONFIG.X_LABEL_SIZE}px`,\n },\n ],\n graphic: [\n ...gridLines,\n {\n ...getLineCommons(isDark as boolean),\n top: 0,\n right: 0,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n },\n },\n ],\n };\n};\n"],"mappings":";;;;;AAAA,SACEA,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,WAAW,QACN,2BAA2B;AAElC,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,SACEC,gBAAgB,EAChBC,YAAY,EACZC,YAAY,EACZC,mBAAmB,EACnBC,+BAA+B,QAC1B,oBAAoB;AAG3B,OAAO,MAAMC,SAAwB,GAAGA,CAAAC,IAAA,EAUtCC,MAAM,EACNC,SAAS,EACTC,aAAa,KACV;EAAA,IAZH;IACEC,SAAS;IACTC,iBAAiB;IACjBC,kBAAkB;IAClBC,WAAW;IACXC,OAAO;IACPC,SAAS;IACTC;EACF,CAAC,GAAAV,IAAA;EAKD,IAAIW,aAAqB;EACzB,MAAMC,gBAAgB,GAAGR,SAAS,CAACS,KAAK,CACrCT,SAAS,CAACU,MAAM,GAAGrB,YAAY,CAACsB,kBAAkB,GAAI,GAAG,EACzDX,SAAS,CAACU,MAAM,GAAGrB,YAAY,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AC;MACRZ,KAAK,EAAE;QACLiB,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE;MACN;IAAC;EAGP,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"chartOptions.js","names":["chroma","BUCKET_CONFIG","CHART_CONFIG","CHART_CONFIG_CALCULATED","formatXAxisLabel","getLabelData","getRectColor","getTooltipFormatter","isDifferenceGreaterThanTwoWeeks","getChartStyles","getGridLines","getOption","_ref","mainData","dates","candlesOpen","candlesClose","candlesLow","candlesHigh","bookPrices","bookIndexes","sentimentShorts","sentimentLongs","additionalData","bucketWidth","buckets","displayPrecision","bookType","sentimentThresholdMin","sentimentThresholdMax","isDark","isDesktop","labelCallback","selectedPrice","sentimentLongColor","sentimentShortColor","candleLongColor","candleShortColor","sentimentAreaOpacity","tooltipLinesColor","sentimentLabelColor","visibleXAxisData","slice","length","INITIAL_START_ZOOM","INITIAL_END_ZOOM","isGreaterThanTwoWeeks","labelsData","gridMainLines","animation","dataZoom","id","type","xAxisIndex","start","end","filterMode","tooltip","trigger","axisPointer","axis","lineStyle","color","crossStyle","label","padding","lineHeight","formatter","params","axisDimension","axisIndex","Number","value","concat","toFixed","confine","xAxis","name","nameTextStyle","fontSize","splitNumber","axisTick","show","axisLabel","margin","gridIndex","data","yAxis","position","min","val","PRICE_MARGIN_MULTIPLIER","max","axisLine","showMaxLabel","showMinLabel","SENTIMENT_MIN","SENTIMENT_MAX","interval","SENTIMENT_INTERVAL","verticalAlignMaxLabel","verticalAlignMinLabel","rich","shortRect","backgroundColor","alpha","css","borderColor","borderWidth","width","height","longRect","undefined","link","visualMap","seriesId","dimension","pieces","lt","gte","lte","gt","dataset","source","series","yAxisIndex","encode","x","y","itemStyle","desaturate","color0","borderColor0","emphasis","markPoint","symbol","symbolSize","silent","clip","dimensions","renderItem","_params","api","xVal","bucketIndex","metaValues","rectWidth","rectHeight","size","items","map","_ref2","price","sentiment","coord","shape","style","fill","emphasisDisabled","children","showSymbol","opacity","areaStyle","disabled","stack","grid","MAIN_HEIGHT","top","left","right","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","bottom","X_LABEL_SIZE","SENTIMENT_HEIGHT","graphic","z","SENTIMENT_TEXT_POSITION","text","fontFamily","fontWeight"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/chartOptions.ts"],"sourcesContent":["import chroma from 'chroma-js';\n\nimport {\n BUCKET_CONFIG,\n CHART_CONFIG,\n CHART_CONFIG_CALCULATED,\n} from '../../constants';\nimport type { Bucket, GetOptionType, TooltipParam } from './types';\nimport {\n formatXAxisLabel,\n getLabelData,\n getRectColor,\n getTooltipFormatter,\n isDifferenceGreaterThanTwoWeeks,\n} from './utils/chartUtils';\nimport { getChartStyles } from './utils/getChartStyles';\nimport { getGridLines } from './utils/getGridLines';\n\n// @ts-expect-error\nexport const getOption: GetOptionType = ({\n mainData: {\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n bookPrices,\n bookIndexes,\n sentimentShorts,\n sentimentLongs,\n },\n additionalData: {\n bucketWidth,\n buckets,\n displayPrecision,\n bookType,\n sentimentThresholdMin,\n sentimentThresholdMax,\n },\n isDark,\n isDesktop,\n labelCallback,\n}) => {\n let selectedPrice: number;\n const {\n sentimentLongColor,\n sentimentShortColor,\n candleLongColor,\n candleShortColor,\n sentimentAreaOpacity,\n tooltipLinesColor,\n sentimentLabelColor,\n } = getChartStyles(isDark);\n\n const visibleXAxisData = dates.slice(\n (dates.length * CHART_CONFIG.INITIAL_START_ZOOM) / 100,\n (dates.length * CHART_CONFIG.INITIAL_END_ZOOM) / 100\n );\n\n const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(\n visibleXAxisData[0],\n visibleXAxisData[visibleXAxisData.length - 1]\n );\n\n const labelsData = getLabelData({\n dates,\n isGreaterThanTwoWeeks,\n });\n\n const gridMainLines = getGridLines({\n isDark,\n isDesktop,\n });\n\n return {\n animation: false,\n dataZoom: [\n {\n id: 'main',\n type: 'inside',\n xAxisIndex: 0,\n start: CHART_CONFIG.INITIAL_START_ZOOM,\n end: CHART_CONFIG.INITIAL_END_ZOOM,\n filterMode: 'filter',\n },\n {\n id: 'sentiment',\n type: 'inside',\n xAxisIndex: 1,\n start: CHART_CONFIG.INITIAL_START_ZOOM,\n end: CHART_CONFIG.INITIAL_END_ZOOM,\n filterMode: 'none',\n },\n ],\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n type: 'cross',\n axis: 'x',\n lineStyle: {\n color: tooltipLinesColor,\n },\n crossStyle: {\n color: tooltipLinesColor,\n },\n label: {\n padding: 0,\n lineHeight: 24,\n formatter: (params) => {\n if (params.axisDimension === 'y' && params.axisIndex === 0) {\n selectedPrice = Number(params.value);\n return ` ${Number(params.value).toFixed(displayPrecision)} `;\n }\n\n return null;\n },\n },\n },\n confine: true,\n formatter: (params: TooltipParam[]) =>\n getTooltipFormatter({\n params,\n buckets,\n bucketWidth,\n selectedPrice,\n labelCallback,\n bookType,\n }),\n },\n xAxis: [\n {\n type: 'category',\n name: 'xAxis-less-than-two-weeks',\n nameTextStyle: {\n fontSize: 0,\n },\n id: 'main-xAxis',\n splitNumber: 1,\n axisTick: {\n show: false,\n },\n axisLabel: {\n padding: [8, 16, 8, 16],\n margin: 0,\n formatter: (value) => formatXAxisLabel(value, isGreaterThanTwoWeeks),\n },\n },\n {\n type: 'category',\n gridIndex: 1,\n show: false,\n data: dates,\n splitNumber: 1,\n axisTick: {\n show: false,\n },\n axisLabel: {\n show: false,\n },\n },\n ],\n yAxis: [\n {\n type: 'value',\n gridIndex: 0,\n position: 'right',\n min: (val) =>\n val.min - bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,\n max: (val) =>\n val.max + bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n formatter: (value: number) => value.toFixed(displayPrecision - 1),\n },\n },\n {\n type: 'value',\n gridIndex: 1,\n position: 'right',\n min: CHART_CONFIG.SENTIMENT_MIN,\n max: CHART_CONFIG.SENTIMENT_MAX,\n interval: CHART_CONFIG.SENTIMENT_INTERVAL,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n verticalAlignMaxLabel: 'top',\n verticalAlignMinLabel: 'bottom',\n lineHeight: 20,\n margin: isDesktop ? 4 : 2,\n rich: {\n shortRect: {\n backgroundColor: chroma(sentimentShortColor).alpha(0.3).css(),\n borderColor: sentimentShortColor,\n borderWidth: 1,\n width: 8,\n height: 8,\n },\n longRect: {\n backgroundColor: chroma(sentimentLongColor).alpha(0.3).css(),\n borderColor: sentimentLongColor,\n borderWidth: 1,\n width: 8,\n height: 8,\n },\n },\n formatter: (value: number) => {\n if (value === CHART_CONFIG.SENTIMENT_MIN) {\n return `{shortRect| } ${labelCallback('short')}`;\n }\n\n if (value === CHART_CONFIG.SENTIMENT_MAX) {\n return `{longRect| } ${labelCallback('long')}`;\n }\n\n if (value === CHART_CONFIG.SENTIMENT_MAX / 2) {\n return '50%';\n }\n\n return undefined;\n },\n },\n },\n ],\n axisPointer: {\n link: [\n {\n xAxisIndex: 'all',\n },\n ],\n },\n visualMap: {\n show: false,\n seriesId: 'sentiment',\n dimension: 1,\n pieces: [\n {\n lt: CHART_CONFIG.SENTIMENT_MAX / 2,\n color: sentimentShortColor,\n },\n {\n gte: CHART_CONFIG.SENTIMENT_MAX / 2,\n lte: CHART_CONFIG.SENTIMENT_MAX,\n color: sentimentLongColor,\n },\n {\n gt: CHART_CONFIG.SENTIMENT_MAX,\n color: sentimentLongColor,\n },\n ],\n },\n dataset: {\n source: {\n dates,\n candlesOpen,\n candlesClose,\n candlesLow,\n candlesHigh,\n bookPrices,\n bookIndexes,\n sentimentShorts,\n sentimentLongs,\n },\n },\n series: [\n {\n type: 'candlestick',\n id: 'candlestick',\n gridIndex: 0,\n xAxisIndex: 0,\n yAxisIndex: 0,\n encode: {\n x: 'dates',\n y: ['open', 'close', 'low', 'high'],\n },\n itemStyle: {\n color: chroma(candleShortColor).desaturate().css(),\n color0: chroma(candleLongColor).desaturate().css(),\n borderColor: candleShortColor,\n borderColor0: candleLongColor,\n },\n emphasis: {\n itemStyle: {\n color: candleShortColor,\n color0: candleLongColor,\n },\n },\n markPoint: {\n symbol: 'circle',\n symbolSize: 0,\n data: labelsData,\n },\n },\n {\n type: 'custom',\n gridIndex: 0,\n name: 'heatmap',\n id: 'heatmap',\n xAxisIndex: 0,\n yAxisIndex: 0,\n silent: true,\n clip: true,\n encode: {\n x: 'dates',\n y: 'bookPrices',\n },\n dimensions: ['dates', 'bookPrices', 'bookIndexes'],\n renderItem: (_params, api) => {\n const xVal = api.value(0);\n const bucketIndex = api.value(2) as number;\n\n if (!bucketIndex) {\n return null;\n }\n\n const metaValues = buckets[bucketIndex];\n\n const [rectWidth, rectHeight] = api.size!([\n 0,\n bucketWidth,\n ]) as number[];\n\n const items = metaValues.map(({ price, sentiment }: Bucket) => {\n const start = api.coord([xVal, price]);\n\n return {\n type: 'rect',\n shape: {\n x: start[0] - rectWidth / 2,\n y: start[1] - rectHeight,\n width: rectWidth + 1,\n height: rectHeight,\n },\n style: {\n fill: getRectColor(\n sentiment,\n isDark,\n sentimentThresholdMin,\n sentimentThresholdMax\n ),\n },\n silent: true,\n emphasisDisabled: true,\n };\n });\n\n return {\n type: 'group',\n children: items,\n silent: true,\n emphasisDisabled: true,\n };\n },\n },\n {\n type: 'line',\n name: 'sentiment-short',\n id: 'sentiment',\n xAxisIndex: 1,\n yAxisIndex: 1,\n showSymbol: false,\n symbol: 'none',\n lineStyle: {\n width: 3,\n opacity: 1,\n },\n areaStyle: {\n color: sentimentShortColor,\n opacity: sentimentAreaOpacity,\n },\n emphasis: {\n disabled: true,\n },\n stack: 'sentiment',\n dimensions: ['dates', 'sentimentShorts', 'sentimentLongs'],\n encode: {\n x: 'dates',\n y: 'sentimentShorts',\n },\n },\n {\n type: 'line',\n name: 'sentiment-long',\n id: 'sentiment-long',\n xAxisIndex: 1,\n yAxisIndex: 1,\n symbol: 'none',\n lineStyle: {\n color: 'transparent',\n width: 0,\n },\n areaStyle: {\n color: sentimentLongColor,\n opacity: sentimentAreaOpacity,\n },\n stack: 'sentiment',\n emphasis: {\n disabled: true,\n },\n tooltip: {\n show: false,\n },\n dimensions: ['dates', 'sentimentLongs'],\n encode: {\n x: 'dates',\n y: 'sentimentLongs',\n },\n },\n ],\n grid: [\n {\n name: 'main-grid',\n id: 'main-grid',\n height: `${CHART_CONFIG.MAIN_HEIGHT}px`,\n top: '0px',\n left: '0px',\n right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,\n bottom: `${CHART_CONFIG.X_LABEL_SIZE}px`,\n },\n {\n name: 'sentiment-grid',\n id: 'sentiment-grid',\n height: `${CHART_CONFIG.SENTIMENT_HEIGHT}px`,\n bottom: `0px`,\n left: '0px',\n right: `${isDesktop ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : CHART_CONFIG.Y_LABEL_SIZE_MOBILE}px`,\n },\n ],\n graphic: [\n ...gridMainLines,\n {\n type: 'text',\n silent: true,\n z: 1,\n left: 4,\n bottom: CHART_CONFIG_CALCULATED.SENTIMENT_TEXT_POSITION,\n style: {\n text: `${labelCallback('sentiment')}:`,\n fontFamily: 'Sofia W03',\n fontSize: 14,\n fontWeight: 'bold',\n fill: sentimentLabelColor,\n },\n },\n ],\n };\n};\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,WAAW;AAE9B,SACEC,aAAa,EACbC,YAAY,EACZC,uBAAuB,QAClB,iBAAiB;AAExB,SACEC,gBAAgB,EAChBC,YAAY,EACZC,YAAY,EACZC,mBAAmB,EACnBC,+BAA+B,QAC1B,oBAAoB;AAC3B,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ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IAAI,KAAAzG,MAAA,CAAKzC,aAAa,CAAC,WAAW,CAAC,MAAG;QACtCmJ,UAAU,EAAE,WAAW;QACvBpG,QAAQ,EAAE,EAAE;QACZqG,UAAU,EAAE,MAAM;QAClBvB,IAAI,EAAErH;MACR;IACF,CAAC;EAEL,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CrowdViewWidget/components/Chart/types.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts';\n\nimport type {\n BookType,\n Division,\n Granularity,\n} from '../../../gql/types/graphql';\nimport type { InstrumentId } from '../../types';\n\nexport interface Bucket {\n price: number;\n sentiment: number;\n}\n\nexport interface UseCrowdViewDataProps {\n instrument: InstrumentId;\n bookType: BookType;\n division: Division;\n granularity: Granularity;\n}\n\ninterface
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CrowdViewWidget/components/Chart/types.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts';\n\nimport type {\n BookType,\n Division,\n Granularity,\n} from '../../../gql/types/graphql';\nimport type { InstrumentId } from '../../types';\n\nexport interface Bucket {\n price: number;\n sentiment: number;\n}\n\nexport interface UseCrowdViewDataProps {\n instrument: InstrumentId;\n bookType: BookType;\n division: Division;\n granularity: Granularity;\n}\n\ninterface CrowdViewMainData {\n dates: string[];\n candlesOpen: number[];\n candlesClose: number[];\n candlesLow: number[];\n candlesHigh: number[];\n bookPrices?: (number | null)[];\n bookIndexes?: (number | null)[];\n sentimentShorts: (number | null)[];\n sentimentLongs: (number | null)[];\n}\n\ninterface CrowdViewAdditionalData {\n bucketWidth: number;\n buckets: Bucket[][];\n displayPrecision: number;\n bookType: BookType;\n sentimentThresholdMin: number;\n sentimentThresholdMax: number;\n}\n\nexport interface UseCrowdViewDataReturn {\n mainData?: CrowdViewMainData | null;\n additionalData?: CrowdViewAdditionalData | null;\n loading: boolean;\n error: boolean;\n}\n\ninterface GetOptionProps {\n mainData: CrowdViewMainData;\n additionalData: CrowdViewAdditionalData;\n isDark: boolean;\n isDesktop: boolean;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n}\n\nexport type GetOptionType = (props: GetOptionProps) => EChartsOption;\n\nexport interface ChartProps {\n mainData: CrowdViewMainData;\n additionalData: CrowdViewAdditionalData;\n isDesktop: boolean;\n}\n\nexport interface ChartWithDataProps {\n bookType: BookType;\n division: Division;\n instrument: InstrumentId;\n granularity: Granularity;\n}\n\nexport interface GetLabelsDataProps {\n dates: string[];\n isGreaterThanTwoWeeks: boolean;\n}\n\ninterface BaseTooltipParam {\n [key: string]: unknown;\n seriesId?: string;\n seriesName?: string;\n seriesType?: string;\n axisValue?: string | number;\n axisValueLabel?: string;\n axisDimension?: string;\n axisIndex?: number;\n value: unknown;\n}\n\nexport type TooltipParam =\n | (BaseTooltipParam & {\n seriesId: 'candlestick';\n value: [number, number, number, number, number]; // [0, open, close, low, high]\n })\n | (BaseTooltipParam & {\n seriesId: 'heatmap';\n value: [string, number, number]; // [time, price, index]\n })\n | (BaseTooltipParam & {\n seriesId: 'sentiment';\n value: [string, number, number]; // [time, shortPercent, longPercent]\n });\n\nexport interface DataZoomBatchItem {\n [key: string]: unknown;\n start: number;\n end: number;\n dataZoomId?: string;\n}\n\nexport interface DataZoomEvent {\n [key: string]: unknown;\n type: 'datazoom';\n batch?: DataZoomBatchItem[];\n}\n\nexport interface DataZoomItem {\n startValue: number;\n endValue: number;\n}\n\nexport type DataZoomArray = Array<DataZoomItem>;\n\nexport interface XAxisItem {\n name?: string;\n}\n\nexport type XAxisArray = Array<XAxisItem>;\n"],"mappings":"","ignoreList":[]}
|