@oanda/labs-crowd-view-widget 1.0.54 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +224 -0
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js +37 -56
- package/dist/main/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js +20 -7
- package/dist/main/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +15 -9
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +6 -6
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +41 -13
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +159 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +7 -14
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +20 -2
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +13 -5
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +10 -3
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +20 -5
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +19 -28
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js +11 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +18 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +1 -20
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +21 -9
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +59 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +34 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js +33 -0
- package/dist/main/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js +19 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map +1 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js +11 -0
- package/dist/main/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js +33 -21
- package/dist/main/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js +7 -4
- package/dist/main/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js +11 -1
- package/dist/main/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/main/CrowdViewWidget/constants.js +13 -5
- package/dist/main/CrowdViewWidget/constants.js.map +1 -1
- package/dist/main/CrowdViewWidget/selectConfig.js +0 -6
- package/dist/main/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/main/translations/sources/en.json +2 -1
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js +38 -56
- package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +19 -6
- package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +15 -9
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +6 -6
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +41 -13
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +151 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +7 -14
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +20 -2
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +13 -5
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +10 -3
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +21 -6
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +19 -28
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +11 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +1 -20
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +21 -9
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +52 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +27 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +3 -0
- package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js +12 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.js.map +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js +1 -0
- package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js +34 -22
- package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/types.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +8 -5
- package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +11 -1
- package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
- package/dist/module/CrowdViewWidget/constants.js +13 -5
- package/dist/module/CrowdViewWidget/constants.js.map +1 -1
- package/dist/module/CrowdViewWidget/selectConfig.js +0 -6
- package/dist/module/CrowdViewWidget/selectConfig.js.map +1 -1
- package/dist/module/translations/sources/en.json +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.d.ts +5 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getGridLines.d.ts +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.d.ts +8 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.d.ts +2 -3
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.d.ts +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.d.ts +2 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.d.ts +3 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.d.ts +1 -3
- package/dist/types/CrowdViewWidget/components/Chart/chartOptions/index.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getLabelData.d.ts +1 -16
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.d.ts +3 -1
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.d.ts +4 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.d.ts +3 -0
- package/dist/types/CrowdViewWidget/components/Chart/chartUtils/index.d.ts +3 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.d.ts +2 -0
- package/dist/types/CrowdViewWidget/components/Chart/dataUtils/index.d.ts +1 -0
- package/dist/types/CrowdViewWidget/components/Chart/types.d.ts +5 -0
- package/dist/types/CrowdViewWidget/constants.d.ts +12 -4
- package/package.json +3 -3
- package/src/CrowdViewWidget/components/Chart/Chart.tsx +70 -79
- package/src/CrowdViewWidget/components/Chart/ChartWithData.tsx +31 -13
- package/src/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.ts +11 -2
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.ts +6 -6
- package/src/CrowdViewWidget/components/Chart/chartOptions/getGridLines.ts +48 -6
- package/src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts +191 -0
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts +7 -15
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts +22 -1
- package/src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts +13 -4
- package/src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts +12 -1
- package/src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts +55 -30
- package/src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts +13 -30
- package/src/CrowdViewWidget/components/Chart/chartOptions/index.ts +1 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts +11 -35
- package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +40 -11
- package/src/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.ts +75 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.ts +37 -0
- package/src/CrowdViewWidget/components/Chart/chartUtils/index.ts +3 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/getMultiplayerForTimeSpan.ts +13 -0
- package/src/CrowdViewWidget/components/Chart/dataUtils/index.ts +1 -0
- package/src/CrowdViewWidget/components/Chart/getOption.ts +41 -17
- package/src/CrowdViewWidget/components/Chart/types.ts +5 -0
- package/src/CrowdViewWidget/components/Chart/useCrowdViewData.ts +12 -5
- package/src/CrowdViewWidget/components/Legend/Legend.tsx +1 -1
- package/src/CrowdViewWidget/components/Legend/LegendBar.tsx +17 -1
- package/src/CrowdViewWidget/constants.ts +12 -4
- package/src/CrowdViewWidget/selectConfig.ts +0 -8
- package/src/translations/sources/en.json +2 -1
- package/test/components/Chart/utils/chartUtils.test.ts +13 -2
- package/test/components/Chart/utils/handleLabelUpdate.test.ts +419 -0
- package/test/components/Chart/utils/handleTooltipUpdate.test.ts +140 -0
- package/test/components/Legend.test.tsx +3 -3
- package/test/components/LegendBar.test.tsx +22 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLabelsConfig.js","names":["colorPalette","chroma","CHART_CONFIG","getLabelsConfig","_ref","isDark","isDesktop","labelCallback","ySentimentLabelSize","Y_SENTIMENT_LABEL_DESKTOP_SIZE","Y_SENTIMENT_LABEL_MOBILE_SIZE","yMainLabelSize","Y_LABEL_SIZE_DESKTOP","Y_LABEL_SIZE_MOBILE","textColor","white","black","labelBackgroundColor","darkGray","backgroundColor","shadowColor","alpha","hex","sentimentText","toUpperCase","priceText","sentimentEstimatedWidth","length","priceEstimatedWidth","sentimentVerticalOffset","priceVerticalOffset","topMargin","TOP_MARGIN_DESKTOP","TOP_MARGIN_MOBILE","type","left","concat","top","silent","children","z","right","shape","width","height","style","fill","shadowBlur","shadowOffsetX","shadowOffsetY","fontSize","fontFamily","fontWeight","text","MAIN_HEIGHT","rotation","Math","PI"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport chroma from 'chroma-js';\nimport type { GraphicComponentOption } from 'echarts';\n\nimport { CHART_CONFIG } from '../../../constants';\n\ninterface getLabelsConfigParams {\n isDark: boolean;\n isDesktop: boolean;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n}\n\nexport const getLabelsConfig = ({\n isDark,\n isDesktop,\n labelCallback,\n}: getLabelsConfigParams): GraphicComponentOption[] => {\n const ySentimentLabelSize = isDesktop\n ? CHART_CONFIG.Y_SENTIMENT_LABEL_DESKTOP_SIZE\n : CHART_CONFIG.Y_SENTIMENT_LABEL_MOBILE_SIZE;\n\n const yMainLabelSize = isDesktop\n ? CHART_CONFIG.Y_LABEL_SIZE_DESKTOP\n : CHART_CONFIG.Y_LABEL_SIZE_MOBILE;\n\n const textColor = isDark ? colorPalette.white : colorPalette.black;\n const labelBackgroundColor = isDark\n ? colorPalette.darkGray\n : colorPalette.white;\n const backgroundColor = isDark ? colorPalette.black : colorPalette.white;\n const shadowColor = chroma(colorPalette.black).alpha(0.1).hex();\n\n // Estimate text width for centering rotated text\n // Approximate: fontSize * characterCount * 0.65 (typical character width ratio)\n const sentimentText = labelCallback('sentiment').toUpperCase();\n const priceText = labelCallback('price').toUpperCase();\n const sentimentEstimatedWidth = 10 * sentimentText.length * 0.65;\n const priceEstimatedWidth = 10 * priceText.length * 0.65;\n const sentimentVerticalOffset = sentimentEstimatedWidth / 2;\n const priceVerticalOffset = priceEstimatedWidth / 2;\n\n const topMargin = isDesktop\n ? CHART_CONFIG.TOP_MARGIN_DESKTOP\n : CHART_CONFIG.TOP_MARGIN_MOBILE;\n\n return [\n {\n type: 'group',\n left: `${ySentimentLabelSize + 5}px'`,\n top: `${topMargin + 5}px`,\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 50,\n height: 24,\n },\n style: {\n fill: labelBackgroundColor,\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: shadowColor,\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n fontSize: 11,\n fontFamily: 'Sofia W03',\n fontWeight: 500,\n fill: textColor,\n width: 70,\n height: 30,\n text: labelCallback('short'),\n },\n },\n ],\n },\n {\n type: 'group',\n left: `${ySentimentLabelSize + 5}px'`,\n top: `${CHART_CONFIG.MAIN_HEIGHT - 24 - 5}px`,\n silent: true,\n children: [\n {\n type: 'rect',\n z: 100,\n right: 'center',\n top: 'middle',\n shape: {\n width: 50,\n height: 24,\n },\n style: {\n fill: labelBackgroundColor,\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n shadowColor: shadowColor,\n },\n },\n {\n type: 'text',\n z: 100,\n right: 'center',\n top: 'middle',\n style: {\n fontSize: 11,\n fontFamily: 'Sofia W03',\n fontWeight: 500,\n fill: textColor,\n width: 70,\n height: 30,\n text: labelCallback('long'),\n },\n },\n ],\n },\n\n {\n type: 'text',\n z: 30,\n rotation: isDesktop ? Math.PI / 2 : 0,\n left: `5px`,\n top: isDesktop\n ? `${topMargin + CHART_CONFIG.MAIN_HEIGHT / 2 - sentimentVerticalOffset}px`\n : `${topMargin - 18}px`,\n silent: true,\n style: {\n fontSize: 10,\n fontFamily: 'Sofia W03',\n fontWeight: 300,\n fill: textColor,\n text: sentimentText,\n },\n },\n {\n type: 'text',\n z: 30,\n rotation: isDesktop ? -Math.PI / 2 : 0,\n right: `5px`,\n top: isDesktop\n ? `${topMargin + CHART_CONFIG.MAIN_HEIGHT / 2 - priceVerticalOffset}px`\n : `${topMargin - 18}px`,\n silent: true,\n style: {\n fontSize: 10,\n fontFamily: 'Sofia W03',\n fontWeight: 300,\n fill: textColor,\n text: priceText,\n },\n },\n {\n type: 'rect',\n z: 20,\n right: '0px',\n top: '0px',\n shape: {\n width: yMainLabelSize,\n height: CHART_CONFIG.MAIN_HEIGHT,\n },\n silent: true,\n style: {\n fill: backgroundColor,\n },\n },\n {\n type: 'rect',\n z: 20,\n left: '0px',\n top: '0px',\n shape: {\n width: ySentimentLabelSize,\n height: CHART_CONFIG.MAIN_HEIGHT,\n },\n silent: true,\n style: {\n fill: backgroundColor,\n },\n },\n ];\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AACxD,OAAOC,MAAM,MAAM,WAAW;AAG9B,SAASC,YAAY,QAAQ,oBAAoB;AAQjD,OAAO,MAAMC,eAAe,GAAGC,IAAA,IAIwB;EAAA,IAJvB;IAC9BC,MAAM;IACNC,SAAS;IACTC;EACqB,CAAC,GAAAH,IAAA;EACtB,MAAMI,mBAAmB,GAAGF,SAAS,GACjCJ,YAAY,CAACO,8BAA8B,GAC3CP,YAAY,CAACQ,6BAA6B;EAE9C,MAAMC,cAAc,GAAGL,SAAS,GAC5BJ,YAAY,CAACU,oBAAoB,GACjCV,YAAY,CAACW,mBA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AAE;IACLC,KAAK,EAAE,KAAK;IACZJ,GAAG,EAAE,KAAK;IACVK,KAAK,EAAE;MACLC,KAAK,EAAEhC,cAAc;MACrBiC,MAAM,EAAE1C,YAAY,CAACoD;IACvB,CAAC;IACDhB,MAAM,EAAE,IAAI;IACZO,KAAK,EAAE;MACLC,IAAI,EAAE3B;IACR;EACF,CAAC,EACD;IACEe,IAAI,EAAE,MAAM;IACZM,CAAC,EAAE,EAAE;IACLL,IAAI,EAAE,KAAK;IACXE,GAAG,EAAE,KAAK;IACVK,KAAK,EAAE;MACLC,KAAK,EAAEnC,mBAAmB;MAC1BoC,MAAM,EAAE1C,YAAY,CAACoD;IACvB,CAAC;IACDhB,MAAM,EAAE,IAAI;IACZO,KAAK,EAAE;MACLC,IAAI,EAAE3B;IACR;EACF,CAAC,CACF;AACH,CAAC","ignoreList":[]}
|
package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import chroma from 'chroma-js';
|
|
2
|
-
import { getLabelData } from '../chartUtils';
|
|
3
2
|
export const getSeriesCandlestickConfig = _ref => {
|
|
4
3
|
let {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
styles
|
|
4
|
+
styles,
|
|
5
|
+
isLoading
|
|
8
6
|
} = _ref;
|
|
9
7
|
const {
|
|
10
8
|
candleLongColor,
|
|
11
9
|
candleShortColor
|
|
12
10
|
} = styles;
|
|
13
|
-
const labelsData = getLabelData({
|
|
14
|
-
dates,
|
|
15
|
-
isGreaterThanTwoWeeks
|
|
16
|
-
});
|
|
17
11
|
return {
|
|
12
|
+
animation: isLoading,
|
|
18
13
|
type: 'candlestick',
|
|
19
14
|
id: 'candlestick',
|
|
20
15
|
xAxisIndex: 0,
|
|
21
16
|
yAxisIndex: 0,
|
|
17
|
+
silent: true,
|
|
18
|
+
clip: true,
|
|
19
|
+
large: true,
|
|
22
20
|
encode: {
|
|
23
21
|
x: 'dates',
|
|
24
22
|
y: ['open', 'close', 'low', 'high']
|
|
@@ -35,12 +33,7 @@ export const getSeriesCandlestickConfig = _ref => {
|
|
|
35
33
|
color0: candleShortColor
|
|
36
34
|
}
|
|
37
35
|
},
|
|
38
|
-
|
|
39
|
-
data: labelsData,
|
|
40
|
-
symbol: 'circle',
|
|
41
|
-
symbolSize: 0
|
|
42
|
-
},
|
|
43
|
-
z: 2
|
|
36
|
+
z: 3
|
|
44
37
|
};
|
|
45
38
|
};
|
|
46
39
|
//# sourceMappingURL=getSeriesCandlestickConfig.js.map
|
package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSeriesCandlestickConfig.js","names":["chroma","
|
|
1
|
+
{"version":3,"file":"getSeriesCandlestickConfig.js","names":["chroma","getSeriesCandlestickConfig","_ref","styles","isLoading","candleLongColor","candleShortColor","animation","type","id","xAxisIndex","yAxisIndex","silent","clip","large","encode","x","y","itemStyle","color","desaturate","css","color0","borderColor","borderColor0","emphasis","z"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.ts"],"sourcesContent":["import chroma from 'chroma-js';\nimport type { CandlestickSeriesOption } from 'echarts';\n\nimport type { ChartStyles } from '../chartUtils/getChartStyles';\n\ninterface GetSeriesCandlestickConfigParams {\n styles: ChartStyles;\n isLoading: boolean;\n}\n\nexport const getSeriesCandlestickConfig = ({\n styles,\n isLoading,\n}: GetSeriesCandlestickConfigParams): CandlestickSeriesOption => {\n const { candleLongColor, candleShortColor } = styles;\n\n return {\n animation: isLoading,\n type: 'candlestick',\n id: 'candlestick',\n xAxisIndex: 0,\n yAxisIndex: 0,\n silent: true,\n clip: true,\n large: true,\n encode: {\n x: 'dates',\n y: ['open', 'close', 'low', 'high'],\n },\n itemStyle: {\n color: chroma(candleLongColor).desaturate().css(),\n color0: chroma(candleShortColor).desaturate().css(),\n borderColor: candleLongColor,\n borderColor0: candleShortColor,\n },\n emphasis: {\n itemStyle: {\n color: candleLongColor,\n color0: candleShortColor,\n },\n },\n z: 3,\n };\n};\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,WAAW;AAU9B,OAAO,MAAMC,0BAA0B,GAAGC,IAAA,IAGuB;EAAA,IAHtB;IACzCC,MAAM;IACNC;EACgC,CAAC,GAAAF,IAAA;EACjC,MAAM;IAAEG,eAAe;IAAEC;EAAiB,CAAC,GAAGH,MAAM;EAEpD,OAAO;IACLI,SAAS,EAAEH,SAAS;IACpBI,IAAI,EAAE,aAAa;IACnBC,EAAE,EAAE,aAAa;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,CAAC;IACbC,MAAM,EAAE,IAAI;IACZC,IAAI,EAAE,IAAI;IACVC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE;MACNC,CAAC,EAAE,OAAO;MACVC,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;IACpC,CAAC;IACDC,SAAS,EAAE;MACTC,KAAK,EAAEnB,MAAM,CAACK,eAAe,CAAC,CAACe,UAAU,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC;MACjDC,MAAM,EAAEtB,MAAM,CAACM,gBAAgB,CAAC,CAACc,UAAU,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC;MACnDE,WAAW,EAAElB,eAAe;MAC5BmB,YAAY,EAAElB;IAChB,CAAC;IACDmB,QAAQ,EAAE;MACRP,SAAS,EAAE;QACTC,KAAK,EAAEd,eAAe;QACtBiB,MAAM,EAAEhB;MACV;IACF,CAAC;IACDoB,CAAC,EAAE;EACL,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -5,9 +5,11 @@ export const getSeriesHeatmapConfig = _ref => {
|
|
|
5
5
|
buckets,
|
|
6
6
|
isDark,
|
|
7
7
|
sentimentThresholdMax,
|
|
8
|
-
sentimentThresholdMin
|
|
8
|
+
sentimentThresholdMin,
|
|
9
|
+
isLoading
|
|
9
10
|
} = _ref;
|
|
10
11
|
return {
|
|
12
|
+
animation: isLoading,
|
|
11
13
|
type: 'custom',
|
|
12
14
|
id: 'heatmap',
|
|
13
15
|
name: 'heatmap',
|
|
@@ -19,13 +21,17 @@ export const getSeriesHeatmapConfig = _ref => {
|
|
|
19
21
|
},
|
|
20
22
|
dimensions: ['dates', 'bookPrices', 'bookIndexes'],
|
|
21
23
|
clip: true,
|
|
22
|
-
renderItem: (
|
|
24
|
+
renderItem: (params, api) => {
|
|
25
|
+
const animationDelay = 350 * params.dataIndexInside / params.dataInsideLength;
|
|
23
26
|
const xVal = api.value(0);
|
|
24
27
|
const bucketIndex = api.value(2);
|
|
25
28
|
if (bucketIndex == null) {
|
|
26
29
|
return null;
|
|
27
30
|
}
|
|
28
31
|
const metaValues = buckets[bucketIndex];
|
|
32
|
+
if (!metaValues) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
29
35
|
const [rectWidth, rectHeight] = api.size([0, bucketWidth]);
|
|
30
36
|
const items = metaValues.map(_ref2 => {
|
|
31
37
|
let {
|
|
@@ -34,6 +40,7 @@ export const getSeriesHeatmapConfig = _ref => {
|
|
|
34
40
|
} = _ref2;
|
|
35
41
|
const start = api.coord([xVal, price]);
|
|
36
42
|
return {
|
|
43
|
+
silent: true,
|
|
37
44
|
shape: {
|
|
38
45
|
height: rectHeight,
|
|
39
46
|
width: rectWidth + 1,
|
|
@@ -43,12 +50,23 @@ export const getSeriesHeatmapConfig = _ref => {
|
|
|
43
50
|
style: {
|
|
44
51
|
fill: getRectColor(sentiment, isDark, sentimentThresholdMin, sentimentThresholdMax)
|
|
45
52
|
},
|
|
53
|
+
enterFrom: {
|
|
54
|
+
shape: {},
|
|
55
|
+
style: {
|
|
56
|
+
opacity: 0
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
enterAnimation: {
|
|
60
|
+
duration: 150,
|
|
61
|
+
delay: animationDelay
|
|
62
|
+
},
|
|
46
63
|
type: 'rect'
|
|
47
64
|
};
|
|
48
65
|
});
|
|
49
66
|
return {
|
|
50
67
|
children: items,
|
|
51
68
|
emphasisDisabled: true,
|
|
69
|
+
silent: true,
|
|
52
70
|
type: 'group'
|
|
53
71
|
};
|
|
54
72
|
},
|
package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSeriesHeatmapConfig.js","names":["getRectColor","getSeriesHeatmapConfig","_ref","bucketWidth","buckets","isDark","sentimentThresholdMax","sentimentThresholdMin","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","clip","renderItem","
|
|
1
|
+
{"version":3,"file":"getSeriesHeatmapConfig.js","names":["getRectColor","getSeriesHeatmapConfig","_ref","bucketWidth","buckets","isDark","sentimentThresholdMax","sentimentThresholdMin","isLoading","animation","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","clip","renderItem","params","api","animationDelay","dataIndexInside","dataInsideLength","xVal","value","bucketIndex","metaValues","rectWidth","rectHeight","size","items","map","_ref2","price","sentiment","start","coord","silent","shape","height","width","style","fill","enterFrom","opacity","enterAnimation","duration","delay","children","emphasisDisabled","z"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.ts"],"sourcesContent":["import type {\n CustomSeriesOption,\n CustomSeriesRenderItemAPI,\n CustomSeriesRenderItemParams,\n} from 'echarts';\n\nimport { getRectColor } from '../chartUtils';\nimport type { Bucket } from '../types';\n\ninterface GetSeriesHeatmapConfigParams {\n bucketWidth: number;\n buckets: Bucket[][];\n isDark: boolean;\n sentimentThresholdMax: number;\n sentimentThresholdMin: number;\n isLoading: boolean;\n}\n\nexport const getSeriesHeatmapConfig = ({\n bucketWidth,\n buckets,\n isDark,\n sentimentThresholdMax,\n sentimentThresholdMin,\n isLoading,\n}: GetSeriesHeatmapConfigParams): CustomSeriesOption => {\n return {\n animation: isLoading,\n type: 'custom',\n id: 'heatmap',\n name: 'heatmap',\n xAxisIndex: 0,\n yAxisIndex: 0,\n encode: {\n x: 'dates',\n y: 'bookPrices',\n },\n dimensions: ['dates', 'bookPrices', 'bookIndexes'],\n clip: true,\n renderItem: (\n params: CustomSeriesRenderItemParams,\n api: CustomSeriesRenderItemAPI\n ) => {\n const animationDelay =\n (350 * params.dataIndexInside) / params.dataInsideLength;\n const xVal = api.value(0);\n const bucketIndex = api.value(2) as number;\n\n if (bucketIndex == null) {\n return null;\n }\n\n const metaValues = buckets[bucketIndex];\n\n if (!metaValues) {\n return null;\n }\n\n const [rectWidth, rectHeight] = api.size!([0, bucketWidth]) as number[];\n\n const items = metaValues.map(({ price, sentiment }: Bucket) => {\n const start = api.coord([xVal, price]);\n\n return {\n silent: true,\n shape: {\n height: rectHeight,\n width: rectWidth + 1,\n x: start[0] - rectWidth / 2,\n y: start[1] - rectHeight,\n },\n style: {\n fill: getRectColor(\n sentiment,\n isDark,\n sentimentThresholdMin,\n sentimentThresholdMax\n ),\n },\n enterFrom: {\n shape: {},\n style: {\n opacity: 0,\n },\n },\n enterAnimation: {\n duration: 150,\n delay: animationDelay,\n },\n type: 'rect' as const,\n };\n });\n\n return {\n children: items,\n emphasisDisabled: true,\n silent: true,\n type: 'group' as const,\n };\n },\n z: 1,\n };\n};\n"],"mappings":"AAMA,SAASA,YAAY,QAAQ,eAAe;AAY5C,OAAO,MAAMC,sBAAsB,GAAGC,IAAA,IAOkB;EAAA,IAPjB;IACrCC,WAAW;IACXC,OAAO;IACPC,MAAM;IACNC,qBAAqB;IACrBC,qBAAqB;IACrBC;EAC4B,CAAC,GAAAN,IAAA;EAC7B,OAAO;IACLO,SAAS,EAAED,SAAS;IACpBE,IAAI,EAAE,QAAQ;IACdC,EAAE,EAAE,SAAS;IACbC,IAAI,EAAE,SAAS;IACfC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,CAAC;IACbC,MAAM,EAAE;MACNC,CAAC,EAAE,OAAO;MACVC,CAA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C;UACDwC,SAAS,EAAE;YACTL,KAAK,EAAE,CAAC,CAAC;YACTG,KAAK,EAAE;cACLG,OAAO,EAAE;YACX;UACF,CAAC;UACDC,cAAc,EAAE;YACdC,QAAQ,EAAE,GAAG;YACbC,KAAK,EAAE3B;UACT,CAAC;UACDb,IAAI,EAAE;QACR,CAAC;MACH,CAAC,CAAC;MAEF,OAAO;QACLyC,QAAQ,EAAElB,KAAK;QACfmB,gBAAgB,EAAE,IAAI;QACtBZ,MAAM,EAAE,IAAI;QACZ9B,IAAI,EAAE;MACR,CAAC;IACH,CAAC;IACD2C,CAAC,EAAE;EACL,CAAC;AACH,CAAC","ignoreList":[]}
|
package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { colorPalette } from '@oanda/labs-widget-common';
|
|
2
2
|
export const getSeriesSentimentConfig = _ref => {
|
|
3
3
|
let {
|
|
4
|
-
styles
|
|
4
|
+
styles,
|
|
5
|
+
isLoading
|
|
5
6
|
} = _ref;
|
|
6
7
|
return {
|
|
8
|
+
animation: isLoading,
|
|
9
|
+
animationDelay: 350,
|
|
7
10
|
type: 'line',
|
|
8
11
|
id: 'sentiment',
|
|
9
12
|
name: 'sentiment',
|
|
@@ -11,9 +14,9 @@ export const getSeriesSentimentConfig = _ref => {
|
|
|
11
14
|
yAxisIndex: 1,
|
|
12
15
|
encode: {
|
|
13
16
|
x: 'dates',
|
|
14
|
-
y: '
|
|
17
|
+
y: 'sentimentLongs'
|
|
15
18
|
},
|
|
16
|
-
dimensions: ['dates', '
|
|
19
|
+
dimensions: ['dates', 'sentimentLongs', 'sentimentShorts'],
|
|
17
20
|
lineStyle: {
|
|
18
21
|
width: styles.sentimentOutlineWidth,
|
|
19
22
|
opacity: 1,
|
|
@@ -23,7 +26,11 @@ export const getSeriesSentimentConfig = _ref => {
|
|
|
23
26
|
emphasis: {
|
|
24
27
|
disabled: true
|
|
25
28
|
},
|
|
29
|
+
tooltip: {
|
|
30
|
+
show: false
|
|
31
|
+
},
|
|
26
32
|
markLine: {
|
|
33
|
+
animation: isLoading,
|
|
27
34
|
silent: true,
|
|
28
35
|
symbol: ['none', 'none'],
|
|
29
36
|
label: {
|
|
@@ -44,10 +51,11 @@ export const getSeriesSentimentConfig = _ref => {
|
|
|
44
51
|
yAxis: 80
|
|
45
52
|
}]
|
|
46
53
|
},
|
|
47
|
-
stack: 'sentiment',
|
|
48
54
|
showSymbol: false,
|
|
49
55
|
symbol: 'none',
|
|
50
|
-
z:
|
|
56
|
+
z: 2,
|
|
57
|
+
connectNulls: true,
|
|
58
|
+
silent: true
|
|
51
59
|
};
|
|
52
60
|
};
|
|
53
61
|
//# sourceMappingURL=getSeriesSentimentConfig.js.map
|
package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSeriesSentimentConfig.js","names":["colorPalette","getSeriesSentimentConfig","_ref","styles","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","lineStyle","width","sentimentOutlineWidth","opacity","shadowColor","sentimentOutlineColor","shadowBlur","emphasis","disabled","markLine","silent","symbol","label","
|
|
1
|
+
{"version":3,"file":"getSeriesSentimentConfig.js","names":["colorPalette","getSeriesSentimentConfig","_ref","styles","isLoading","animation","animationDelay","type","id","name","xAxisIndex","yAxisIndex","encode","x","y","dimensions","lineStyle","width","sentimentOutlineWidth","opacity","shadowColor","sentimentOutlineColor","shadowBlur","emphasis","disabled","tooltip","show","markLine","silent","symbol","label","color","grayLight","data","yAxis","showSymbol","z","connectNulls"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport type { LineSeriesOption } from 'echarts';\n\nimport type { ChartStyles } from '../chartUtils';\n\ninterface GetSeriesSentimentConfigParams {\n styles: ChartStyles;\n isLoading: boolean;\n}\n\nexport const getSeriesSentimentConfig = ({\n styles,\n isLoading,\n}: GetSeriesSentimentConfigParams): LineSeriesOption => {\n return {\n animation: isLoading,\n animationDelay: 350,\n type: 'line',\n id: 'sentiment',\n name: 'sentiment',\n xAxisIndex: 1,\n yAxisIndex: 1,\n encode: {\n x: 'dates',\n y: 'sentimentLongs',\n },\n dimensions: ['dates', 'sentimentLongs', 'sentimentShorts'],\n lineStyle: {\n width: styles.sentimentOutlineWidth,\n opacity: 1,\n shadowColor: styles.sentimentOutlineColor,\n shadowBlur: 3,\n },\n emphasis: {\n disabled: true,\n },\n tooltip: {\n show: false,\n },\n markLine: {\n animation: isLoading,\n silent: true,\n symbol: ['none', 'none'],\n label: {\n show: false,\n },\n lineStyle: {\n color: colorPalette.grayLight,\n width: 1,\n },\n data: [\n {\n yAxis: 20,\n },\n {\n yAxis: 50,\n lineStyle: {\n width: 1,\n },\n },\n {\n yAxis: 80,\n },\n ],\n },\n showSymbol: false,\n symbol: 'none',\n z: 2,\n connectNulls: true,\n silent: true,\n };\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAUxD,OAAO,MAAMC,wBAAwB,GAAGC,IAAA,IAGgB;EAAA,IAHf;IACvCC,MAAM;IACNC;EAC8B,CAAC,GAAAF,IAAA;EAC/B,OAAO;IACLG,SAAS,EAAED,SAAS;IACpBE,cAAc,EAAE,GAAG;IACnBC,IAAI,EAAE,MAAM;IACZC,EAAE,EAAE,WAAW;IACfC,IAAI,EAAE,WAAW;IACjBC,UAAU,EAAE,CAAC;IACbC,UAAU,EAAE,CAAC;IACbC,MAAM,EAAE;MACNC,CAAC,EAAE,OAAO;MACVC,CAAC,EAAE;IACL,CAAC;IACDC,UAAU,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,CAAC;IAC1DC,SAAS,EAAE;MACTC,KAAK,EAAEd,MAAM,CAACe,qBAAqB;MACnCC,OAAO,EAAE,CAAC;MACVC,WAAW,EAAEjB,MAAM,CAACkB,qBAAqB;MACzCC,UAAU,EAAE;IACd,CAAC;IACDC,QAAQ,EAAE;MACRC,QAAQ,EAAE;IACZ,CAAC;IACDC,OAAO,EAAE;MACPC,IAAI,EAAE;IACR,CAAC;IACDC,QAAQ,EAAE;MACRtB,SAAS,EAAED,SAAS;MACpBwB,MAAM,EAAE,IAAI;MACZC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;MACxBC,KAAK,EAAE;QACLJ,IAAI,EAAE;MACR,CAAC;MACDV,SAAS,EAAE;QACTe,KAAK,EAAE/B,YAAY,CAACgC,SAAS;QAC7Bf,KAAK,EAAE;MACT,CAAC;MACDgB,IAAI,EAAE,CACJ;QACEC,KAAK,EAAE;MACT,CAAC,EACD;QACEA,KAAK,EAAE,EAAE;QACTlB,SAAS,EAAE;UACTC,KAAK,EAAE;QACT;MACF,CAAC,EACD;QACEiB,KAAK,EAAE;MACT,CAAC;IAEL,CAAC;IACDC,UAAU,EAAE,KAAK;IACjBN,MAAM,EAAE,MAAM;IACdO,CAAC,EAAE,CAAC;IACJC,YAAY,EAAE,IAAI;IAClBT,MAAM,EAAE;EACV,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CHART_CONFIG } from '../../../constants';
|
|
1
2
|
import { getTooltipFormatter } from '../chartUtils';
|
|
2
3
|
export const getTooltipConfig = _ref => {
|
|
3
4
|
let {
|
|
@@ -7,7 +8,9 @@ export const getTooltipConfig = _ref => {
|
|
|
7
8
|
displayPrecision,
|
|
8
9
|
labelCallback,
|
|
9
10
|
selectedPriceRef,
|
|
10
|
-
tooltipLinesColor
|
|
11
|
+
tooltipLinesColor,
|
|
12
|
+
sentimentLongs,
|
|
13
|
+
sentimentShorts
|
|
11
14
|
} = _ref;
|
|
12
15
|
return {
|
|
13
16
|
trigger: 'axis',
|
|
@@ -17,8 +20,11 @@ export const getTooltipConfig = _ref => {
|
|
|
17
20
|
buckets,
|
|
18
21
|
labelCallback,
|
|
19
22
|
params: params,
|
|
20
|
-
selectedPrice: selectedPriceRef.current
|
|
23
|
+
selectedPrice: selectedPriceRef.current,
|
|
24
|
+
sentimentLongs,
|
|
25
|
+
sentimentShorts
|
|
21
26
|
}),
|
|
27
|
+
hideDelay: 0,
|
|
22
28
|
axisPointer: {
|
|
23
29
|
type: 'cross',
|
|
24
30
|
axis: 'x',
|
|
@@ -40,7 +46,8 @@ export const getTooltipConfig = _ref => {
|
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
},
|
|
43
|
-
confine: true
|
|
49
|
+
confine: true,
|
|
50
|
+
position: point => [point[0] + CHART_CONFIG.TOOLTIP_OFFSET, point[1] + CHART_CONFIG.TOOLTIP_OFFSET]
|
|
44
51
|
};
|
|
45
52
|
};
|
|
46
53
|
//# sourceMappingURL=getTooltipConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTooltipConfig.js","names":["getTooltipFormatter","getTooltipConfig","_ref","bookType","bucketWidth","buckets","displayPrecision","labelCallback","selectedPriceRef","tooltipLinesColor","trigger","formatter","params","selectedPrice","current","axisPointer","type","axis","lineStyle","color","crossStyle","label","padding","lineHeight","axisDimension","axisIndex","Number","value","concat","toFixed","confine"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts"],"sourcesContent":["import type { TooltipComponentOption } from 'echarts';\n\nimport type { BookType } from '../../../../gql/types/graphql';\nimport { getTooltipFormatter } from '../chartUtils';\nimport type { Bucket, TooltipParam } from '../types';\n\ninterface GetTooltipConfigParams {\n bookType: BookType;\n bucketWidth: number;\n buckets: Bucket[][];\n displayPrecision: number;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n selectedPriceRef: { current: number };\n tooltipLinesColor: string;\n}\n\nexport const getTooltipConfig = ({\n bookType,\n bucketWidth,\n buckets,\n displayPrecision,\n labelCallback,\n selectedPriceRef,\n tooltipLinesColor,\n}: GetTooltipConfigParams): TooltipComponentOption => ({\n trigger: 'axis' as const,\n formatter: (params) =>\n getTooltipFormatter({\n bookType,\n bucketWidth,\n buckets,\n labelCallback,\n params: params as unknown as TooltipParam[],\n selectedPrice: selectedPriceRef.current,\n }),\n
|
|
1
|
+
{"version":3,"file":"getTooltipConfig.js","names":["CHART_CONFIG","getTooltipFormatter","getTooltipConfig","_ref","bookType","bucketWidth","buckets","displayPrecision","labelCallback","selectedPriceRef","tooltipLinesColor","sentimentLongs","sentimentShorts","trigger","formatter","params","selectedPrice","current","hideDelay","axisPointer","type","axis","lineStyle","color","crossStyle","label","padding","lineHeight","axisDimension","axisIndex","Number","value","concat","toFixed","confine","position","point","TOOLTIP_OFFSET"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.ts"],"sourcesContent":["import type { TooltipComponentOption } from 'echarts';\n\nimport type { BookType } from '../../../../gql/types/graphql';\nimport { CHART_CONFIG } from '../../../constants';\nimport { getTooltipFormatter } from '../chartUtils';\nimport type { Bucket, TooltipParam } from '../types';\n\ninterface GetTooltipConfigParams {\n bookType: BookType;\n bucketWidth: number;\n buckets: Bucket[][];\n displayPrecision: number;\n labelCallback: (key: string, params?: Record<string, unknown>) => string;\n selectedPriceRef: { current: number };\n tooltipLinesColor: string;\n sentimentLongs: (number | null)[];\n sentimentShorts: (number | null)[];\n}\n\nexport const getTooltipConfig = ({\n bookType,\n bucketWidth,\n buckets,\n displayPrecision,\n labelCallback,\n selectedPriceRef,\n tooltipLinesColor,\n sentimentLongs,\n sentimentShorts,\n}: GetTooltipConfigParams): TooltipComponentOption => ({\n trigger: 'axis' as const,\n formatter: (params) =>\n getTooltipFormatter({\n bookType,\n bucketWidth,\n buckets,\n labelCallback,\n params: params as unknown as TooltipParam[],\n selectedPrice: selectedPriceRef.current,\n sentimentLongs,\n sentimentShorts,\n }),\n hideDelay: 0,\n axisPointer: {\n type: 'cross' as const,\n axis: 'x' as const,\n lineStyle: {\n color: tooltipLinesColor,\n },\n crossStyle: {\n color: tooltipLinesColor,\n },\n label: {\n padding: 0,\n lineHeight: 24,\n formatter: (params: {\n axisDimension?: string;\n axisIndex?: number;\n value: unknown;\n }) => {\n if (params.axisDimension === 'y' && params.axisIndex === 0) {\n selectedPriceRef.current = Number(params.value);\n return ` ${Number(params.value).toFixed(displayPrecision)} `;\n }\n return '';\n },\n },\n },\n confine: true,\n position: (point) => [\n point[0] + CHART_CONFIG.TOOLTIP_OFFSET,\n point[1] + CHART_CONFIG.TOOLTIP_OFFSET,\n ],\n});\n"],"mappings":"AAGA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,eAAe;AAenD,OAAO,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IAC/BC,QAAQ;IACRC,WAAW;IACXC,OAAO;IACPC,gBAAgB;IAChBC,aAAa;IACbC,gBAAgB;IAChBC,iBAAiB;IACjBC,cAAc;IACdC;EACsB,CAAC,GAAAT,IAAA;EAAA,OAA8B;IACrDU,OAAO,EAAE,MAAe;IACxBC,SAAS,EAAGC,MAAM,IAChBd,mBAAmB,CAAC;MAClBG,QAAQ;MACRC,WAAW;MACXC,OAAO;MACPE,aAAa;MACbO,MAAM,EAAEA,MAAmC;MAC3CC,aAAa,EAAEP,gBAAgB,CAACQ,OAAO;MACvCN,cAAc;MACdC;IACF,CAAC,CAAC;IACJM,SAAS,EAAE,CAAC;IACZC,WAAW,EAAE;MACXC,IAAI,EAAE,OAAgB;MACtBC,IAAI,EAAE,GAAY;MAClBC,SAAS,EAAE;QACTC,KAAK,EAAEb;MACT,CAAC;MACDc,UAAU,EAAE;QACVD,KAAK,EAAEb;MACT,CAAC;MACDe,KAAK,EAAE;QACLC,OAAO,EAAE,CAAC;QACVC,UAAU,EAAE,EAAE;QACdb,SAAS,EAAGC,MAIX,IAAK;UACJ,IAAIA,MAAM,CAACa,aAAa,KAAK,GAAG,IAAIb,MAAM,CAACc,SAAS,KAAK,CAAC,EAAE;YAC1DpB,gBAAgB,CAACQ,OAAO,GAAGa,MAAM,CAACf,MAAM,CAACgB,KAAK,CAAC;YAC/C,WAAAC,MAAA,CAAWF,MAAM,CAACf,MAAM,CAACgB,KAAK,CAAC,CAACE,OAAO,CAAC1B,gBAAgB,CAAC;UAC3D;UACA,OAAO,EAAE;QACX;MACF;IACF,CAAC;IACD2B,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAGC,KAAK,IAAK,CACnBA,KAAK,CAAC,CAAC,CAAC,GAAGpC,YAAY,CAACqC,cAAc,EACtCD,KAAK,CAAC,CAAC,CAAC,GAAGpC,YAAY,CAACqC,cAAc;EAE1C,CAAC;AAAA,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { formatXAxisLabel } from '../chartUtils';
|
|
1
|
+
import { formatXAxisAdditionalLabel, formatXAxisLabel, getLabelData } from '../chartUtils';
|
|
2
2
|
export const getXAxisConfig = _ref => {
|
|
3
3
|
let {
|
|
4
4
|
dates,
|
|
5
5
|
isGreaterThanTwoWeeks
|
|
6
6
|
} = _ref;
|
|
7
|
+
const labelsData = getLabelData({
|
|
8
|
+
dates,
|
|
9
|
+
isGreaterThanTwoWeeks
|
|
10
|
+
});
|
|
7
11
|
return [{
|
|
8
12
|
type: 'category',
|
|
9
13
|
id: 'main-xAxis',
|
|
10
|
-
name: 'xAxis-less-than-two-weeks',
|
|
14
|
+
name: isGreaterThanTwoWeeks ? 'xAxis-greater-than-two-weeks' : 'xAxis-less-than-two-weeks',
|
|
11
15
|
nameTextStyle: {
|
|
12
16
|
fontSize: 0
|
|
13
17
|
},
|
|
@@ -18,18 +22,29 @@ export const getXAxisConfig = _ref => {
|
|
|
18
22
|
padding: [8, 16, 8, 16],
|
|
19
23
|
margin: 0,
|
|
20
24
|
formatter: value => formatXAxisLabel(value, isGreaterThanTwoWeeks)
|
|
21
|
-
}
|
|
25
|
+
},
|
|
26
|
+
boundaryGap: false
|
|
22
27
|
}, {
|
|
23
28
|
type: 'category',
|
|
29
|
+
id: 'additional-xAxis',
|
|
24
30
|
gridIndex: 1,
|
|
25
|
-
show: false,
|
|
26
31
|
axisTick: {
|
|
27
32
|
show: false
|
|
28
33
|
},
|
|
29
|
-
|
|
34
|
+
axisLine: {
|
|
30
35
|
show: false
|
|
31
36
|
},
|
|
32
|
-
|
|
37
|
+
splitLine: {
|
|
38
|
+
show: false
|
|
39
|
+
},
|
|
40
|
+
axisLabel: {
|
|
41
|
+
margin: 24,
|
|
42
|
+
hideOverlap: true,
|
|
43
|
+
customValues: labelsData,
|
|
44
|
+
formatter: value => formatXAxisAdditionalLabel(value, isGreaterThanTwoWeeks)
|
|
45
|
+
},
|
|
46
|
+
data: dates,
|
|
47
|
+
boundaryGap: false
|
|
33
48
|
}];
|
|
34
49
|
};
|
|
35
50
|
//# sourceMappingURL=getXAxisConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getXAxisConfig.js","names":["formatXAxisLabel","getXAxisConfig","_ref","dates","isGreaterThanTwoWeeks","type","id","name","nameTextStyle","fontSize","axisTick","show","axisLabel","padding","margin","formatter","value","gridIndex","data"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts"],"sourcesContent":["import type { XAXisComponentOption } from 'echarts';\n\nimport {
|
|
1
|
+
{"version":3,"file":"getXAxisConfig.js","names":["formatXAxisAdditionalLabel","formatXAxisLabel","getLabelData","getXAxisConfig","_ref","dates","isGreaterThanTwoWeeks","labelsData","type","id","name","nameTextStyle","fontSize","axisTick","show","axisLabel","padding","margin","formatter","value","boundaryGap","gridIndex","axisLine","splitLine","hideOverlap","customValues","data"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.ts"],"sourcesContent":["import type { XAXisComponentOption } from 'echarts';\n\nimport {\n formatXAxisAdditionalLabel,\n formatXAxisLabel,\n getLabelData,\n} from '../chartUtils';\n\ninterface GetXAxisConfigParams {\n dates: string[];\n isGreaterThanTwoWeeks: boolean;\n}\n\nexport const getXAxisConfig = ({\n dates,\n isGreaterThanTwoWeeks,\n}: GetXAxisConfigParams): XAXisComponentOption[] => {\n const labelsData = getLabelData({\n dates,\n isGreaterThanTwoWeeks,\n });\n\n return [\n {\n type: 'category',\n id: 'main-xAxis',\n name: isGreaterThanTwoWeeks\n ? 'xAxis-greater-than-two-weeks'\n : 'xAxis-less-than-two-weeks',\n nameTextStyle: {\n fontSize: 0,\n },\n axisTick: {\n show: false,\n },\n axisLabel: {\n padding: [8, 16, 8, 16],\n margin: 0,\n formatter: (value: unknown) =>\n formatXAxisLabel(value, isGreaterThanTwoWeeks),\n },\n boundaryGap: false,\n },\n {\n type: 'category',\n id: 'additional-xAxis',\n gridIndex: 1,\n axisTick: {\n show: false,\n },\n axisLine: {\n show: false,\n },\n splitLine: {\n show: false,\n },\n axisLabel: {\n margin: 24,\n hideOverlap: true,\n customValues: labelsData,\n formatter: (value: unknown) =>\n formatXAxisAdditionalLabel(value, isGreaterThanTwoWeeks),\n },\n data: dates,\n boundaryGap: false,\n },\n ];\n};\n"],"mappings":"AAEA,SACEA,0BAA0B,EAC1BC,gBAAgB,EAChBC,YAAY,QACP,eAAe;AAOtB,OAAO,MAAMC,cAAc,GAAGC,IAAA,IAGsB;EAAA,IAHrB;IAC7BC,KAAK;IACLC;EACoB,CAAC,GAAAF,IAAA;EACrB,MAAMG,UAAU,GAAGL,YAAY,CAAC;IAC9BG,KAAK;IACLC;EACF,CAAC,CAAC;EAEF,OAAO,CACL;IACEE,IAAI,EAAE,UAAU;IAChBC,EAAE,EAAE,YAAY;IAChBC,IAAI,EAAEJ,qBAAqB,GACvB,8BAA8B,GAC9B,2BAA2B;IAC/BK,aAAa,EAAE;MACbC,QAAQ,EAAE;IACZ,CAAC;IACDC,QAAQ,EAAE;MACRC,IAAI,EAAE;IACR,CAAC;IACDC,SAAS,EAAE;MACTC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;MACvBC,MAAM,EAAE,CAAC;MACTC,SAAS,EAAGC,KAAc,IACxBlB,gBAAgB,CAACkB,KAAK,EAAEb,qBAAqB;IACjD,CAAC;IACDc,WAAW,EAAE;EACf,CAAC,EACD;IACEZ,IAAI,EAAE,UAAU;IAChBC,EAAE,EAAE,kBAAkB;IACtBY,SAAS,EAAE,CAAC;IACZR,QAAQ,EAAE;MACRC,IAAI,EAAE;IACR,CAAC;IACDQ,QAAQ,EAAE;MACRR,IAAI,EAAE;IACR,CAAC;IACDS,SAAS,EAAE;MACTT,IAAI,EAAE;IACR,CAAC;IACDC,SAAS,EAAE;MACTE,MAAM,EAAE,EAAE;MACVO,WAAW,EAAE,IAAI;MACjBC,YAAY,EAAElB,UAAU;MACxBW,SAAS,EAAGC,KAAc,IACxBnB,0BAA0B,CAACmB,KAAK,EAAEb,qBAAqB;IAC3D,CAAC;IACDoB,IAAI,EAAErB,KAAK;IACXe,WAAW,EAAE;EACf,CAAC,CACF;AACH,CAAC","ignoreList":[]}
|
|
@@ -2,9 +2,7 @@ import { BUCKET_CONFIG, CHART_CONFIG } from '../../../constants';
|
|
|
2
2
|
export const getYAxisConfig = _ref => {
|
|
3
3
|
let {
|
|
4
4
|
bucketWidth,
|
|
5
|
-
displayPrecision
|
|
6
|
-
isDesktop,
|
|
7
|
-
labelCallback
|
|
5
|
+
displayPrecision
|
|
8
6
|
} = _ref;
|
|
9
7
|
return [{
|
|
10
8
|
type: 'value',
|
|
@@ -18,11 +16,17 @@ export const getYAxisConfig = _ref => {
|
|
|
18
16
|
axisTick: {
|
|
19
17
|
show: false
|
|
20
18
|
},
|
|
19
|
+
splitLine: {
|
|
20
|
+
show: false
|
|
21
|
+
},
|
|
21
22
|
axisLabel: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
lineHeight: 20,
|
|
24
|
+
margin: 4,
|
|
25
|
+
verticalAlignMinLabel: 'bottom',
|
|
26
|
+
verticalAlignMaxLabel: 'top',
|
|
27
|
+
formatter: value => value.toFixed(displayPrecision)
|
|
28
|
+
},
|
|
29
|
+
z: 30
|
|
26
30
|
}, {
|
|
27
31
|
type: 'value',
|
|
28
32
|
gridIndex: 1,
|
|
@@ -38,31 +42,18 @@ export const getYAxisConfig = _ref => {
|
|
|
38
42
|
axisPointer: {
|
|
39
43
|
show: false
|
|
40
44
|
},
|
|
45
|
+
splitLine: {
|
|
46
|
+
show: false
|
|
47
|
+
},
|
|
41
48
|
axisLabel: {
|
|
42
|
-
margin:
|
|
49
|
+
margin: 4,
|
|
43
50
|
lineHeight: 20,
|
|
44
51
|
verticalAlignMinLabel: 'bottom',
|
|
45
|
-
verticalAlignMaxLabel: '
|
|
52
|
+
verticalAlignMaxLabel: 'middle',
|
|
46
53
|
customValues: [CHART_CONFIG.SENTIMENT_MIN, CHART_CONFIG.SENTIMENT_MAX / 5, CHART_CONFIG.SENTIMENT_MAX / 2, CHART_CONFIG.SENTIMENT_MAX * 4 / 5, CHART_CONFIG.SENTIMENT_MAX],
|
|
47
|
-
formatter: value =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
if (value === CHART_CONFIG.SENTIMENT_MAX) {
|
|
52
|
-
return "".concat(labelCallback('long'));
|
|
53
|
-
}
|
|
54
|
-
if (value === CHART_CONFIG.SENTIMENT_MAX / 2) {
|
|
55
|
-
return '50%';
|
|
56
|
-
}
|
|
57
|
-
if (value === CHART_CONFIG.SENTIMENT_MAX / 5) {
|
|
58
|
-
return '80%';
|
|
59
|
-
}
|
|
60
|
-
if (value === CHART_CONFIG.SENTIMENT_MAX * 4 / 5) {
|
|
61
|
-
return '20%';
|
|
62
|
-
}
|
|
63
|
-
return '';
|
|
64
|
-
}
|
|
65
|
-
}
|
|
54
|
+
formatter: value => "".concat(value, "%")
|
|
55
|
+
},
|
|
56
|
+
z: 30
|
|
66
57
|
}];
|
|
67
58
|
};
|
|
68
59
|
//# sourceMappingURL=getYAxisConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getYAxisConfig.js","names":["BUCKET_CONFIG","CHART_CONFIG","getYAxisConfig","_ref","bucketWidth","displayPrecision","
|
|
1
|
+
{"version":3,"file":"getYAxisConfig.js","names":["BUCKET_CONFIG","CHART_CONFIG","getYAxisConfig","_ref","bucketWidth","displayPrecision","type","gridIndex","position","min","val","PRICE_MARGIN_MULTIPLIER","max","axisLine","show","axisTick","splitLine","axisLabel","lineHeight","margin","verticalAlignMinLabel","verticalAlignMaxLabel","formatter","value","toFixed","z","SENTIMENT_MIN","SENTIMENT_MAX","axisPointer","customValues","concat"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.ts"],"sourcesContent":["import type { YAXisComponentOption } from 'echarts';\n\nimport { BUCKET_CONFIG, CHART_CONFIG } from '../../../constants';\n\ninterface GetYAxisConfigParams {\n bucketWidth: number;\n displayPrecision: number;\n}\n\nexport const getYAxisConfig = ({\n bucketWidth,\n displayPrecision,\n}: GetYAxisConfigParams): YAXisComponentOption[] => [\n {\n type: 'value',\n gridIndex: 0,\n position: 'right',\n min: (val: { min: number }) =>\n val.min - bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,\n max: (val: { max: number }) =>\n val.max + bucketWidth * BUCKET_CONFIG.PRICE_MARGIN_MULTIPLIER,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: { show: false },\n axisLabel: {\n lineHeight: 20,\n margin: 4,\n verticalAlignMinLabel: 'bottom',\n verticalAlignMaxLabel: 'top',\n formatter: (value: number) => value.toFixed(displayPrecision),\n },\n z: 30,\n },\n {\n type: 'value',\n gridIndex: 1,\n position: 'left',\n min: CHART_CONFIG.SENTIMENT_MIN,\n max: CHART_CONFIG.SENTIMENT_MAX,\n axisLine: { show: false },\n axisTick: { show: false },\n axisPointer: { show: false },\n splitLine: { show: false },\n axisLabel: {\n margin: 4,\n lineHeight: 20,\n verticalAlignMinLabel: 'bottom',\n verticalAlignMaxLabel: 'middle',\n customValues: [\n CHART_CONFIG.SENTIMENT_MIN,\n CHART_CONFIG.SENTIMENT_MAX / 5,\n CHART_CONFIG.SENTIMENT_MAX / 2,\n (CHART_CONFIG.SENTIMENT_MAX * 4) / 5,\n CHART_CONFIG.SENTIMENT_MAX,\n ],\n formatter: (value: number) => `${value}%`,\n },\n z: 30,\n },\n];\n"],"mappings":"AAEA,SAASA,aAAa,EAAEC,YAAY,QAAQ,oBAAoB;AAOhE,OAAO,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;IAC7BC,WAAW;IACXC;EACoB,CAAC,GAAAF,IAAA;EAAA,OAA6B,CAClD;IACEG,IAAI,EAAE,OAAO;IACbC,SAAS,EAAE,CAAC;IACZC,QAAQ,EAAE,OAAO;IACjBC,GAAG,EAAGC,GAAoB,IACxBA,GAAG,CAACD,GAAG,GAAGL,WAAW,GAAGJ,aAAa,CAACW,uBAAuB;IAC/DC,GAAG,EAAGF,GAAoB,IACxBA,GAAG,CAACE,GAAG,GAAGR,WAAW,GAAGJ,aAAa,CAACW,uBAAuB;IAC/DE,QAAQ,EAAE;MAAEC,IAAI,EAAE;IAAM,CAAC;IACzBC,QAAQ,EAAE;MAAED,IAAI,EAAE;IAAM,CAAC;IACzBE,SAAS,EAAE;MAAEF,IAAI,EAAE;IAAM,CAAC;IAC1BG,SAAS,EAAE;MACTC,UAAU,EAAE,EAAE;MACdC,MAAM,EAAE,CAAC;MACTC,qBAAqB,EAAE,QAAQ;MAC/BC,qBAAqB,EAAE,KAAK;MAC5BC,SAAS,EAAGC,KAAa,IAAKA,KAAK,CAACC,OAAO,CAACnB,gBAAgB;IAC9D,CAAC;IACDoB,CAAC,EAAE;EACL,CAAC,EACD;IACEnB,IAAI,EAAE,OAAO;IACbC,SAAS,EAAE,CAAC;IACZC,QAAQ,EAAE,MAAM;IAChBC,GAAG,EAAER,YAAY,CAACyB,aAAa;IAC/Bd,GAAG,EAAEX,YAAY,CAAC0B,aAAa;IAC/Bd,QAAQ,EAAE;MAAEC,IAAI,EAAE;IAAM,CAAC;IACzBC,QAAQ,EAAE;MAAED,IAAI,EAAE;IAAM,CAAC;IACzBc,WAAW,EAAE;MAAEd,IAAI,EAAE;IAAM,CAAC;IAC5BE,SAAS,EAAE;MAAEF,IAAI,EAAE;IAAM,CAAC;IAC1BG,SAAS,EAAE;MACTE,MAAM,EAAE,CAAC;MACTD,UAAU,EAAE,EAAE;MACdE,qBAAqB,EAAE,QAAQ;MAC/BC,qBAAqB,EAAE,QAAQ;MAC/BQ,YAAY,EAAE,CACZ5B,YAAY,CAACyB,aAAa,EAC1BzB,YAAY,CAAC0B,aAAa,GAAG,CAAC,EAC9B1B,YAAY,CAAC0B,aAAa,GAAG,CAAC,EAC7B1B,YAAY,CAAC0B,aAAa,GAAG,CAAC,GAAI,CAAC,EACpC1B,YAAY,CAAC0B,aAAa,CAC3B;MACDL,SAAS,EAAGC,KAAa,OAAAO,MAAA,CAAQP,KAAK;IACxC,CAAC;IACDE,CAAC,EAAE;EACL,CAAC,CACF;AAAA","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './getDataZoomConfig';
|
|
2
2
|
export * from './getGridConfig';
|
|
3
3
|
export * from './getGridLines';
|
|
4
|
+
export * from './getLabelsConfig';
|
|
4
5
|
export * from './getSeriesCandlestickConfig';
|
|
5
6
|
export * from './getSeriesHeatmapConfig';
|
|
6
7
|
export * from './getSeriesSentimentConfig';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/index.ts"],"sourcesContent":["export * from './getDataZoomConfig';\nexport * from './getGridConfig';\nexport * from './getGridLines';\nexport * from './getSeriesCandlestickConfig';\nexport * from './getSeriesHeatmapConfig';\nexport * from './getSeriesSentimentConfig';\nexport * from './getTooltipConfig';\nexport * from './getVisualMapConfig';\nexport * from './getXAxisConfig';\nexport * from './getYAxisConfig';\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,gBAAgB;AAC9B,cAAc,8BAA8B;AAC5C,cAAc,0BAA0B;AACxC,cAAc,4BAA4B;AAC1C,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartOptions/index.ts"],"sourcesContent":["export * from './getDataZoomConfig';\nexport * from './getGridConfig';\nexport * from './getGridLines';\nexport * from './getLabelsConfig';\nexport * from './getSeriesCandlestickConfig';\nexport * from './getSeriesHeatmapConfig';\nexport * from './getSeriesSentimentConfig';\nexport * from './getTooltipConfig';\nexport * from './getVisualMapConfig';\nexport * from './getXAxisConfig';\nexport * from './getYAxisConfig';\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,gBAAgB;AAC9B,cAAc,mBAAmB;AACjC,cAAc,8BAA8B;AAC5C,cAAc,0BAA0B;AACxC,cAAc,4BAA4B;AAC1C,cAAc,oBAAoB;AAClC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const formatXAxisAdditionalLabel = (value, isGreaterThanTwoWeeks) => {
|
|
2
|
+
const date = new Date(value);
|
|
3
|
+
if (isNaN(date.getTime())) {
|
|
4
|
+
return '';
|
|
5
|
+
}
|
|
6
|
+
return "".concat(date.toLocaleDateString(undefined, {
|
|
7
|
+
month: isGreaterThanTwoWeeks ? 'short' : 'long',
|
|
8
|
+
day: isGreaterThanTwoWeeks ? 'numeric' : undefined
|
|
9
|
+
}));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=formatXAxisAdditionalLabel.js.map
|
package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatXAxisAdditionalLabel.js","names":["formatXAxisAdditionalLabel","value","isGreaterThanTwoWeeks","date","Date","isNaN","getTime","concat","toLocaleDateString","undefined","month","day"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.ts"],"sourcesContent":["export const formatXAxisAdditionalLabel = (\n value: unknown,\n isGreaterThanTwoWeeks: boolean\n) => {\n const date = new Date(value as string);\n if (isNaN(date.getTime())) {\n return '';\n }\n return `${date.toLocaleDateString(undefined, {\n month: isGreaterThanTwoWeeks ? 'short' : 'long',\n day: isGreaterThanTwoWeeks ? 'numeric' : undefined,\n })}`;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,0BAA0B,GAAGA,CACxCC,KAAc,EACdC,qBAA8B,KAC3B;EACH,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAACH,KAAe,CAAC;EACtC,IAAII,KAAK,CAACF,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC,EAAE;IACzB,OAAO,EAAE;EACX;EACA,UAAAC,MAAA,CAAUJ,IAAI,CAACK,kBAAkB,CAACC,SAAS,EAAE;IAC3CC,KAAK,EAAER,qBAAqB,GAAG,OAAO,GAAG,MAAM;IAC/CS,GAAG,EAAET,qBAAqB,GAAG,SAAS,GAAGO;EAC3C,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CHART_CONFIG } from '../../../constants';
|
|
2
1
|
export const getLabelData = _ref => {
|
|
3
2
|
let {
|
|
4
3
|
dates,
|
|
@@ -12,24 +11,6 @@ export const getLabelData = _ref => {
|
|
|
12
11
|
const currentDate = new Date(record);
|
|
13
12
|
const previousDate = new Date(previousTimestamp);
|
|
14
13
|
return isGreaterThanTwoWeeks ? currentDate.getDate() !== previousDate.getDate() : currentDate.getMonth() !== previousDate.getMonth();
|
|
15
|
-
})
|
|
16
|
-
name: new Date(item).toLocaleDateString(undefined, {
|
|
17
|
-
month: isGreaterThanTwoWeeks ? 'short' : 'long',
|
|
18
|
-
day: isGreaterThanTwoWeeks ? 'numeric' : undefined
|
|
19
|
-
}),
|
|
20
|
-
xAxis: item,
|
|
21
|
-
y: CHART_CONFIG.MAIN_HEIGHT + CHART_CONFIG.X_LABEL_SIZE - 22,
|
|
22
|
-
silent: true,
|
|
23
|
-
emphasis: {
|
|
24
|
-
disabled: true
|
|
25
|
-
},
|
|
26
|
-
label: {
|
|
27
|
-
fontFamily: 'Sofia W03',
|
|
28
|
-
fontSize: 10,
|
|
29
|
-
position: 'bottom',
|
|
30
|
-
align: 'center',
|
|
31
|
-
formatter: '{b}'
|
|
32
|
-
}
|
|
33
|
-
}));
|
|
14
|
+
});
|
|
34
15
|
};
|
|
35
16
|
//# sourceMappingURL=getLabelData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLabelData.js","names":["
|
|
1
|
+
{"version":3,"file":"getLabelData.js","names":["getLabelData","_ref","dates","isGreaterThanTwoWeeks","filter","record","index","arr","previousTimestamp","currentDate","Date","previousDate","getDate","getMonth"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts"],"sourcesContent":["import type { GetLabelsDataProps } from '../types';\n\nexport const getLabelData = ({\n dates,\n isGreaterThanTwoWeeks,\n}: GetLabelsDataProps) =>\n dates.filter((record, index, arr) => {\n if (index === 0) {\n return false;\n }\n const previousTimestamp = arr[index - 1];\n const currentDate = new Date(record);\n const previousDate = new Date(previousTimestamp);\n\n return isGreaterThanTwoWeeks\n ? currentDate.getDate() !== previousDate.getDate()\n : currentDate.getMonth() !== previousDate.getMonth();\n });\n"],"mappings":"AAEA,OAAO,MAAMA,YAAY,GAAGC,IAAA;EAAA,IAAC;IAC3BC,KAAK;IACLC;EACkB,CAAC,GAAAF,IAAA;EAAA,OACnBC,KAAK,CAACE,MAAM,CAAC,CAACC,MAAM,EAAEC,KAAK,EAAEC,GAAG,KAAK;IACnC,IAAID,KAAK,KAAK,CAAC,EAAE;MACf,OAAO,KAAK;IACd;IACA,MAAME,iBAAiB,GAAGD,GAAG,CAACD,KAAK,GAAG,CAAC,CAAC;IACxC,MAAMG,WAAW,GAAG,IAAIC,IAAI,CAACL,MAAM,CAAC;IACpC,MAAMM,YAAY,GAAG,IAAID,IAAI,CAACF,iBAAiB,CAAC;IAEhD,OAAOL,qBAAqB,GACxBM,WAAW,CAACG,OAAO,CAAC,CAAC,KAAKD,YAAY,CAACC,OAAO,CAAC,CAAC,GAChDH,WAAW,CAACI,QAAQ,CAAC,CAAC,KAAKF,YAAY,CAACE,QAAQ,CAAC,CAAC;EACxD,CAAC,CAAC;AAAA","ignoreList":[]}
|