@oanda/labs-currency-power-balance-widget 1.0.17 → 1.0.18
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 +76 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +10 -5
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +10 -5
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/package.json +3 -3
- package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +21 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,82 @@
|
|
|
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.18 (2024-02-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.78 (2024-01-30)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.77 (2024-01-25)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.76 (2024-01-25)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.75 (2024-01-22)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.74 (2024-01-22)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.73 (2024-01-22)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.72 (2024-01-19)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.71 (2024-01-18)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.70 (2024-01-17)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.69 (2024-01-17)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.68 (2024-01-15)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.67 (2024-01-15)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.66 (2024-01-12)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.65 (2024-01-11)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.64 (2024-01-11)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.63 (2024-01-11)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.62 (2024-01-10)
|
|
75
|
+
|
|
76
|
+
**Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
6
82
|
## 1.0.17 (2024-01-30)
|
|
7
83
|
|
|
8
84
|
|
|
@@ -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
|
|
9
|
-
var
|
|
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
|
-
(
|
|
17
|
-
|
|
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(
|
|
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","
|
|
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 ? '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":"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"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useContext } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
-
|
|
8
|
-
registerTheme('
|
|
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(
|
|
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","
|
|
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,mBAAmB,EAAEC,SAAS,QAAQ,WAAW;AAG1DZ,OAAO,CAACa,GAAG,CAAC,CACVV,mBAAmB,EACnBC,gBAAgB,EAChBC,gBAAgB,EAChBC,oBAAoB,EACpBL,SAAS,EACTC,cAAc,CACf,CAAC;AAEFF,OAAO,CAACc,aAAa,CAAC,YAAY,EAAEL,aAAa,CAACF,KAAK,CAACQ,IAAI,CAAC,CAAC;AAC9Df,OAAO,CAACc,aAAa,CAAC,aAAa,EAAEL,aAAa,CAACF,KAAK,CAACS,KAAK,CAAC,CAAC;AAEhE,MAAMC,KAAK,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC,MAAM;IAAEC;EAAqB,CAAC,GAAAF,IAAA;EAC7C,MAAM;IAAEG,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAGzB,UAAU,CAACU,YAAY,CAAC;EAChE,MAAMgB,SAAS,GAAG5B,MAAM,CAAC,IAAI,CAAC;EAE9BC,SAAS,CAAC,MAAM;IACd,IAAI2B,SAAS,CAACC,OAAO,EAAE;MAErB,MAAMC,cAAc,GAAGF,SAAS,CAACC,OAAO,CAACE,kBAAkB,CAAC,CAAwB;MAEpFD,cAAc,CAACE,SAAS,CACtBjB,mBAAmB,CAACW,SAAS,EAAEC,QAAQ,EAAEF,MAAM,CACjD,CAAC;IACH;EACF,CAAC,EAAE,CAACG,SAAS,EAAEF,SAAS,EAAEC,QAAQ,EAAEF,MAAM,CAAC,CAAC;EAE5C,OACE1B,KAAA,CAAAkC,aAAA,CAAC9B,gBAAgB;IACfC,OAAO,EAAEA,OAAQ;IACjB8B,GAAG,EAAEN,SAAU;IACfO,KAAK,EAAEV,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CW,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKxB,YAAY,OAAI;MAC3ByB,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAExB,SAAS,CAACO,MAAM,EAAEC,QAAQ,EAAEC,MAAM;EAAE,CAC7C,CAAC;AAEN,CAAC;AAED,SAASJ,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-currency-power-balance-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
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.
|
|
16
|
+
"@oanda/labs-widget-common": "^1.0.79",
|
|
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": "
|
|
27
|
+
"gitHead": "e3c25377e179d6516e6fea1cc130868381275824"
|
|
28
28
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useContext } from 'react';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
-
|
|
12
|
-
|
|
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
|
-
<
|
|
44
|
+
<ReactEChartsCore
|
|
45
|
+
echarts={echarts}
|
|
31
46
|
ref={echartRef}
|
|
32
47
|
theme={isDark ? 'dark_theme' : 'light_theme'}
|
|
33
48
|
style={{
|