@oanda/labs-currency-power-balance-widget 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +2 -2
  3. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
  4. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +10 -5
  5. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
  6. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +2 -2
  7. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
  8. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +6 -11
  9. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
  10. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +2 -2
  11. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
  12. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +10 -5
  13. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
  14. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +2 -2
  15. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
  16. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +6 -11
  17. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
  18. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/constants.d.ts +1 -10
  19. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +1 -1
  20. package/package.json +3 -3
  21. package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +2 -2
  22. package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +21 -6
  23. package/src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx +3 -3
  24. package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +1 -1
  25. package/test/responsesMocks.ts +29 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,162 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.0.19 (2024-02-05)
7
+
8
+
9
+
10
+ ## 1.0.79 (2024-02-05)
11
+
12
+
13
+
14
+ ## 1.0.78 (2024-01-30)
15
+
16
+
17
+
18
+ ## 1.0.77 (2024-01-25)
19
+
20
+
21
+
22
+ ## 1.0.76 (2024-01-25)
23
+
24
+
25
+
26
+ ## 1.0.75 (2024-01-22)
27
+
28
+
29
+
30
+ ## 1.0.74 (2024-01-22)
31
+
32
+
33
+
34
+ ## 1.0.73 (2024-01-22)
35
+
36
+
37
+
38
+ ## 1.0.72 (2024-01-19)
39
+
40
+
41
+
42
+ ## 1.0.71 (2024-01-18)
43
+
44
+
45
+
46
+ ## 1.0.70 (2024-01-17)
47
+
48
+
49
+
50
+ ## 1.0.69 (2024-01-17)
51
+
52
+
53
+
54
+ ## 1.0.68 (2024-01-15)
55
+
56
+
57
+
58
+ ## 1.0.67 (2024-01-15)
59
+
60
+
61
+
62
+ ## 1.0.66 (2024-01-12)
63
+
64
+
65
+
66
+ ## 1.0.65 (2024-01-11)
67
+
68
+
69
+
70
+ ## 1.0.64 (2024-01-11)
71
+
72
+
73
+
74
+ ## 1.0.63 (2024-01-11)
75
+
76
+
77
+
78
+ ## 1.0.62 (2024-01-10)
79
+
80
+ **Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
81
+
82
+
83
+
84
+
85
+
86
+ ## 1.0.18 (2024-02-05)
87
+
88
+
89
+
90
+ ## 1.0.78 (2024-01-30)
91
+
92
+
93
+
94
+ ## 1.0.77 (2024-01-25)
95
+
96
+
97
+
98
+ ## 1.0.76 (2024-01-25)
99
+
100
+
101
+
102
+ ## 1.0.75 (2024-01-22)
103
+
104
+
105
+
106
+ ## 1.0.74 (2024-01-22)
107
+
108
+
109
+
110
+ ## 1.0.73 (2024-01-22)
111
+
112
+
113
+
114
+ ## 1.0.72 (2024-01-19)
115
+
116
+
117
+
118
+ ## 1.0.71 (2024-01-18)
119
+
120
+
121
+
122
+ ## 1.0.70 (2024-01-17)
123
+
124
+
125
+
126
+ ## 1.0.69 (2024-01-17)
127
+
128
+
129
+
130
+ ## 1.0.68 (2024-01-15)
131
+
132
+
133
+
134
+ ## 1.0.67 (2024-01-15)
135
+
136
+
137
+
138
+ ## 1.0.66 (2024-01-12)
139
+
140
+
141
+
142
+ ## 1.0.65 (2024-01-11)
143
+
144
+
145
+
146
+ ## 1.0.64 (2024-01-11)
147
+
148
+
149
+
150
+ ## 1.0.63 (2024-01-11)
151
+
152
+
153
+
154
+ ## 1.0.62 (2024-01-10)
155
+
156
+ **Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
157
+
158
+
159
+
160
+
161
+
6
162
  ## 1.0.17 (2024-01-30)
7
163
 
8
164
 
@@ -33,14 +33,14 @@ const ChartWithData = _ref => {
33
33
  const showChart = (data === null || data === void 0 ? void 0 : data.currencyPowerBalance) && (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) > 0;
34
34
  const showError = (data === null || data === void 0 || (_data$currencyPowerBa2 = data.currencyPowerBalance) === null || _data$currencyPowerBa2 === void 0 ? void 0 : _data$currencyPowerBa2.length) === 0 || error;
35
35
  return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
36
- className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
36
+ className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary lw-mb-[50px]"
37
37
  }, _react.default.createElement(_labsWidgetCommon.Spinner, {
38
38
  size: _labsWidgetCommon.SpinnerSize.lg
39
39
  })), !loading && showChart && _react.default.createElement(_Chart.Chart, {
40
40
  values: data === null || data === void 0 ? void 0 : data.currencyPowerBalance,
41
41
  timeUnit: timeUnit
42
42
  }), !loading && showError && _react.default.createElement("div", {
43
- className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
43
+ className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
44
44
  }, _react.default.createElement(_labsWidgetCommon.ChartError, null)), isDesktop && _react.default.createElement(_labsWidgetCommon.Tooltip, {
45
45
  id: _constants.CURRENCY_POWER_BALANCE_TOOLTIP_ID
46
46
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWithData.js","names":["_react","_interopRequireWildcard","require","_client","_labsWidgetCommon","_Chart","_constants","_getCurrencyPowerBalance","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","useContext","ThemeContext","loading","data","error","useQuery","getCurrencyPowerBalance","variables","fetchPolicy","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","Spinner","size","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, ThemeContext, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const { isDesktop } = useContext(ThemeContext);\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,wBAAA,GAAAL,OAAA;AAAyE,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,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","require","_client","_labsWidgetCommon","_Chart","_constants","_getCurrencyPowerBalance","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","useContext","ThemeContext","loading","data","error","useQuery","getCurrencyPowerBalance","variables","fetchPolicy","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","Spinner","size","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, ThemeContext, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const { isDesktop } = useContext(ThemeContext);\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary lw-mb-[50px]\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAGA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,wBAAA,GAAAL,OAAA;AAAyE,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,K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,CAAAc,OAAA,CAAAkC,aAAA,CAAC5C,iBAAA,CAAA+C,OAAO;IAACC,IAAI,EAAEC,6BAAW,CAACC;EAAG,CAAE,CAC7B,CACJ,EACA,CAACjB,OAAO,IAAIO,SAAS,IACpB5C,MAAA,CAAAc,OAAA,CAAAkC,aAAA,CAAC3C,MAAA,CAAAkD,KAAK;IAACC,MAAM,EAAElB,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEO,oBAAsB;IAACZ,QAAQ,EAAEA;EAAS,CAAE,CAClE,EACA,CAACI,OAAO,IAAIU,SAAS,IACpB/C,MAAA,CAAAc,OAAA,CAAAkC,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHlD,MAAA,CAAAc,OAAA,CAAAkC,aAAA,CAAC5C,iBAAA,CAAAqD,UAAU,MAAE,CACV,CACN,EACAvB,SAAS,IAAIlC,MAAA,CAAAc,OAAA,CAAAkC,aAAA,CAAC5C,iBAAA,CAAAsD,OAAO;IAACC,EAAE,EAAEC;EAAkC,CAAE,CAC/D,CAAC;AAEP,CAAC;AAACC,OAAA,CAAAhC,aAAA,GAAAA,aAAA"}
@@ -5,16 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Chart = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
9
- var _echarts = require("echarts");
8
+ var _core = _interopRequireDefault(require("echarts-for-react/lib/core"));
9
+ var echarts = _interopRequireWildcard(require("echarts/core"));
10
+ var _charts = require("echarts/charts");
11
+ var _renderers = require("echarts/renderers");
12
+ var _components = require("echarts/components");
10
13
  var _labsWidgetCommon = require("@oanda/labs-widget-common");
11
14
  var _constants = require("./options/constants");
12
15
  var _options = require("./options");
13
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
- (0, _echarts.registerTheme)('dark_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Dark));
17
- (0, _echarts.registerTheme)('light_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Light));
19
+ echarts.use([_components.GridSimpleComponent, _components.GraphicComponent, _components.TooltipComponent, _components.LegendPlainComponent, _charts.LineChart, _renderers.CanvasRenderer]);
20
+ echarts.registerTheme('dark_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Dark));
21
+ echarts.registerTheme('light_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Light));
18
22
  const Chart = _ref => {
19
23
  let {
20
24
  values,
@@ -32,7 +36,8 @@ const Chart = _ref => {
32
36
  echartInstance.setOption((0, _options.getResponsiveOption)(isDesktop, isMobile, isDark));
33
37
  }
34
38
  }, [echartRef, isDesktop, isMobile, isDark]);
35
- return _react.default.createElement(_echartsForReact.default, {
39
+ return _react.default.createElement(_core.default, {
40
+ echarts: echarts,
36
41
  ref: echartRef,
37
42
  theme: isDark ? 'dark_theme' : 'light_theme',
38
43
  style: {
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_echartsForReact","_interopRequireDefault","_echarts","_labsWidgetCommon","_constants","_options","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","isDark","isDesktop","isMobile","useContext","ThemeContext","echartRef","useRef","useEffect","current","echartInstance","getEchartsInstance","setOption","getResponsiveOption","createElement","ref","theme","style","height","concat","CHART_HEIGHT","width","option","getOption","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useContext } from 'react';\nimport ReactECharts from 'echarts-for-react';\nimport { registerTheme, EChartsType } from 'echarts';\nimport { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\nregisterTheme('dark_theme', getChartTheme(Theme.Dark));\nregisterTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit }: ChartProps) => {\n const { isDark, isDesktop, isMobile } = useContext(ThemeContext);\n const echartRef = useRef(null);\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactECharts\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption(values, timeUnit, isDark)}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAGA,IAAAM,QAAA,GAAAN,OAAA;AAA2D,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AY,EAAE,IAAAC,+BAAa,EAACC,uBAAK,CAACC,IAAI,CAAC,CAAC;AACtD,IAAAH,sBAAa,EAAC,aAAa,EAAE,IAAAC,+BAAa,EAACC,uBAAK,CAACE,KAAK,CAAC,CAAC;AAExD,MAAMC,KAAK,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC,MAAM;IAAEC;EAAqB,CAAC,GAAAF,IAAA;EAC7C,MAAM;IAAEG,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAG,IAAAC,iBAAU,EAACC,8BAAY,CAAC;EAChE,MAAMC,SAAS,GAAG,IAAAC,aAAM,EAAC,IAAI,CAAC;EAE9B,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIF,SAAS,CAACG,OAAO,EAAE;MAErB,MAAMC,cAAc,GAAGJ,SAAS,CAACG,OAAO,CAACE,kBAAkB,CAAC,CAAgB;MAE5ED,cAAc,CAACE,SAAS,CACtB,IAAAC,4BAAmB,EAACX,SAAS,EAAEC,QAAQ,EAAEF,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACK,SAAS,EAAEJ,SAAS,EAAEC,QAAQ,EAAEF,MAAM,CAAC,CAAC;EAE5C,OACExC,MAAA,CAAAW,OAAA,CAAA0C,aAAA,CAAClD,gBAAA,CAAAQ,OAAY;IACX2C,GAAG,EAAET,SAAU;IACfU,KAAK,EAAEf,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CgB,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKC,uBAAY,OAAI;MAC3BC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAE,IAAAC,kBAAS,EAACxB,MAAM,EAAEC,QAAQ,EAAEC,MAAM;EAAE,CAC7C,CAAC;AAEN,CAAC;AAACuB,OAAA,CAAA3B,KAAA,GAAAA,KAAA"}
1
+ {"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","echarts","_charts","_renderers","_components","_labsWidgetCommon","_constants","_options","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","use","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","LineChart","CanvasRenderer","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","isDark","isDesktop","isMobile","useContext","ThemeContext","echartRef","useRef","useEffect","current","echartInstance","getEchartsInstance","setOption","getResponsiveOption","createElement","ref","theme","style","height","concat","CHART_HEIGHT","width","option","getOption","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useContext } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { LineChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent,\n} from 'echarts/components';\nimport { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit }: ChartProps) => {\n const { isDark, isDesktop, isMobile } = useContext(ThemeContext);\n const echartRef = useRef(null);\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as echarts.EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n ref={echartRef}\n theme={isDark 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S,EAAEC,QAAQ,EAAEF,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACK,SAAS,EAAEJ,SAAS,EAAEC,QAAQ,EAAEF,MAAM,CAAC,CAAC;EAE5C,OACElD,MAAA,CAAAc,OAAA,CAAAiD,aAAA,CAAC5D,KAAA,CAAAW,OAAgB;IACfT,OAAO,EAAEA,OAAQ;IACjB2D,GAAG,EAAET,SAAU;IACfU,KAAK,EAAEf,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CgB,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKC,uBAAY,OAAI;MAC3BC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAE,IAAAC,kBAAS,EAACxB,MAAM,EAAEC,QAAQ,EAAEC,MAAM;EAAE,CAC7C,CAAC;AAEN,CAAC;AAACuB,OAAA,CAAA3B,KAAA,GAAAA,KAAA"}
@@ -15,12 +15,12 @@ const LEGEND_HEIGHT = exports.LEGEND_HEIGHT = 50;
15
15
  const LEGEND_HEIGHT_MOBILE = exports.LEGEND_HEIGHT_MOBILE = 70;
16
16
  const VERTICAL_LINE_COUNT = exports.VERTICAL_LINE_COUNT = 10;
17
17
  const COLOR_CONFIG = exports.COLOR_CONFIG = {
18
- AUD: _labsWidgetCommon.colorPalette.orange,
19
- JPY: _labsWidgetCommon.colorPalette.raspberryLight,
20
18
  USD: _labsWidgetCommon.colorPalette.greenLight,
21
19
  EUR: _labsWidgetCommon.colorPalette.turquoiseLight,
22
20
  GBP: _labsWidgetCommon.colorPalette.violetLight,
21
+ JPY: _labsWidgetCommon.colorPalette.raspberryLight,
23
22
  CHF: _labsWidgetCommon.colorPalette.bottleGreen75Lighter,
23
+ AUD: _labsWidgetCommon.colorPalette.orange,
24
24
  CAD: _labsWidgetCommon.colorPalette.midnight75Lighter,
25
25
  NZD: _labsWidgetCommon.colorPalette.gold
26
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["_labsWidgetCommon","require","X_LABEL_SIZE","exports","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","COLOR_CONFIG","AUD","colorPalette","orange","JPY","raspberryLight","USD","greenLight","EUR","turquoiseLight","GBP","violetLight","CHF","bottleGreen75Lighter","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nconst X_LABEL_SIZE = 90;\nconst X_LABEL_SIZE_MOBILE = 110;\nconst Y_LABEL_SIZE_MOBILE = 35;\nconst Y_LABEL_SIZE = 45;\nconst CHART_WIDTH = 9999;\nconst CHART_HEIGHT = 425;\nconst LEGEND_HEIGHT = 50;\nconst LEGEND_HEIGHT_MOBILE = 70;\nconst VERTICAL_LINE_COUNT = 10;\n\nconst COLOR_CONFIG = {\n AUD: colorPalette.orange,\n JPY: colorPalette.raspberryLight,\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n CHF: colorPalette.bottleGreen75Lighter,\n CAD: colorPalette.midnight75Lighter,\n NZD: colorPalette.gold,\n};\n\nconst TOOLTIP_LINE_COLOR_CONFIG = {\n DARK: colorPalette.orange,\n LIGHT: colorPalette.bottleGreenDark,\n};\n\nexport {\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n CHART_WIDTH,\n CHART_HEIGHT,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n VERTICAL_LINE_COUNT,\n COLOR_CONFIG,\n TOOLTIP_LINE_COLOR_CONFIG,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;A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LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","COLOR_CONFIG","USD","colorPalette","greenLight","EUR","turquoiseLight","GBP","violetLight","JPY","raspberryLight","CHF","bottleGreen75Lighter","AUD","orange","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nconst X_LABEL_SIZE = 90;\nconst X_LABEL_SIZE_MOBILE = 110;\nconst Y_LABEL_SIZE_MOBILE = 35;\nconst Y_LABEL_SIZE = 45;\nconst CHART_WIDTH = 9999;\nconst CHART_HEIGHT = 425;\nconst LEGEND_HEIGHT = 50;\nconst LEGEND_HEIGHT_MOBILE = 70;\nconst VERTICAL_LINE_COUNT = 10;\n\nconst COLOR_CONFIG: Record<string, string> = {\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n JPY: colorPalette.raspberryLight,\n CHF: colorPalette.bottleGreen75Lighter,\n AUD: colorPalette.orange,\n CAD: colorPalette.midnight75Lighter,\n NZD: colorPalette.gold,\n};\n\nconst TOOLTIP_LINE_COLOR_CONFIG = {\n DARK: colorPalette.orange,\n LIGHT: colorPalette.bottleGreenDark,\n};\n\nexport {\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n CHART_WIDTH,\n CHART_HEIGHT,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n VERTICAL_LINE_COUNT,\n COLOR_CONFIG,\n TOOLTIP_LINE_COLOR_CONFIG,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,EAAE;AACvB,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,GAAG;AAC/B,MAAMC,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,GAAG,EAAE;AAC9B,MAAMC,YAAY,GAAAH,OAAA,CAAAG,YAAA,GAAG,EAAE;AACvB,MAAMC,WAAW,GAAAJ,OAAA,CAAAI,WAAA,GAAG,IAAI;AACxB,MAAMC,YAAY,GAAAL,OAAA,CAAAK,YAAA,GAAG,GAAG;AACxB,MAAMC,aAAa,GAAAN,OAAA,CAAAM,aAAA,GAAG,EAAE;AACxB,MAAMC,oBAAoB,GAAAP,OAAA,CAAAO,oBAAA,GAAG,EAAE;AAC/B,MAAMC,mBAAmB,GAAAR,OAAA,CAAAQ,mBAAA,GAAG,EAAE;AAE9B,MAAMC,YAAoC,GAAAT,OAAA,CAAAS,YAAA,GAAG;EAC3CC,GAAG,EAAEC,8BAAY,CAACC,UAAU;EAC5BC,GAAG,EAAEF,8BAAY,CAACG,cAAc;EAChCC,GAAG,EAAEJ,8BAAY,CAACK,WAAW;EAC7BC,GAAG,EAAEN,8BAAY,CAACO,cAAc;EAChCC,GAAG,EAAER,8BAAY,CAACS,oBAAoB;EACtCC,GAAG,EAAEV,8BAAY,CAACW,MAAM;EACxBC,GAAG,EAAEZ,8BAAY,CAACa,iBAAiB;EACnCC,GAAG,EAAEd,8BAAY,CAACe;AACpB,CAAC;AAED,MAAMC,yBAAyB,GAAA3B,OAAA,CAAA2B,yBAAA,GAAG;EAChCC,IAAI,EAAEjB,8BAAY,CAACW,MAAM;EACzBO,KAAK,EAAElB,8BAAY,CAACmB;AACtB,CAAC"}
@@ -32,17 +32,12 @@ const getOption = (values, timeUnit, isDark) => {
32
32
  })
33
33
  };
34
34
  });
35
- const legendData = values.map(_ref3 => {
36
- let {
37
- currency
38
- } = _ref3;
39
- return {
40
- name: currency,
41
- itemStyle: {
42
- color: _constants.COLOR_CONFIG[currency]
43
- }
44
- };
45
- });
35
+ const legendData = Object.keys(_constants.COLOR_CONFIG).map(currency => ({
36
+ name: currency,
37
+ itemStyle: {
38
+ color: _constants.COLOR_CONFIG[currency]
39
+ }
40
+ }));
46
41
  return {
47
42
  animation: false,
48
43
  legend: {
@@ -1 +1 @@
1
- {"version":3,"file":"getOption.js","names":["_constants","require","_formatters","getOption","values","timeUnit","isDark","seriesData","map","_ref","currency","power","name","type","symbol","showSymbol","itemStyle","color","COLOR_CONFIG","lineStyle","data","_ref2","point","price","legendData","_ref3","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","formatter","tooltipFormatter","extraCssText","xAxis","axisTick","show","axisLine","splitLine","axisLabel","margin","showMinLabel","rotate","interval","Math","round","length","VERTICAL_LINE_COUNT","label","xAxisLabelFormatter","yAxis","position","splitNumber","boundaryGap","showMaxLabel","series","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT } from './constants';\nimport { tooltipFormatter, xAxisLabelFormatter } from './formatters';\nimport { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\n\nconst getOption = (\n values: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n) => {\n const seriesData = values.map(({ currency, power }) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n lineStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n }));\n\n const legendData = values.map(({ currency }) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n\n return {\n animation: false,\n legend: {\n data: legendData,\n bottom: 10,\n icon: 'circle',\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'x',\n z: 0,\n lineStyle: {\n color: isDark ? TOOLTIP_LINE_COLOR_CONFIG.DARK : TOOLTIP_LINE_COLOR_CONFIG.LIGHT,\n },\n },\n formatter: tooltipFormatter,\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n axisTick: {\n show: false,\n },\n axisLine: { show: false },\n splitLine: {\n show: true,\n },\n axisLabel: {\n margin: 10,\n showMinLabel: false,\n rotate: -45,\n interval: Math.round(seriesData[0].data.length / VERTICAL_LINE_COUNT),\n formatter: (label: string) => xAxisLabelFormatter(label, timeUnit),\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n splitNumber: 5,\n axisLine: { show: false },\n axisTick: { show: false },\n boundaryGap: ['10%', '10%'],\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n },\n },\n series: seriesData,\n };\n};\n\nexport { getOption };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA,MAAME,SAAS,GAAGA,CAChBC,MAA8B,EAC9BC,QAAsC,EACtCC,MAAe,KACZ;EACH,MAAMC,UAAU,GAAGH,MAAM,CAACI,GAAG,CAACC,IAAA;IAAA,IAAC;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAAF,IAAA;IAAA,OAAM;MACtDG,IAAI,EAAEF,QAAQ;MACdG,IAAI,EAAE,MAAM;MACZC,MAAM,EAAE,QAAQ;MAChBC,UAAU,EAAE,KAAK;MACjBC,SAAS,EAAE;QACTC,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B,CAAC;MACDS,SAAS,EAAE;QACTF,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B,CAAC;MACDU,IAAI,EAAET,KAAK,CAACH,GAAG,CAACa,KAAA;QAAA,IAAC;UAAEC,KAAK;UAAEC;QAAM,CAAC,GAAAF,KAAA;QAAA,OAAK,CAACC,KAAK,EAAEC,KAAK,CAAC;MAAA;IACtD,CAAC;EAAA,CAAC,CAAC;EAEH,MAAMC,UAAU,GAAGpB,MAAM,CAACI,GAAG,CAACiB,KA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E;MAAM,CAAC;MACzBD,QAAQ,EAAE;QAAEC,IAAI,EAAE;MAAM,CAAC;MACzBiB,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3Bd,SAAS,EAAE;QACTe,YAAY,EAAE,KAAK;QACnBb,YAAY,EAAE;MAChB;IACF,CAAC;IACDc,MAAM,EAAEvD;EACV,CAAC;AACH,CAAC;AAACwD,OAAA,CAAA5D,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"file":"getOption.js","names":["_constants","require","_formatters","getOption","values","timeUnit","isDark","seriesData","map","_ref","currency","power","name","type","symbol","showSymbol","itemStyle","color","COLOR_CONFIG","lineStyle","data","_ref2","point","price","legendData","Object","keys","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","formatter","tooltipFormatter","extraCssText","xAxis","axisTick","show","axisLine","splitLine","axisLabel","margin","showMinLabel","rotate","interval","Math","round","length","VERTICAL_LINE_COUNT","label","xAxisLabelFormatter","yAxis","position","splitNumber","boundaryGap","showMaxLabel","series","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT } from './constants';\nimport { tooltipFormatter, xAxisLabelFormatter } from './formatters';\nimport { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\n\nconst getOption = (\n values: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n) => {\n const seriesData = values.map(({ currency, power }) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n lineStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n }));\n\n const legendData = Object.keys(COLOR_CONFIG).map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n\n return {\n animation: false,\n legend: {\n data: legendData,\n bottom: 10,\n icon: 'circle',\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'x',\n z: 0,\n lineStyle: {\n color: isDark ? TOOLTIP_LINE_COLOR_CONFIG.DARK : TOOLTIP_LINE_COLOR_CONFIG.LIGHT,\n },\n },\n formatter: tooltipFormatter,\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n axisTick: {\n show: false,\n },\n axisLine: { show: false },\n splitLine: {\n show: true,\n },\n axisLabel: {\n margin: 10,\n showMinLabel: false,\n rotate: -45,\n interval: Math.round(seriesData[0].data.length / VERTICAL_LINE_COUNT),\n formatter: (label: string) => xAxisLabelFormatter(label, timeUnit),\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n splitNumber: 5,\n axisLine: { show: false },\n axisTick: { show: false },\n boundaryGap: ['10%', '10%'],\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n },\n },\n series: seriesData,\n };\n};\n\nexport { getOption };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA,MAAME,SAAS,GAAGA,CAChBC,MAA8B,EAC9BC,QAAsC,EACtCC,MAAe,KACZ;EACH,MAAMC,UAAU,GAAGH,MAAM,CAACI,GAAG,CAACC,IAAA;IAAA,IAAC;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAAF,IAAA;IAAA,OAAM;MACtDG,IAAI,EAAEF,QAAQ;MACdG,IAAI,EAAE,MAAM;MACZC,MAAM,EAAE,QAAQ;MAChBC,UAAU,EAAE,KAAK;MACjBC,SAAS,EAAE;QACTC,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B,CAAC;MACDS,SAAS,EAAE;QACTF,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B,CAAC;MACDU,IAAI,EAAET,KAAK,CAACH,GAAG,CAACa,KAA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,KAAK,EAAEnD,QAAQ;MACnE;IACF,CAAC;IACDqD,KAAK,EAAE;MACL7C,IAAI,EAAE,OAAO;MACb8C,QAAQ,EAAE,OAAO;MACjBC,WAAW,EAAE,CAAC;MACdf,QAAQ,EAAE;QAAED,IAAI,EAAE;MAAM,CAAC;MACzBD,QAAQ,EAAE;QAAEC,IAAI,EAAE;MAAM,CAAC;MACzBiB,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3Bd,SAAS,EAAE;QACTe,YAAY,EAAE,KAAK;QACnBb,YAAY,EAAE;MAChB;IACF,CAAC;IACDc,MAAM,EAAExD;EACV,CAAC;AACH,CAAC;AAACyD,OAAA,CAAA7D,SAAA,GAAAA,SAAA"}
@@ -25,14 +25,14 @@ const ChartWithData = _ref => {
25
25
  const showChart = (data === null || data === void 0 ? void 0 : data.currencyPowerBalance) && (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) > 0;
26
26
  const showError = (data === null || data === void 0 || (_data$currencyPowerBa2 = data.currencyPowerBalance) === null || _data$currencyPowerBa2 === void 0 ? void 0 : _data$currencyPowerBa2.length) === 0 || error;
27
27
  return React.createElement(React.Fragment, null, loading && React.createElement("div", {
28
- className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
28
+ className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary lw-mb-[50px]"
29
29
  }, React.createElement(Spinner, {
30
30
  size: SpinnerSize.lg
31
31
  })), !loading && showChart && React.createElement(Chart, {
32
32
  values: data === null || data === void 0 ? void 0 : data.currencyPowerBalance,
33
33
  timeUnit: timeUnit
34
34
  }), !loading && showError && React.createElement("div", {
35
- className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
35
+ className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
36
36
  }, React.createElement(ChartError, null)), isDesktop && React.createElement(Tooltip, {
37
37
  id: CURRENCY_POWER_BALANCE_TOOLTIP_ID
38
38
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWithData.js","names":["React","useContext","useQuery","ChartError","Spinner","SpinnerSize","ThemeContext","Tooltip","Chart","CURRENCY_POWER_BALANCE_TOOLTIP_ID","getCurrencyPowerBalance","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","loading","data","error","variables","fetchPolicy","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","size","lg","values","id"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, ThemeContext, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const { isDesktop } = useContext(ThemeContext);\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,EAAEC,YAAY,EAAEC,OAAO,QAClD,2BAA2B;AAClC,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,iCAAiC,QAAQ,aAAa;AAC/D,SAASC,uBAAuB,QAAQ,gCAAgC;AAIxE,MAAMC,aAAa,GAAGC,IAAA,IAAsC;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAArC;IAAEC;EAA6B,CAAC,GAAAH,IAAA;EACrD,MAAM;IAAEI;EAAU,CAAC,GAAGf,UAAU,CAACK,YAAY,CAAC;EAC9C,MAAM;IAAEW,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGjB,QAAQ,CAGvCQ,uBAAuB,EAAE;IACzBU,SAAS,EAAE;MACTL;IACF,CAAC;IACDM,WAAW,EAAE;EACf,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAG,CAAAJ,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEK,oBAAoB,KAAI,CAAAL,IAAI,aAAJA,IAAI,gBAAAL,qBAAA,GAAJK,IAAI,CAAEK,oBAAoB,cAAAV,qBAAA,uBAA1BA,qBAAA,CAA4BW,MAAM,IAAG,CAAC;EACtF,MAAMC,SAAS,GAAG,CAAAP,IAAI,aAAJA,IAAI,gBAAAJ,sBAAA,GAAJI,IAAI,CAAEK,oBAAoB,cAAAT,sBAAA,uBAA1BA,sBAAA,CAA4BU,MAAM,MAAK,CAAC,IAAIL,KAAK;EAEnE,OACEnB,KAAA,CAAA0B,aAAA,CAAA1B,KAAA,CAAA2B,QAAA,QACGV,OAAO,IAERjB,KAAA,CAAA0B,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH5B,KAAA,CAAA0B,aAAA,CAACtB,OAAO;IAACyB,IAAI,EAAExB,WAAW,CAACyB;EAAG,CAAE,CAC7B,CACJ,EACA,CAACb,OAAO,IAAIK,SAAS,IACpBtB,KAAA,CAAA0B,aAAA,CAAClB,KAAK;IAACuB,MAAM,EAAEb,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEK,oBAAsB;IAACR,QAAQ,EAAEA;EAAS,CAAE,CAClE,EACA,CAACE,OAAO,IAAIQ,SAAS,IACpBzB,KAAA,CAAA0B,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChH5B,KAAA,CAAA0B,aAAA,CAACvB,UAAU,MAAE,CACV,CACN,EACAa,SAAS,IAAIhB,KAAA,CAAA0B,aAAA,CAACnB,OAAO;IAACyB,EAAE,EAAEvB;EAAkC,CAAE,CAC/D,CAAC;AAEP,CAAC;AAED,SAASE,aAAa"}
1
+ {"version":3,"file":"ChartWithData.js","names":["React","useContext","useQuery","ChartError","Spinner","SpinnerSize","ThemeContext","Tooltip","Chart","CURRENCY_POWER_BALANCE_TOOLTIP_ID","getCurrencyPowerBalance","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","loading","data","error","variables","fetchPolicy","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","size","lg","values","id"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, ThemeContext, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const { isDesktop } = useContext(ThemeContext);\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary lw-mb-[50px]\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EAAEC,OAAO,EAAEC,WAAW,EAAEC,YAAY,EAAEC,OAAO,QAClD,2BAA2B;AAClC,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,iCAAiC,QAAQ,aAAa;AAC/D,SAASC,uBAAuB,QAAQ,gCAAgC;AAIxE,MAAMC,aAAa,GAAGC,IAAA,IAAsC;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAArC;IAAEC;EAA6B,CAAC,GAAAH,IAAA;EACrD,MAAM;IAAEI;EAAU,CAAC,GAAGf,UAAU,CAACK,YAAY,CAAC;EAC9C,MAAM;IAAEW,OAA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+1,15 @@
1
1
  import React, { useRef, useEffect, useContext } from 'react';
2
- import ReactECharts from 'echarts-for-react';
3
- import { registerTheme } from 'echarts';
2
+ import ReactEChartsCore from 'echarts-for-react/lib/core';
3
+ import * as echarts from 'echarts/core';
4
+ import { LineChart } from 'echarts/charts';
5
+ import { CanvasRenderer } from 'echarts/renderers';
6
+ import { GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent } from 'echarts/components';
4
7
  import { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';
5
8
  import { CHART_HEIGHT } from './options/constants';
6
9
  import { getResponsiveOption, getOption } from './options';
7
- registerTheme('dark_theme', getChartTheme(Theme.Dark));
8
- registerTheme('light_theme', getChartTheme(Theme.Light));
10
+ echarts.use([GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent, LineChart, CanvasRenderer]);
11
+ echarts.registerTheme('dark_theme', getChartTheme(Theme.Dark));
12
+ echarts.registerTheme('light_theme', getChartTheme(Theme.Light));
9
13
  const Chart = _ref => {
10
14
  let {
11
15
  values,
@@ -23,7 +27,8 @@ const Chart = _ref => {
23
27
  echartInstance.setOption(getResponsiveOption(isDesktop, isMobile, isDark));
24
28
  }
25
29
  }, [echartRef, isDesktop, isMobile, isDark]);
26
- return React.createElement(ReactECharts, {
30
+ return React.createElement(ReactEChartsCore, {
31
+ echarts: echarts,
27
32
  ref: echartRef,
28
33
  theme: isDark ? 'dark_theme' : 'light_theme',
29
34
  style: {
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.js","names":["React","useRef","useEffect","useContext","ReactECharts","registerTheme","Theme","ThemeContext","getChartTheme","CHART_HEIGHT","getResponsiveOption","getOption","Dark","Light","Chart","_ref","values","timeUnit","isDark","isDesktop","isMobile","echartRef","current","echartInstance","getEchartsInstance","setOption","createElement","ref","theme","style","height","concat","width","option"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useContext } from 'react';\nimport ReactECharts from 'echarts-for-react';\nimport { registerTheme, EChartsType } from 'echarts';\nimport { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\nregisterTheme('dark_theme', getChartTheme(Theme.Dark));\nregisterTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit }: ChartProps) => {\n const { isDark, isDesktop, isMobile } = useContext(ThemeContext);\n const echartRef = useRef(null);\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactECharts\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption(values, timeUnit, isDark)}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,SAAS,EAAEC,UAAU,QAAQ,OAAO;AAC5D,OAAOC,YAAY,MAAM,mBAAmB;AAC5C,SAASC,aAAa,QAAqB,SAAS;AACpD,SAASC,KAAK,EAAEC,YAAY,EAAEC,aAAa,QAAQ,2BAA2B;AAC9E,SACEC,YAAY,QACP,qBAAqB;AAC5B,SAASC,mBAAmB,EAAEC,SAAS,QAAQ,WAAW;AAG1DN,aAAa,CAAC,YAAY,EAAEG,aAAa,CAACF,KAAK,CAACM,IAAI,CAAC,CAAC;AACtDP,aAAa,CAAC,aAAa,EAAEG,aAAa,CAACF,KAAK,CAACO,KAAK,CAAC,CAAC;AAExD,MAAMC,KAAK,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC,MAAM;IAAEC;EAAqB,CAAC,GAAAF,IAAA;EAC7C,MAAM;IAAEG,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAGjB,UAAU,CAACI,YAAY,CAAC;EAChE,MAAMc,SAAS,GAAGpB,MAAM,CAAC,IAAI,CAAC;EAE9BC,SAAS,CAAC,MAAM;IACd,IAAImB,SAAS,CAACC,OAAO,EAAE;MAErB,MAAMC,cAAc,GAAGF,SAAS,CAACC,OAAO,CAACE,kBAAkB,CAAC,CAAgB;MAE5ED,cAAc,CAACE,SAAS,CACtBf,mBAAmB,CAACS,SAAS,EAAEC,QAAQ,EAAEF,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACG,SAAS,EAAEF,SAAS,EAAEC,QAAQ,EAAEF,MAAM,CAAC,CAAC;EAE5C,OACElB,KAAA,CAAA0B,aAAA,CAACtB,YAAY;IACXuB,GAAG,EAAEN,SAAU;IACfO,KAAK,EAAEV,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CW,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKtB,YAAY,OAAI;MAC3BuB,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAEtB,SAAS,CAACK,MAAM,EAAEC,QAAQ,EAAEC,MAAM;EAAE,CAC7C,CAAC;AAEN,CAAC;AAED,SAASJ,KAAK"}
1
+ {"version":3,"file":"Chart.js","names":["React","useRef","useEffect","useContext","ReactEChartsCore","echarts","LineChart","CanvasRenderer","GridSimpleComponent","GraphicComponent","TooltipComponent","LegendPlainComponent","Theme","ThemeContext","getChartTheme","CHART_HEIGHT","getResponsiveOption","getOption","use","registerTheme","Dark","Light","Chart","_ref","values","timeUnit","isDark","isDesktop","isMobile","echartRef","current","echartInstance","getEchartsInstance","setOption","createElement","ref","theme","style","height","concat","width","option"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useContext } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { LineChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent,\n} from 'echarts/components';\nimport { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit }: ChartProps) => {\n const { isDark, isDesktop, isMobile } = useContext(ThemeContext);\n const echartRef = useRef(null);\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as echarts.EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption(values, timeUnit, isDark)}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,SAAS,EAAEC,UAAU,QAAQ,OAAO;AAC5D,OAAOC,gBAAgB,MAAM,4BAA4B;AACzD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SACEC,mBAAmB,EAAEC,gBAAgB,EAAEC,gBAAgB,EAAEC,oBAAoB,QACxE,oBAAoB;AAC3B,SAASC,KAAK,EAAEC,YAAY,EAAEC,aAAa,QAAQ,2BAA2B;AAC9E,SACEC,YAAY,QACP,qBAAqB;AAC5B,SAASC,mBAA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AAC;AAEN,CAAC;AAED,SAASJ,KAAK"}
@@ -9,12 +9,12 @@ const LEGEND_HEIGHT = 50;
9
9
  const LEGEND_HEIGHT_MOBILE = 70;
10
10
  const VERTICAL_LINE_COUNT = 10;
11
11
  const COLOR_CONFIG = {
12
- AUD: colorPalette.orange,
13
- JPY: colorPalette.raspberryLight,
14
12
  USD: colorPalette.greenLight,
15
13
  EUR: colorPalette.turquoiseLight,
16
14
  GBP: colorPalette.violetLight,
15
+ JPY: colorPalette.raspberryLight,
17
16
  CHF: colorPalette.bottleGreen75Lighter,
17
+ AUD: colorPalette.orange,
18
18
  CAD: colorPalette.midnight75Lighter,
19
19
  NZD: colorPalette.gold
20
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["colorPalette","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","COLOR_CONFIG","AUD","orange","JPY","raspberryLight","USD","greenLight","EUR","turquoiseLight","GBP","violetLight","CHF","bottleGreen75Lighter","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nconst X_LABEL_SIZE = 90;\nconst X_LABEL_SIZE_MOBILE = 110;\nconst Y_LABEL_SIZE_MOBILE = 35;\nconst Y_LABEL_SIZE = 45;\nconst CHART_WIDTH = 9999;\nconst CHART_HEIGHT = 425;\nconst LEGEND_HEIGHT = 50;\nconst LEGEND_HEIGHT_MOBILE = 70;\nconst VERTICAL_LINE_COUNT = 10;\n\nconst COLOR_CONFIG = {\n AUD: colorPalette.orange,\n JPY: colorPalette.raspberryLight,\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n CHF: colorPalette.bottleGreen75Lighter,\n CAD: colorPalette.midnight75Lighter,\n NZD: colorPalette.gold,\n};\n\nconst TOOLTIP_LINE_COLOR_CONFIG = {\n DARK: colorPalette.orange,\n LIGHT: colorPalette.bottleGreenDark,\n};\n\nexport {\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n CHART_WIDTH,\n CHART_HEIGHT,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n VERTICAL_LINE_COUNT,\n COLOR_CONFIG,\n TOOLTIP_LINE_COLOR_CONFIG,\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAExD,MAAMC,YAAY,GAAG,EAAE;AACvB,MAAMC,mBAAmB,GAAG,GAAG;AAC/B,MAAMC,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,YAAY,GAAG,EAAE;AACvB,MAAMC,WAAW,GAAG,IAAI;AACxB,MAAMC,YAAY,GAAG,GAAG;AACxB,MAAMC,aAAa,GAAG,EAAE;AACxB,MAAMC,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,mBAAmB,GAAG,EAAE;AAE9B,MAAMC,YAAY,GAAG;EACnBC,GAAG,EAAEX,YAAY,CAACY,MAAM;EACxBC,GAAG,EAAEb,YAAY,CAACc,cAAc;EAChCC,GAAG,EAAEf,YAAY,CAACgB,UAAU;EAC5BC,GAAG,EAAEjB,YAAY,CAACkB,cAAc;EAChCC,GAAG,EAAEnB,YAAY,CAACoB,WAAW;EAC7BC,GAAG,EAAErB,YAAY,CAACsB,oBAAoB;EACtCC,GAAG,EAAEvB,YAAY,CAACwB,iBAAiB;EACnCC,GAAG,EAAEzB,YAAY,CAAC0B;AACpB,CAAC;AAED,MAAMC,yBAAyB,GAAG;EAChCC,IAAI,EAAE5B,YAAY,CAACY,MAAM;EACzBiB,KAAK,EAAE7B,YAAY,CAAC8B;AACtB,CAAC;AAED,SACE7B,YAAY,EACZC,mBAAmB,EACnBC,mBAAmB,EACnBC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,oBAAoB,EACpBC,mBAAmB,EACnBC,YAAY,EACZiB,yBAAyB"}
1
+ {"version":3,"file":"constants.js","names":["colorPalette","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","COLOR_CONFIG","USD","greenLight","EUR","turquoiseLight","GBP","violetLight","JPY","raspberryLight","CHF","bottleGreen75Lighter","AUD","orange","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nconst X_LABEL_SIZE = 90;\nconst X_LABEL_SIZE_MOBILE = 110;\nconst Y_LABEL_SIZE_MOBILE = 35;\nconst Y_LABEL_SIZE = 45;\nconst CHART_WIDTH = 9999;\nconst CHART_HEIGHT = 425;\nconst LEGEND_HEIGHT = 50;\nconst LEGEND_HEIGHT_MOBILE = 70;\nconst VERTICAL_LINE_COUNT = 10;\n\nconst COLOR_CONFIG: Record<string, string> = {\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n JPY: colorPalette.raspberryLight,\n CHF: colorPalette.bottleGreen75Lighter,\n AUD: colorPalette.orange,\n CAD: colorPalette.midnight75Lighter,\n NZD: colorPalette.gold,\n};\n\nconst TOOLTIP_LINE_COLOR_CONFIG = {\n DARK: colorPalette.orange,\n LIGHT: colorPalette.bottleGreenDark,\n};\n\nexport {\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n CHART_WIDTH,\n CHART_HEIGHT,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n VERTICAL_LINE_COUNT,\n COLOR_CONFIG,\n TOOLTIP_LINE_COLOR_CONFIG,\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAExD,MAAMC,YAAY,GAAG,EAAE;AACvB,MAAMC,mBAAmB,GAAG,GAAG;AAC/B,MAAMC,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,YAAY,GAAG,EAAE;AACvB,MAAMC,WAAW,GAAG,IAAI;AACxB,MAAMC,YAAY,GAAG,GAAG;AACxB,MAAMC,aAAa,GAAG,EAAE;AACxB,MAAMC,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,mBAAmB,GAAG,EAAE;AAE9B,MAAMC,YAAoC,GAAG;EAC3CC,GAAG,EAAEX,YAAY,CAACY,UAAU;EAC5BC,GAAG,EAAEb,YAAY,CAACc,cAAc;EAChCC,GAAG,EAAEf,YAAY,CAACgB,WAAW;EAC7BC,GAAG,EAAEjB,YAAY,CAACkB,cAAc;EAChCC,GAAG,EAAEnB,YAAY,CAACoB,oBAAoB;EACtCC,GAAG,EAAErB,YAAY,CAACsB,MAAM;EACxBC,GAAG,EAAEvB,YAAY,CAACwB,iBAAiB;EACnCC,GAAG,EAAEzB,YAAY,CAAC0B;AACpB,CAAC;AAED,MAAMC,yBAAyB,GAAG;EAChCC,IAAI,EAAE5B,YAAY,CAACsB,MAAM;EACzBO,KAAK,EAAE7B,YAAY,CAAC8B;AACtB,CAAC;AAED,SACE7B,YAAY,EACZC,mBAAmB,EACnBC,mBAAmB,EACnBC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,oBAAoB,EACpBC,mBAAmB,EACnBC,YAAY,EACZiB,yBAAyB"}
@@ -26,17 +26,12 @@ const getOption = (values, timeUnit, isDark) => {
26
26
  })
27
27
  };
28
28
  });
29
- const legendData = values.map(_ref3 => {
30
- let {
31
- currency
32
- } = _ref3;
33
- return {
34
- name: currency,
35
- itemStyle: {
36
- color: COLOR_CONFIG[currency]
37
- }
38
- };
39
- });
29
+ const legendData = Object.keys(COLOR_CONFIG).map(currency => ({
30
+ name: currency,
31
+ itemStyle: {
32
+ color: COLOR_CONFIG[currency]
33
+ }
34
+ }));
40
35
  return {
41
36
  animation: false,
42
37
  legend: {
@@ -1 +1 @@
1
- {"version":3,"file":"getOption.js","names":["COLOR_CONFIG","TOOLTIP_LINE_COLOR_CONFIG","VERTICAL_LINE_COUNT","tooltipFormatter","xAxisLabelFormatter","getOption","values","timeUnit","isDark","seriesData","map","_ref","currency","power","name","type","symbol","showSymbol","itemStyle","color","lineStyle","data","_ref2","point","price","legendData","_ref3","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","DARK","LIGHT","formatter","extraCssText","xAxis","axisTick","show","axisLine","splitLine","axisLabel","margin","showMinLabel","rotate","interval","Math","round","length","label","yAxis","position","splitNumber","boundaryGap","showMaxLabel","series"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT } from './constants';\nimport { tooltipFormatter, xAxisLabelFormatter } from './formatters';\nimport { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\n\nconst getOption = (\n values: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n) => {\n const seriesData = values.map(({ currency, power }) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n lineStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n }));\n\n const legendData = values.map(({ currency }) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n\n return {\n animation: false,\n legend: {\n data: legendData,\n bottom: 10,\n icon: 'circle',\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'x',\n z: 0,\n lineStyle: {\n color: isDark ? TOOLTIP_LINE_COLOR_CONFIG.DARK : TOOLTIP_LINE_COLOR_CONFIG.LIGHT,\n },\n },\n formatter: tooltipFormatter,\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n axisTick: {\n show: false,\n },\n axisLine: { show: false },\n splitLine: {\n show: true,\n },\n axisLabel: {\n margin: 10,\n showMinLabel: false,\n rotate: -45,\n interval: Math.round(seriesData[0].data.length / VERTICAL_LINE_COUNT),\n formatter: (label: string) => xAxisLabelFormatter(label, timeUnit),\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n splitNumber: 5,\n axisLine: { show: false },\n axisTick: { show: false },\n boundaryGap: ['10%', '10%'],\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n },\n },\n series: seriesData,\n };\n};\n\nexport { getOption };\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,yBAAyB,EAAEC,mBAAmB,QAAQ,aAAa;AAC1F,SAASC,gBAAgB,EAAEC,mBAAmB,QAAQ,cAAc;AAGpE,MAAMC,SAAS,GAAGA,CAChBC,MAA8B,EAC9BC,QAAsC,EACtCC,MAAe,KACZ;EACH,MAAMC,UAAU,GAAGH,MAAM,CAACI,GAAG,CAACC,IAAA;IAAA,IAAC;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAAF,IAAA;IAAA,OAAM;MACtDG,IAAI,EAAEF,QAAQ;MACdG,IAAI,EAAE,MAAM;MACZC,MAAM,EAAE,QAAQ;MAChBC,UAAU,EAAE,KAAK;MACjBC,SAAS,EAAE;QACTC,KAAK,EAAEnB,YAAY,CAACY,QAAQ;MAC9B,CAAC;MACDQ,SAAS,EAAE;QACTD,KAAK,EAAEnB,YAAY,CAACY,QAAQ;MAC9B,CAAC;MACDS,IAAI,EAAER,KAAK,CAACH,GAAG,CAACY,KAAA;QAAA,IAAC;U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AmB,CAACiD,KAAK,EAAE9C,QAAQ;MACnE;IACF,CAAC;IACD+C,KAAK,EAAE;MACLvC,IAAI,EAAE,OAAO;MACbwC,QAAQ,EAAE,OAAO;MACjBC,WAAW,EAAE,CAAC;MACdb,QAAQ,EAAE;QAAED,IAAI,EAAE;MAAM,CAAC;MACzBD,QAAQ,EAAE;QAAEC,IAAI,EAAE;MAAM,CAAC;MACzBe,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3BZ,SAAS,EAAE;QACTa,YAAY,EAAE,KAAK;QACnBX,YAAY,EAAE;MAChB;IACF,CAAC;IACDY,MAAM,EAAElD;EACV,CAAC;AACH,CAAC;AAED,SAASJ,SAAS"}
1
+ {"version":3,"file":"getOption.js","names":["COLOR_CONFIG","TOOLTIP_LINE_COLOR_CONFIG","VERTICAL_LINE_COUNT","tooltipFormatter","xAxisLabelFormatter","getOption","values","timeUnit","isDark","seriesData","map","_ref","currency","power","name","type","symbol","showSymbol","itemStyle","color","lineStyle","data","_ref2","point","price","legendData","Object","keys","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","DARK","LIGHT","formatter","extraCssText","xAxis","axisTick","show","axisLine","splitLine","axisLabel","margin","showMinLabel","rotate","interval","Math","round","length","label","yAxis","position","splitNumber","boundaryGap","showMaxLabel","series"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT } from './constants';\nimport { tooltipFormatter, xAxisLabelFormatter } from './formatters';\nimport { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\n\nconst getOption = (\n values: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n) => {\n const seriesData = values.map(({ currency, power }) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n lineStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n }));\n\n const legendData = Object.keys(COLOR_CONFIG).map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n\n return {\n animation: false,\n legend: {\n data: legendData,\n bottom: 10,\n icon: 'circle',\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'x',\n z: 0,\n lineStyle: {\n color: isDark ? TOOLTIP_LINE_COLOR_CONFIG.DARK : TOOLTIP_LINE_COLOR_CONFIG.LIGHT,\n },\n },\n formatter: tooltipFormatter,\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n axisTick: {\n show: false,\n },\n axisLine: { show: false },\n splitLine: {\n show: true,\n },\n axisLabel: {\n margin: 10,\n showMinLabel: false,\n rotate: -45,\n interval: Math.round(seriesData[0].data.length / VERTICAL_LINE_COUNT),\n formatter: (label: string) => xAxisLabelFormatter(label, timeUnit),\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n splitNumber: 5,\n axisLine: { show: false },\n axisTick: { show: false },\n boundaryGap: ['10%', '10%'],\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n },\n },\n series: seriesData,\n };\n};\n\nexport { getOption };\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,yBAAyB,EAAEC,mBAAmB,QAAQ,aAAa;AAC1F,SAASC,gBAAgB,EAAEC,mBAAmB,QAAQ,cAAc;AAGpE,MAAMC,SAAS,GAAGA,CAChBC,MAA8B,EAC9BC,QAAsC,EACtCC,MAAe,KACZ;EACH,MAAMC,UAAU,GAAGH,MAAM,CAACI,GAAG,CAACC,IAAA;IAAA,IAAC;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAAF,IAAA;IAAA,OAAM;MACtDG,IAAI,EAAEF,QAAQ;MACdG,IAAI,EAAE,MAAM;MACZC,MAAM,EAAE,QAAQ;MAChBC,UAAU,EAAE,KAAK;MACj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,EAAE,CAAC,EAAE;QACXC,QAAQ,EAAEC,IAAI,CAACC,KAAK,CAAC3C,UAAU,CAAC,CAAC,CAAC,CAACY,IAAI,CAACgC,MAAM,GAAGnD,mBAAmB,CAAC;QACrEqC,SAAS,EAAGe,KAAa,IAAKlD,mBAAmB,CAACkD,KAAK,EAAE/C,QAAQ;MACnE;IACF,CAAC;IACDgD,KAAK,EAAE;MACLxC,IAAI,EAAE,OAAO;MACbyC,QAAQ,EAAE,OAAO;MACjBC,WAAW,EAAE,CAAC;MACdb,QAAQ,EAAE;QAAED,IAAI,EAAE;MAAM,CAAC;MACzBD,QAAQ,EAAE;QAAEC,IAAI,EAAE;MAAM,CAAC;MACzBe,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3BZ,SAAS,EAAE;QACTa,YAAY,EAAE,KAAK;QACnBX,YAAY,EAAE;MAChB;IACF,CAAC;IACDY,MAAM,EAAEnD;EACV,CAAC;AACH,CAAC;AAED,SAASJ,SAAS"}
@@ -7,16 +7,7 @@ declare const CHART_HEIGHT = 425;
7
7
  declare const LEGEND_HEIGHT = 50;
8
8
  declare const LEGEND_HEIGHT_MOBILE = 70;
9
9
  declare const VERTICAL_LINE_COUNT = 10;
10
- declare const COLOR_CONFIG: {
11
- AUD: string;
12
- JPY: string;
13
- USD: string;
14
- EUR: string;
15
- GBP: string;
16
- CHF: string;
17
- CAD: string;
18
- NZD: string;
19
- };
10
+ declare const COLOR_CONFIG: Record<string, string>;
20
11
  declare const TOOLTIP_LINE_COLOR_CONFIG: {
21
12
  DARK: string;
22
13
  LIGHT: string;
@@ -3,7 +3,7 @@ declare const getOption: (values: CurrencyPowerBalance[], timeUnit: CurrencyPowe
3
3
  animation: boolean;
4
4
  legend: {
5
5
  data: {
6
- name: import("../../../../gql/types/graphql").CurrencyName;
6
+ name: string;
7
7
  itemStyle: {
8
8
  color: string;
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oanda/labs-currency-power-balance-widget",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Labs Currency Power Balance Widget",
5
5
  "main": "dist/main/index.js",
6
6
  "module": "dist/module/index.js",
@@ -13,7 +13,7 @@
13
13
  "license": "UNLICENSED",
14
14
  "dependencies": {
15
15
  "@apollo/client": "3.7.17",
16
- "@oanda/labs-widget-common": "^1.0.78",
16
+ "@oanda/labs-widget-common": "^1.0.80",
17
17
  "@oanda/mono-i18n": "9.0.0",
18
18
  "echarts": "5.4.3",
19
19
  "echarts-for-react": "3.0.2",
@@ -24,5 +24,5 @@
24
24
  "@graphql-codegen/cli": "5.0.0",
25
25
  "@graphql-codegen/client-preset": "4.1.0"
26
26
  },
27
- "gitHead": "ceb65bae6ed671bc9b82eb5170bd879f0235e757"
27
+ "gitHead": "100e58167e14b5a864c62f895ac00f8dd7e8cdc2"
28
28
  }
@@ -28,7 +28,7 @@ const ChartWithData = ({ timeUnit }: ChartWithDataProps) => {
28
28
  <>
29
29
  {loading
30
30
  && (
31
- <div className="lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary">
31
+ <div className="lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary lw-mb-[50px]">
32
32
  <Spinner size={SpinnerSize.lg} />
33
33
  </div>
34
34
  )}
@@ -36,7 +36,7 @@ const ChartWithData = ({ timeUnit }: ChartWithDataProps) => {
36
36
  <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />
37
37
  )}
38
38
  {!loading && showError && (
39
- <div className="lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary">
39
+ <div className="lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary">
40
40
  <ChartError />
41
41
  </div>
42
42
  )}
@@ -1,6 +1,11 @@
1
1
  import React, { useRef, useEffect, useContext } from 'react';
2
- import ReactECharts from 'echarts-for-react';
3
- import { registerTheme, EChartsType } from 'echarts';
2
+ import ReactEChartsCore from 'echarts-for-react/lib/core';
3
+ import * as echarts from 'echarts/core';
4
+ import { LineChart } from 'echarts/charts';
5
+ import { CanvasRenderer } from 'echarts/renderers';
6
+ import {
7
+ GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent,
8
+ } from 'echarts/components';
4
9
  import { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';
5
10
  import {
6
11
  CHART_HEIGHT,
@@ -8,8 +13,17 @@ import {
8
13
  import { getResponsiveOption, getOption } from './options';
9
14
  import { ChartProps } from './types';
10
15
 
11
- registerTheme('dark_theme', getChartTheme(Theme.Dark));
12
- registerTheme('light_theme', getChartTheme(Theme.Light));
16
+ echarts.use([
17
+ GridSimpleComponent,
18
+ GraphicComponent,
19
+ TooltipComponent,
20
+ LegendPlainComponent,
21
+ LineChart,
22
+ CanvasRenderer,
23
+ ]);
24
+
25
+ echarts.registerTheme('dark_theme', getChartTheme(Theme.Dark));
26
+ echarts.registerTheme('light_theme', getChartTheme(Theme.Light));
13
27
 
14
28
  const Chart = ({ values, timeUnit }: ChartProps) => {
15
29
  const { isDark, isDesktop, isMobile } = useContext(ThemeContext);
@@ -18,7 +32,7 @@ const Chart = ({ values, timeUnit }: ChartProps) => {
18
32
  useEffect(() => {
19
33
  if (echartRef.current) {
20
34
  // @ts-ignore
21
- const echartInstance = echartRef.current.getEchartsInstance() as EChartsType;
35
+ const echartInstance = echartRef.current.getEchartsInstance() as echarts.EChartsType;
22
36
 
23
37
  echartInstance.setOption(
24
38
  getResponsiveOption(isDesktop, isMobile, isDark),
@@ -27,7 +41,8 @@ const Chart = ({ values, timeUnit }: ChartProps) => {
27
41
  }, [echartRef, isDesktop, isMobile, isDark]);
28
42
 
29
43
  return (
30
- <ReactECharts
44
+ <ReactEChartsCore
45
+ echarts={echarts}
31
46
  ref={echartRef}
32
47
  theme={isDark ? 'dark_theme' : 'light_theme'}
33
48
  style={{
@@ -10,13 +10,13 @@ const LEGEND_HEIGHT = 50;
10
10
  const LEGEND_HEIGHT_MOBILE = 70;
11
11
  const VERTICAL_LINE_COUNT = 10;
12
12
 
13
- const COLOR_CONFIG = {
14
- AUD: colorPalette.orange,
15
- JPY: colorPalette.raspberryLight,
13
+ const COLOR_CONFIG: Record<string, string> = {
16
14
  USD: colorPalette.greenLight,
17
15
  EUR: colorPalette.turquoiseLight,
18
16
  GBP: colorPalette.violetLight,
17
+ JPY: colorPalette.raspberryLight,
19
18
  CHF: colorPalette.bottleGreen75Lighter,
19
+ AUD: colorPalette.orange,
20
20
  CAD: colorPalette.midnight75Lighter,
21
21
  NZD: colorPalette.gold,
22
22
  };
@@ -21,7 +21,7 @@ const getOption = (
21
21
  data: power.map(({ point, price }) => [point, price]),
22
22
  }));
23
23
 
24
- const legendData = values.map(({ currency }) => ({
24
+ const legendData = Object.keys(COLOR_CONFIG).map((currency) => ({
25
25
  name: currency,
26
26
  itemStyle: {
27
27
  color: COLOR_CONFIG[currency],
@@ -213,6 +213,35 @@ const mockResponse = [{
213
213
  },
214
214
  ],
215
215
  },
216
+ {
217
+ currency: 'GBP',
218
+ power: [
219
+ {
220
+ point: '2023-10-26T22:00:00Z',
221
+ price: 1.8,
222
+ },
223
+ {
224
+ point: '2023-10-27T02:00:00Z',
225
+ price: 1.08,
226
+ },
227
+ {
228
+ point: '2023-10-27T06:00:00Z',
229
+ price: 1.37,
230
+ },
231
+ {
232
+ point: '2023-10-27T10:00:00Z',
233
+ price: 1.51,
234
+ },
235
+ {
236
+ point: '2023-10-27T14:00:00Z',
237
+ price: 1.91,
238
+ },
239
+ {
240
+ point: '2023-10-27T18:00:00Z',
241
+ price: 1.31,
242
+ },
243
+ ],
244
+ },
216
245
  ],
217
246
  },
218
247
  },