@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
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ChartWithData = void 0;
|
|
7
7
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Legend = require("../Legend");
|
|
9
10
|
var _Chart = require("./Chart");
|
|
10
11
|
var _useCrowdViewData = require("./useCrowdViewData");
|
|
11
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -17,11 +18,13 @@ const ChartWithData = _ref => {
|
|
|
17
18
|
granularity
|
|
18
19
|
} = _ref;
|
|
19
20
|
const {
|
|
20
|
-
size
|
|
21
|
+
size,
|
|
22
|
+
isDark
|
|
21
23
|
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
22
24
|
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
23
25
|
const {
|
|
24
|
-
|
|
26
|
+
mainData,
|
|
27
|
+
additionalData,
|
|
25
28
|
loading,
|
|
26
29
|
error
|
|
27
30
|
} = (0, _useCrowdViewData.useCrowdViewData)({
|
|
@@ -31,19 +34,25 @@ const ChartWithData = _ref => {
|
|
|
31
34
|
granularity
|
|
32
35
|
});
|
|
33
36
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("div", {
|
|
34
|
-
className: "lw-relative lw-h-[
|
|
37
|
+
className: "lw-relative lw-h-[610px] lw-w-full"
|
|
35
38
|
}, error && _react.default.createElement("div", {
|
|
36
|
-
className: "lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-
|
|
39
|
+
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"
|
|
37
40
|
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)), loading && _react.default.createElement("div", {
|
|
38
|
-
className: "lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-
|
|
41
|
+
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"
|
|
39
42
|
}, _react.default.createElement(_labsWidgetCommon.Spinner, {
|
|
40
43
|
size: _labsWidgetCommon.SpinnerSize.lg
|
|
41
|
-
})), !loading && !error && !!
|
|
44
|
+
})), !loading && !error && !!mainData && !!additionalData && _react.default.createElement("div", {
|
|
42
45
|
className: "lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full"
|
|
43
46
|
}, _react.default.createElement(_Chart.Chart, {
|
|
44
|
-
|
|
45
|
-
isDesktop: isDesktop
|
|
46
|
-
|
|
47
|
+
additionalData: additionalData,
|
|
48
|
+
isDesktop: isDesktop,
|
|
49
|
+
mainData: mainData
|
|
50
|
+
}))), _react.default.createElement(_Legend.Legend, {
|
|
51
|
+
bookType: bookType,
|
|
52
|
+
isDark: isDark,
|
|
53
|
+
longValues: [additionalData === null || additionalData === void 0 ? void 0 : additionalData.sentimentThresholdMin, additionalData === null || additionalData === void 0 ? void 0 : additionalData.sentimentThresholdMax],
|
|
54
|
+
shortValues: [additionalData === null || additionalData === void 0 ? void 0 : additionalData.sentimentThresholdMin, additionalData === null || additionalData === void 0 ? void 0 : additionalData.sentimentThresholdMax]
|
|
55
|
+
}));
|
|
47
56
|
};
|
|
48
57
|
exports.ChartWithData = ChartWithData;
|
|
49
58
|
//# sourceMappingURL=ChartWithData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartWithData.js","names":["_labsWidgetCommon","require","_react","_interopRequireDefault","_Chart","_useCrowdViewData","e","__esModule","default","ChartWithData","_ref","instrument","bookType","division","granularity","size","useLayoutProvider","isDesktop","Size","DESKTOP","
|
|
1
|
+
{"version":3,"file":"ChartWithData.js","names":["_labsWidgetCommon","require","_react","_interopRequireDefault","_Legend","_Chart","_useCrowdViewData","e","__esModule","default","ChartWithData","_ref","instrument","bookType","division","granularity","size","isDark","useLayoutProvider","isDesktop","Size","DESKTOP","mainData","additionalData","loading","error","useCrowdViewData","createElement","Fragment","className","ChartError","Spinner","SpinnerSize","lg","Chart","Legend","longValues","sentimentThresholdMin","sentimentThresholdMax","shortValues","exports"],"sources":["../../../../../src/CrowdViewWidget/components/Chart/ChartWithData.tsx"],"sourcesContent":["import {\n ChartError,\n Size,\n Spinner,\n SpinnerSize,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { Legend } from '../Legend';\nimport { Chart } from './Chart';\nimport type { ChartWithDataProps } from './types';\nimport { useCrowdViewData } from './useCrowdViewData';\n\nconst ChartWithData = ({\n instrument,\n bookType,\n division,\n granularity,\n}: ChartWithDataProps) => {\n const { size, isDark } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n const { mainData, additionalData, loading, error } = useCrowdViewData({\n instrument,\n bookType,\n division,\n granularity,\n });\n\n return (\n <>\n <div className=\"lw-relative lw-h-[610px] lw-w-full\">\n {error && (\n <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\">\n <ChartError />\n </div>\n )}\n {loading && (\n <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\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && !error && !!mainData && !!additionalData && (\n <div className=\"lw-absolute lw-left-0 lw-top-0 lw-flex lw-h-full lw-w-full\">\n <Chart\n additionalData={additionalData}\n isDesktop={isDesktop}\n mainData={mainData}\n />\n </div>\n )}\n </div>\n <Legend\n bookType={bookType}\n isDark={isDark}\n longValues={[\n additionalData?.sentimentThresholdMin,\n additionalData?.sentimentThresholdMax,\n ]}\n shortValues={[\n additionalData?.sentimentThresholdMin,\n additionalData?.sentimentThresholdMax,\n ]}\n />\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAL,OAAA;AAAsD,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD,MAAMG,aAAa,GAAGC,IAAA,IAKI;EAAA,IALH;IACrBC,UAAU;IACVC,QAAQ;IACRC,QAAQ;IACRC;EACkB,CAAC,GAAAJ,IAAA;EACnB,MAAM;IAAEK,IAAI;IAAEC;EAAO,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EAC5C,MAAMC,SAAS,GAAGH,IAAI,KAAKI,sBAAI,CAACC,OAAO;EAEvC,MAAM;IAAEC,QAAQ;IAAEC,cAAc;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAG,IAAAC,kCAAgB,EAAC;IACpEd,UAAU;IACVC,QAAQ;IACRC,QAAQ;IACRC;EACF,CAAC,CAAC;EAEF,OACEb,MAAA,CAAAO,OA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ACrC,CACH,CACD,CAAC;AAEP,CAAC;AAACE,OAAA,CAAA9B,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -4,69 +4,92 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getOption = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _chromaJs = _interopRequireDefault(require("chroma-js"));
|
|
8
8
|
var _constants = require("../../constants");
|
|
9
9
|
var _chartUtils = require("./utils/chartUtils");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
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); }
|
|
15
|
-
const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
10
|
+
var _getChartStyles = require("./utils/getChartStyles");
|
|
11
|
+
var _getGridLines = require("./utils/getGridLines");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const getOption = _ref => {
|
|
16
14
|
let {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
mainData: {
|
|
16
|
+
dates,
|
|
17
|
+
candlesOpen,
|
|
18
|
+
candlesClose,
|
|
19
|
+
candlesLow,
|
|
20
|
+
candlesHigh,
|
|
21
|
+
bookPrices,
|
|
22
|
+
bookIndexes,
|
|
23
|
+
sentimentShorts,
|
|
24
|
+
sentimentLongs
|
|
25
|
+
},
|
|
26
|
+
additionalData: {
|
|
27
|
+
bucketWidth,
|
|
28
|
+
buckets,
|
|
29
|
+
displayPrecision,
|
|
30
|
+
bookType,
|
|
31
|
+
sentimentThresholdMin,
|
|
32
|
+
sentimentThresholdMax
|
|
33
|
+
},
|
|
34
|
+
isDark,
|
|
35
|
+
isDesktop,
|
|
36
|
+
labelCallback
|
|
24
37
|
} = _ref;
|
|
25
38
|
let selectedPrice;
|
|
26
|
-
const
|
|
39
|
+
const {
|
|
40
|
+
sentimentLongColor,
|
|
41
|
+
sentimentShortColor,
|
|
42
|
+
candleLongColor,
|
|
43
|
+
candleShortColor,
|
|
44
|
+
sentimentAreaOpacity,
|
|
45
|
+
tooltipLinesColor,
|
|
46
|
+
sentimentLabelColor
|
|
47
|
+
} = (0, _getChartStyles.getChartStyles)(isDark);
|
|
48
|
+
const visibleXAxisData = dates.slice(dates.length * _constants.CHART_CONFIG.INITIAL_START_ZOOM / 100, dates.length * _constants.CHART_CONFIG.INITIAL_END_ZOOM / 100);
|
|
27
49
|
const isGreaterThanTwoWeeks = (0, _chartUtils.isDifferenceGreaterThanTwoWeeks)(visibleXAxisData[0], visibleXAxisData[visibleXAxisData.length - 1]);
|
|
28
50
|
const labelsData = (0, _chartUtils.getLabelData)({
|
|
29
|
-
|
|
51
|
+
dates,
|
|
30
52
|
isGreaterThanTwoWeeks
|
|
31
53
|
});
|
|
32
|
-
const
|
|
54
|
+
const gridMainLines = (0, _getGridLines.getGridLines)({
|
|
33
55
|
isDark,
|
|
34
|
-
|
|
35
|
-
chartHeight: _constants.CHART_CONFIG.HEIGHT,
|
|
36
|
-
xLabelsSize: _constants.CHART_CONFIG.X_LABEL_SIZE,
|
|
37
|
-
yLabelSize: isDesktop ? _constants.CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : _constants.CHART_CONFIG.Y_LABEL_SIZE_MOBILE,
|
|
38
|
-
bottomLeftBox: false
|
|
56
|
+
isDesktop
|
|
39
57
|
});
|
|
40
58
|
return {
|
|
41
59
|
animation: false,
|
|
42
60
|
dataZoom: [{
|
|
61
|
+
id: 'main',
|
|
43
62
|
type: 'inside',
|
|
44
63
|
xAxisIndex: 0,
|
|
45
64
|
start: _constants.CHART_CONFIG.INITIAL_START_ZOOM,
|
|
46
|
-
end: _constants.CHART_CONFIG.INITIAL_END_ZOOM
|
|
65
|
+
end: _constants.CHART_CONFIG.INITIAL_END_ZOOM,
|
|
66
|
+
filterMode: 'filter'
|
|
67
|
+
}, {
|
|
68
|
+
id: 'sentiment',
|
|
69
|
+
type: 'inside',
|
|
70
|
+
xAxisIndex: 1,
|
|
71
|
+
start: _constants.CHART_CONFIG.INITIAL_START_ZOOM,
|
|
72
|
+
end: _constants.CHART_CONFIG.INITIAL_END_ZOOM,
|
|
73
|
+
filterMode: 'none'
|
|
47
74
|
}],
|
|
48
75
|
tooltip: {
|
|
49
76
|
trigger: 'axis',
|
|
50
77
|
axisPointer: {
|
|
51
78
|
type: 'cross',
|
|
52
79
|
axis: 'x',
|
|
80
|
+
lineStyle: {
|
|
81
|
+
color: tooltipLinesColor
|
|
82
|
+
},
|
|
53
83
|
crossStyle: {
|
|
54
|
-
color:
|
|
84
|
+
color: tooltipLinesColor
|
|
55
85
|
},
|
|
56
86
|
label: {
|
|
87
|
+
padding: 0,
|
|
88
|
+
lineHeight: 24,
|
|
57
89
|
formatter: params => {
|
|
58
|
-
if (params.axisDimension === 'y') {
|
|
90
|
+
if (params.axisDimension === 'y' && params.axisIndex === 0) {
|
|
59
91
|
selectedPrice = Number(params.value);
|
|
60
|
-
return Number(params.value).toFixed(
|
|
61
|
-
}
|
|
62
|
-
if (params.axisDimension === 'x') {
|
|
63
|
-
const date = new Date(params.value);
|
|
64
|
-
return date.toLocaleString(undefined, {
|
|
65
|
-
hour: '2-digit',
|
|
66
|
-
minute: '2-digit',
|
|
67
|
-
day: 'numeric',
|
|
68
|
-
month: 'short'
|
|
69
|
-
});
|
|
92
|
+
return " ".concat(Number(params.value).toFixed(displayPrecision), " ");
|
|
70
93
|
}
|
|
71
94
|
return null;
|
|
72
95
|
}
|
|
@@ -79,13 +102,16 @@ const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
79
102
|
bucketWidth,
|
|
80
103
|
selectedPrice,
|
|
81
104
|
labelCallback,
|
|
82
|
-
precision,
|
|
83
105
|
bookType
|
|
84
106
|
})
|
|
85
107
|
},
|
|
86
|
-
xAxis: {
|
|
108
|
+
xAxis: [{
|
|
87
109
|
type: 'category',
|
|
88
|
-
|
|
110
|
+
name: 'xAxis-less-than-two-weeks',
|
|
111
|
+
nameTextStyle: {
|
|
112
|
+
fontSize: 0
|
|
113
|
+
},
|
|
114
|
+
id: 'main-xAxis',
|
|
89
115
|
splitNumber: 1,
|
|
90
116
|
axisTick: {
|
|
91
117
|
show: false
|
|
@@ -95,12 +121,25 @@ const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
95
121
|
margin: 0,
|
|
96
122
|
formatter: value => (0, _chartUtils.formatXAxisLabel)(value, isGreaterThanTwoWeeks)
|
|
97
123
|
}
|
|
98
|
-
},
|
|
99
|
-
|
|
124
|
+
}, {
|
|
125
|
+
type: 'category',
|
|
126
|
+
gridIndex: 1,
|
|
127
|
+
show: false,
|
|
128
|
+
data: dates,
|
|
129
|
+
splitNumber: 1,
|
|
130
|
+
axisTick: {
|
|
131
|
+
show: false
|
|
132
|
+
},
|
|
133
|
+
axisLabel: {
|
|
134
|
+
show: false
|
|
135
|
+
}
|
|
136
|
+
}],
|
|
137
|
+
yAxis: [{
|
|
100
138
|
type: 'value',
|
|
139
|
+
gridIndex: 0,
|
|
101
140
|
position: 'right',
|
|
102
|
-
min: val => val.min - bucketWidth *
|
|
103
|
-
max: val => val.max + bucketWidth *
|
|
141
|
+
min: val => val.min - bucketWidth * _constants.BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
|
|
142
|
+
max: val => val.max + bucketWidth * _constants.BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,
|
|
104
143
|
axisLine: {
|
|
105
144
|
show: false
|
|
106
145
|
},
|
|
@@ -110,19 +149,111 @@ const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
110
149
|
axisLabel: {
|
|
111
150
|
showMaxLabel: false,
|
|
112
151
|
showMinLabel: false,
|
|
152
|
+
formatter: value => value.toFixed(displayPrecision - 1)
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
type: 'value',
|
|
156
|
+
gridIndex: 1,
|
|
157
|
+
position: 'right',
|
|
158
|
+
min: _constants.CHART_CONFIG.SENTIMENT_MIN,
|
|
159
|
+
max: _constants.CHART_CONFIG.SENTIMENT_MAX,
|
|
160
|
+
interval: _constants.CHART_CONFIG.SENTIMENT_INTERVAL,
|
|
161
|
+
axisLine: {
|
|
162
|
+
show: false
|
|
163
|
+
},
|
|
164
|
+
axisTick: {
|
|
165
|
+
show: false
|
|
166
|
+
},
|
|
167
|
+
axisLabel: {
|
|
168
|
+
verticalAlignMaxLabel: 'top',
|
|
169
|
+
verticalAlignMinLabel: 'bottom',
|
|
170
|
+
lineHeight: 20,
|
|
113
171
|
margin: isDesktop ? 4 : 2,
|
|
114
|
-
|
|
172
|
+
rich: {
|
|
173
|
+
shortRect: {
|
|
174
|
+
backgroundColor: (0, _chromaJs.default)(sentimentShortColor).alpha(0.3).css(),
|
|
175
|
+
borderColor: sentimentShortColor,
|
|
176
|
+
borderWidth: 1,
|
|
177
|
+
width: 8,
|
|
178
|
+
height: 8
|
|
179
|
+
},
|
|
180
|
+
longRect: {
|
|
181
|
+
backgroundColor: (0, _chromaJs.default)(sentimentLongColor).alpha(0.3).css(),
|
|
182
|
+
borderColor: sentimentLongColor,
|
|
183
|
+
borderWidth: 1,
|
|
184
|
+
width: 8,
|
|
185
|
+
height: 8
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
formatter: value => {
|
|
189
|
+
if (value === _constants.CHART_CONFIG.SENTIMENT_MIN) {
|
|
190
|
+
return "{shortRect| } ".concat(labelCallback('short'));
|
|
191
|
+
}
|
|
192
|
+
if (value === _constants.CHART_CONFIG.SENTIMENT_MAX) {
|
|
193
|
+
return "{longRect| } ".concat(labelCallback('long'));
|
|
194
|
+
}
|
|
195
|
+
if (value === _constants.CHART_CONFIG.SENTIMENT_MAX / 2) {
|
|
196
|
+
return '50%';
|
|
197
|
+
}
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}],
|
|
202
|
+
axisPointer: {
|
|
203
|
+
link: [{
|
|
204
|
+
xAxisIndex: 'all'
|
|
205
|
+
}]
|
|
206
|
+
},
|
|
207
|
+
visualMap: {
|
|
208
|
+
show: false,
|
|
209
|
+
seriesId: 'sentiment',
|
|
210
|
+
dimension: 1,
|
|
211
|
+
pieces: [{
|
|
212
|
+
lt: _constants.CHART_CONFIG.SENTIMENT_MAX / 2,
|
|
213
|
+
color: sentimentShortColor
|
|
214
|
+
}, {
|
|
215
|
+
gte: _constants.CHART_CONFIG.SENTIMENT_MAX / 2,
|
|
216
|
+
lte: _constants.CHART_CONFIG.SENTIMENT_MAX,
|
|
217
|
+
color: sentimentLongColor
|
|
218
|
+
}, {
|
|
219
|
+
gt: _constants.CHART_CONFIG.SENTIMENT_MAX,
|
|
220
|
+
color: sentimentLongColor
|
|
221
|
+
}]
|
|
222
|
+
},
|
|
223
|
+
dataset: {
|
|
224
|
+
source: {
|
|
225
|
+
dates,
|
|
226
|
+
candlesOpen,
|
|
227
|
+
candlesClose,
|
|
228
|
+
candlesLow,
|
|
229
|
+
candlesHigh,
|
|
230
|
+
bookPrices,
|
|
231
|
+
bookIndexes,
|
|
232
|
+
sentimentShorts,
|
|
233
|
+
sentimentLongs
|
|
115
234
|
}
|
|
116
235
|
},
|
|
117
236
|
series: [{
|
|
118
237
|
type: 'candlestick',
|
|
119
238
|
id: 'candlestick',
|
|
120
|
-
|
|
239
|
+
gridIndex: 0,
|
|
240
|
+
xAxisIndex: 0,
|
|
241
|
+
yAxisIndex: 0,
|
|
242
|
+
encode: {
|
|
243
|
+
x: 'dates',
|
|
244
|
+
y: ['open', 'close', 'low', 'high']
|
|
245
|
+
},
|
|
121
246
|
itemStyle: {
|
|
122
|
-
color:
|
|
123
|
-
color0:
|
|
124
|
-
borderColor:
|
|
125
|
-
borderColor0:
|
|
247
|
+
color: (0, _chromaJs.default)(candleShortColor).desaturate().css(),
|
|
248
|
+
color0: (0, _chromaJs.default)(candleLongColor).desaturate().css(),
|
|
249
|
+
borderColor: candleShortColor,
|
|
250
|
+
borderColor0: candleLongColor
|
|
251
|
+
},
|
|
252
|
+
emphasis: {
|
|
253
|
+
itemStyle: {
|
|
254
|
+
color: candleShortColor,
|
|
255
|
+
color0: candleLongColor
|
|
256
|
+
}
|
|
126
257
|
},
|
|
127
258
|
markPoint: {
|
|
128
259
|
symbol: 'circle',
|
|
@@ -131,13 +262,24 @@ const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
131
262
|
}
|
|
132
263
|
}, {
|
|
133
264
|
type: 'custom',
|
|
265
|
+
gridIndex: 0,
|
|
134
266
|
name: 'heatmap',
|
|
135
267
|
id: 'heatmap',
|
|
268
|
+
xAxisIndex: 0,
|
|
269
|
+
yAxisIndex: 0,
|
|
136
270
|
silent: true,
|
|
137
271
|
clip: true,
|
|
272
|
+
encode: {
|
|
273
|
+
x: 'dates',
|
|
274
|
+
y: 'bookPrices'
|
|
275
|
+
},
|
|
276
|
+
dimensions: ['dates', 'bookPrices', 'bookIndexes'],
|
|
138
277
|
renderItem: (_params, api) => {
|
|
139
278
|
const xVal = api.value(0);
|
|
140
279
|
const bucketIndex = api.value(2);
|
|
280
|
+
if (!bucketIndex) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
141
283
|
const metaValues = buckets[bucketIndex];
|
|
142
284
|
const [rectWidth, rectHeight] = api.size([0, bucketWidth]);
|
|
143
285
|
const items = metaValues.map(_ref2 => {
|
|
@@ -155,7 +297,7 @@ const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
155
297
|
height: rectHeight
|
|
156
298
|
},
|
|
157
299
|
style: {
|
|
158
|
-
fill: (0, _chartUtils.getRectColor)(sentiment, isDark)
|
|
300
|
+
fill: (0, _chartUtils.getRectColor)(sentiment, isDark, sentimentThresholdMin, sentimentThresholdMax)
|
|
159
301
|
},
|
|
160
302
|
silent: true,
|
|
161
303
|
emphasisDisabled: true
|
|
@@ -167,26 +309,90 @@ const getOption = (_ref, isDark, isDesktop, labelCallback) => {
|
|
|
167
309
|
silent: true,
|
|
168
310
|
emphasisDisabled: true
|
|
169
311
|
};
|
|
312
|
+
}
|
|
313
|
+
}, {
|
|
314
|
+
type: 'line',
|
|
315
|
+
name: 'sentiment-short',
|
|
316
|
+
id: 'sentiment',
|
|
317
|
+
xAxisIndex: 1,
|
|
318
|
+
yAxisIndex: 1,
|
|
319
|
+
showSymbol: false,
|
|
320
|
+
symbol: 'none',
|
|
321
|
+
lineStyle: {
|
|
322
|
+
width: 3,
|
|
323
|
+
opacity: 1
|
|
324
|
+
},
|
|
325
|
+
areaStyle: {
|
|
326
|
+
color: sentimentShortColor,
|
|
327
|
+
opacity: sentimentAreaOpacity
|
|
328
|
+
},
|
|
329
|
+
emphasis: {
|
|
330
|
+
disabled: true
|
|
331
|
+
},
|
|
332
|
+
stack: 'sentiment',
|
|
333
|
+
dimensions: ['dates', 'sentimentShorts', 'sentimentLongs'],
|
|
334
|
+
encode: {
|
|
335
|
+
x: 'dates',
|
|
336
|
+
y: 'sentimentShorts'
|
|
337
|
+
}
|
|
338
|
+
}, {
|
|
339
|
+
type: 'line',
|
|
340
|
+
name: 'sentiment-long',
|
|
341
|
+
id: 'sentiment-long',
|
|
342
|
+
xAxisIndex: 1,
|
|
343
|
+
yAxisIndex: 1,
|
|
344
|
+
symbol: 'none',
|
|
345
|
+
lineStyle: {
|
|
346
|
+
color: 'transparent',
|
|
347
|
+
width: 0
|
|
348
|
+
},
|
|
349
|
+
areaStyle: {
|
|
350
|
+
color: sentimentLongColor,
|
|
351
|
+
opacity: sentimentAreaOpacity
|
|
170
352
|
},
|
|
171
|
-
|
|
353
|
+
stack: 'sentiment',
|
|
354
|
+
emphasis: {
|
|
355
|
+
disabled: true
|
|
356
|
+
},
|
|
357
|
+
tooltip: {
|
|
358
|
+
show: false
|
|
359
|
+
},
|
|
360
|
+
dimensions: ['dates', 'sentimentLongs'],
|
|
361
|
+
encode: {
|
|
362
|
+
x: 'dates',
|
|
363
|
+
y: 'sentimentLongs'
|
|
364
|
+
}
|
|
172
365
|
}],
|
|
173
366
|
grid: [{
|
|
174
367
|
name: 'main-grid',
|
|
368
|
+
id: 'main-grid',
|
|
369
|
+
height: "".concat(_constants.CHART_CONFIG.MAIN_HEIGHT, "px"),
|
|
175
370
|
top: '0px',
|
|
176
371
|
left: '0px',
|
|
177
372
|
right: "".concat(isDesktop ? _constants.CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : _constants.CHART_CONFIG.Y_LABEL_SIZE_MOBILE, "px"),
|
|
178
373
|
bottom: "".concat(_constants.CHART_CONFIG.X_LABEL_SIZE, "px")
|
|
374
|
+
}, {
|
|
375
|
+
name: 'sentiment-grid',
|
|
376
|
+
id: 'sentiment-grid',
|
|
377
|
+
height: "".concat(_constants.CHART_CONFIG.SENTIMENT_HEIGHT, "px"),
|
|
378
|
+
bottom: "0px",
|
|
379
|
+
left: '0px',
|
|
380
|
+
right: "".concat(isDesktop ? _constants.CHART_CONFIG.Y_LABEL_SIZE_DESKTOP : _constants.CHART_CONFIG.Y_LABEL_SIZE_MOBILE, "px")
|
|
179
381
|
}],
|
|
180
|
-
graphic: [...
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
382
|
+
graphic: [...gridMainLines, {
|
|
383
|
+
type: 'text',
|
|
384
|
+
silent: true,
|
|
385
|
+
z: 1,
|
|
386
|
+
left: 4,
|
|
387
|
+
bottom: _constants.CHART_CONFIG_CALCULATED.SENTIMENT_TEXT_POSITION,
|
|
388
|
+
style: {
|
|
389
|
+
text: "".concat(labelCallback('sentiment'), ":"),
|
|
390
|
+
fontFamily: 'Sofia W03',
|
|
391
|
+
fontSize: 14,
|
|
392
|
+
fontWeight: 'bold',
|
|
393
|
+
fill: sentimentLabelColor
|
|
188
394
|
}
|
|
189
|
-
}
|
|
395
|
+
}]
|
|
190
396
|
};
|
|
191
397
|
};
|
|
192
398
|
exports.getOption = getOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chartOptions.js","names":["_labsWidgetCommon","require","_constants","_chartUtils","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","getOption","_ref","isDark","isDesktop","labelCallback","xAxisData","candlesSeriesData","orderPositionBooks","bucketWidth","buckets","precision","bookType","selectedPrice","visibleXAxisData","slice","CHART_CONFIG","INITIAL_START_ZOOM","INITIAL_END_ZOOM","isGreaterThanTwoWeeks","isDifferenceGreaterThanTwoWeeks","labelsData","getLabelData","gridLines","getGridLines","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","colorPalette","orange","themeColors","borderPrimary","light","label","formatter","params","axisDimension","toFixed","date","Date","toLocaleString","undefined","hour","minute","day","month","confine","getTooltipFormatter","xAxis","data","splitNumber","axisTick","show","axisLabel","padding","margin","formatXAxisLabel","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","getRectColor","emphasisDisabled","children","grid","top","left","right","concat","bottom","graphic","getLineCommons","x1","y1","x2","y2","exports"],"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,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAM4B,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,M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C,IAAI,EAAE,KAAK;MACXC,KAAK,KAAAC,MAAA,CAAK5H,SAAS,GAAGY,uBAAY,CAACgB,oBAAoB,GAAGhB,uBAAY,CAACiB,mBAAmB,OAAI;MAC9FgG,MAAM,KAAAD,MAAA,CAAKhH,uBAAY,CAACc,YAAY;IACtC,CAAC,CACF;IACDoG,OAAO,EAAE,CACP,GAAG3G,SAAS,EAAA1C,aAAA,CAAAA,aAAA,KAEP,IAAAsJ,gCAAc,EAAChI,MAAiB,CAAC;MACpC0H,GAAG,EAAE,CAAC;MACNE,KAAK,EAAE,CAAC;MACRb,KAAK,EAAE;QACLkB,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE,CAAC;QACLC,EAAE,EAAE;MACN;IAAC;EAGP,CAAC;AACH,CAAC;AAACC,OAAA,CAAAvI,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"chartOptions.js","names":["_chromaJs","_interopRequireDefault","require","_constants","_chartUtils","_getChartStyles","_getGridLines","e","__esModule","default","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","getChartStyles","visibleXAxisData","slice","length","CHART_CONFIG","INITIAL_START_ZOOM","INITIAL_END_ZOOM","isGreaterThanTwoWeeks","isDifferenceGreaterThanTwoWeeks","labelsData","getLabelData","gridMainLines","getGridLines","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","getTooltipFormatter","xAxis","name","nameTextStyle","fontSize","splitNumber","axisTick","show","axisLabel","margin","formatXAxisLabel","gridIndex","data","yAxis","position","min","val","BUCKET_CONFIG","PRICE_MARGIN_MULTIPLIER","max","axisLine","showMaxLabel","showMinLabel","SENTIMENT_MIN","SENTIMENT_MAX","interval","SENTIMENT_INTERVAL","verticalAlignMaxLabel","verticalAlignMinLabel","rich","shortRect","backgroundColor","chroma","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","getRectColor","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","CHART_CONFIG_CALCULATED","SENTIMENT_TEXT_POSITION","text","fontFamily","fontWeight","exports"],"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,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAoD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG7C,MAAMG,SAAwB,GAAGC,IAAA,IAuBlC;EAAA,IAvBmC;IACvCC,QAAQ,EAAE;MACRC,KAAK;MACLC,WAAW;MACXC,YAAY;MACZC,UAAU;MACVC,WAAW;MACXC,UAAU;MACVC,WAAW;MACXC,eAAe;MACfC;IACF,CAAC;IACDC,cAAc,EAAE;MACdC,WAAW;MACXC,OAAO;MACPC,gBAAgB;MAChBC,QAAQ;MACRC,qBAAqB;MACrBC;IACF,CAAC;IACDC,MAAM;IACNC,SAAS;IACTC;EACF,CAAC,GAAApB,IAAA;EACC,IAAIqB,aAAqB;EACzB,MAAM;IACJC,kBAAkB;IAClBC,mBAAmB;IACnBC,eAAe;IACfC,gBAAgB;IAChBC,oBAAoB;IACpBC,iBAAiB;IACjBC;EACF,CAAC,GAAG,IAAAC,8BAAc,EAACX,MAAM,CAAC;EAE1B,MAAMY,gBAAgB,GAAG5B,KAAK,CAAC6B,KAAK,CACjC7B,KAAK,CAAC8B,MAAM,GAAGC,uBAAY,CAACC,kBAAkB,GAAI,GAAG,EACrDhC,KAAK,CAAC8B,MAAM,GAAGC,uBAAY,CAACE,gBAAgB,GAAI,GACnD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C9FC,MAAM,KAAAxG,MAAA,CAAKjC,uBAAY,CAAC0I,YAAY;IACtC,CAAC,EACD;MACEpG,IAAI,EAAE,gBAAgB;MACtB3B,EAAE,EAAE,gBAAgB;MACpB+D,MAAM,KAAAzC,MAAA,CAAKjC,uBAAY,CAAC2I,gBAAgB,OAAI;MAC5CF,MAAM,OAAO;MACbJ,IAAI,EAAE,KAAK;MACXC,KAAK,KAAArG,MAAA,CAAK/C,SAAS,GAAGc,uBAAY,CAACuI,oBAAoB,GAAGvI,uBAAY,CAACwI,mBAAmB;IAC5F,CAAC,CACF;IACDI,OAAO,EAAE,CACP,GAAGrI,aAAa,EAChB;MACEK,IAAI,EAAE,MAAM;MACZyF,MAAM,EAAE,IAAI;MACZwC,CAAC,EAAE,CAAC;MACJR,IAAI,EAAE,CAAC;MACPI,MAAM,EAAEK,kCAAuB,CAACC,uBAAuB;MACvDvB,KAAK,EAAE;QACLwB,IAAI,KAAA/G,MAAA,CAAK9C,aAAa,CAAC,WAAW,CAAC,MAAG;QACtC8J,UAAU,EAAE,WAAW;QACvBzG,QAAQ,EAAE,EAAE;QACZ0G,UAAU,EAAE,MAAM;QAClBzB,IAAI,EAAE9H;MACR;IACF,CAAC;EAEL,CAAC;AACH,CAAC;AAACwJ,OAAA,CAAArL,SAAA,GAAAA,SAAA","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":[]}
|