@gravity-ui/chartkit 2.2.2 → 2.3.1
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
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.3.1](https://github.com/gravity-ui/chartkit/compare/v2.3.0...v2.3.1) (2023-04-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **Highcharts plugin:** navigator series visibility on legend item click ([#148](https://github.com/gravity-ui/chartkit/issues/148)) ([ae7d38b](https://github.com/gravity-ui/chartkit/commit/ae7d38b3ffa8d4b037a762bf26f4e68b504c7886))
|
|
9
|
+
|
|
10
|
+
## [2.3.0](https://github.com/gravity-ui/chartkit/compare/v2.2.2...v2.3.0) (2023-04-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **Indicator plugin:** add onRender ([#145](https://github.com/gravity-ui/chartkit/issues/145)) ([3a044c0](https://github.com/gravity-ui/chartkit/commit/3a044c08583cd96bd08e3fb29a89c06ca9a6be18))
|
|
16
|
+
* **Indicator plugin:** add renderTime ([3a044c0](https://github.com/gravity-ui/chartkit/commit/3a044c08583cd96bd08e3fb29a89c06ca9a6be18))
|
|
17
|
+
|
|
3
18
|
## [2.2.2](https://github.com/gravity-ui/chartkit/compare/v2.2.1...v2.2.2) (2023-03-28)
|
|
4
19
|
|
|
5
20
|
|
|
@@ -5,6 +5,9 @@ const getSeriesIdentifier = (item) => {
|
|
|
5
5
|
if (item instanceof Highcharts.Point) {
|
|
6
6
|
return item.name;
|
|
7
7
|
}
|
|
8
|
+
if (isNavigatorSeries(item) && item.baseSeries) {
|
|
9
|
+
return item.baseSeries.userOptions.id || item.baseSeries.name;
|
|
10
|
+
}
|
|
8
11
|
return item.userOptions.id || item.name;
|
|
9
12
|
};
|
|
10
13
|
const needSetVisible = (seriesName, seriesVisible, chartSeries) => {
|
|
@@ -35,4 +35,10 @@ declare module 'highcharts' {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
interface SeriesOptionsRegistry extends Record<string, Record<string, unknown>> {}
|
|
38
|
+
|
|
39
|
+
// for Stock chart from https://github.com/highcharts/highcharts/blob/master/ts/Stock/Navigator/NavigatorComposition.ts#L65
|
|
40
|
+
interface Series {
|
|
41
|
+
baseSeries?: Series;
|
|
42
|
+
navigatorSeries?: Series;
|
|
43
|
+
}
|
|
38
44
|
}
|
|
@@ -4,6 +4,7 @@ import { isEmpty } from 'lodash';
|
|
|
4
4
|
import { i18n } from '../../../i18n';
|
|
5
5
|
import { CHARTKIT_ERROR_CODE, ChartKitError } from '../../../libs';
|
|
6
6
|
import { CHARTKIT_SCROLLABLE_NODE_CLASSNAME } from '../../../constants';
|
|
7
|
+
import { getChartPerformanceDuration, getRandomCKId, markChartPerformance } from '../../../utils';
|
|
7
8
|
import { IndicatorItem } from './IndicatorItem';
|
|
8
9
|
import './IndicatorWidget.css';
|
|
9
10
|
const b = block('chartkit-indicator');
|
|
@@ -11,12 +12,16 @@ const IndicatorWidget = React.forwardRef(
|
|
|
11
12
|
// _ref needs to avoid this React warning:
|
|
12
13
|
// "forwardRef render functions accept exactly two parameters: props and ref"
|
|
13
14
|
function IndicatorWidgetInner(props, _ref) {
|
|
14
|
-
const { onLoad, formatNumber, data: { data = [], defaultColor }, } = props;
|
|
15
|
+
const { onLoad, formatNumber, data: { data = [], defaultColor }, id, onRender, } = props;
|
|
16
|
+
const generatedId = React.useMemo(() => `${id}_${getRandomCKId()}`, [data, defaultColor, formatNumber, id]);
|
|
17
|
+
markChartPerformance(generatedId);
|
|
15
18
|
React.useLayoutEffect(() => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
if (onRender) {
|
|
20
|
+
onRender({ renderTime: getChartPerformanceDuration(generatedId) });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad({ widgetRendering: getChartPerformanceDuration(generatedId) });
|
|
24
|
+
}, [onLoad, onRender, generatedId]);
|
|
20
25
|
if (isEmpty(data)) {
|
|
21
26
|
throw new ChartKitError({
|
|
22
27
|
code: CHARTKIT_ERROR_CODE.NO_DATA,
|
package/package.json
CHANGED