@gravity-ui/chartkit 1.4.0 → 1.4.2
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 +14 -0
- package/build/plugins/highcharts/__stories__/Bar.stories.js +1 -1
- package/build/plugins/highcharts/__stories__/Column.stories.js +1 -1
- package/build/plugins/highcharts/__stories__/Line.stories.js +1 -1
- package/build/plugins/highcharts/__stories__/Pie.stories.d.ts +4 -0
- package/build/plugins/highcharts/__stories__/Pie.stories.js +21 -0
- package/build/plugins/highcharts/__stories__/mocks/pie.d.ts +2 -0
- package/build/plugins/highcharts/__stories__/mocks/pie.js +37 -0
- package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +12 -9
- package/build/plugins/highcharts/types/lib.d.ts +1 -1
- package/build/plugins/highcharts/types/lib.js +1 -1
- package/build/plugins/highcharts/types/widget.d.ts +5 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.2](https://github.com/gravity-ui/chartkit/compare/v1.4.1...v1.4.2) (2022-12-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **Highcharts plugin:** fix pie halo on mobile devices ([#97](https://github.com/gravity-ui/chartkit/issues/97)) ([3b4a0b4](https://github.com/gravity-ui/chartkit/commit/3b4a0b46ee6512b8b941ef768c85804b4daf7638))
|
|
9
|
+
|
|
10
|
+
## [1.4.1](https://github.com/gravity-ui/chartkit/compare/v1.4.0...v1.4.1) (2022-12-12)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* fix Hide all and Show all button ([#95](https://github.com/gravity-ui/chartkit/issues/95)) ([4e404e6](https://github.com/gravity-ui/chartkit/commit/4e404e626ad20f455c05ec958b828b7a193b8f9b))
|
|
16
|
+
|
|
3
17
|
## [1.4.0](https://github.com/gravity-ui/chartkit/compare/v1.3.0...v1.4.0) (2022-12-09)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -26,6 +26,6 @@ const Template = (args) => {
|
|
|
26
26
|
}
|
|
27
27
|
return (React.createElement(ThemeProvider, { theme: args.theme },
|
|
28
28
|
React.createElement("div", { style: { height: '600px', width: '100%' } },
|
|
29
|
-
React.createElement(ChartKit, { ref: chartkitRef,
|
|
29
|
+
React.createElement(ChartKit, { ref: chartkitRef, type: "highcharts", data: data }))));
|
|
30
30
|
};
|
|
31
31
|
export const Bar = Template.bind({});
|
|
@@ -25,6 +25,6 @@ const Template = (args) => {
|
|
|
25
25
|
return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
|
|
26
26
|
}
|
|
27
27
|
return (React.createElement(ThemeProvider, { theme: args.theme },
|
|
28
|
-
React.createElement(ChartKit, { ref: chartkitRef,
|
|
28
|
+
React.createElement(ChartKit, { ref: chartkitRef, type: "highcharts", data: data })));
|
|
29
29
|
};
|
|
30
30
|
export const Column = Template.bind({});
|
|
@@ -16,6 +16,6 @@ const Template = () => {
|
|
|
16
16
|
return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
|
|
17
17
|
}
|
|
18
18
|
return (React.createElement("div", { style: { height: 300, width: '100%' } },
|
|
19
|
-
React.createElement(ChartKit, { ref: chartkitRef,
|
|
19
|
+
React.createElement(ChartKit, { ref: chartkitRef, type: "highcharts", data: data, splitTooltip: true })));
|
|
20
20
|
};
|
|
21
21
|
export const Line = Template.bind({});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '@gravity-ui/uikit';
|
|
3
|
+
import { settings } from '../../../libs';
|
|
4
|
+
import { HighchartsPlugin } from '../..';
|
|
5
|
+
import { ChartKit } from '../../../components/ChartKit';
|
|
6
|
+
import { data } from './mocks/pie';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Plugins/Highcharts/Pie',
|
|
9
|
+
component: ChartKit,
|
|
10
|
+
};
|
|
11
|
+
const Template = () => {
|
|
12
|
+
const [shown, setShown] = React.useState(false);
|
|
13
|
+
const chartkitRef = React.useRef();
|
|
14
|
+
if (!shown) {
|
|
15
|
+
settings.set({ plugins: [HighchartsPlugin] });
|
|
16
|
+
return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
|
|
17
|
+
}
|
|
18
|
+
return (React.createElement("div", { style: { height: 300, width: '100%' } },
|
|
19
|
+
React.createElement(ChartKit, { ref: chartkitRef, type: "highcharts", data: data })));
|
|
20
|
+
};
|
|
21
|
+
export const Pie = Template.bind({});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const data = {
|
|
2
|
+
data: {
|
|
3
|
+
graphs: [
|
|
4
|
+
{
|
|
5
|
+
name: 'Number of requests',
|
|
6
|
+
tooltip: {
|
|
7
|
+
chartKitFormatting: true,
|
|
8
|
+
chartKitPrecision: 0,
|
|
9
|
+
},
|
|
10
|
+
dataLabels: {
|
|
11
|
+
format: null,
|
|
12
|
+
chartKitFormatting: true,
|
|
13
|
+
chartKitPrecision: 0,
|
|
14
|
+
chartKitPrefix: '',
|
|
15
|
+
chartKitPostfix: '',
|
|
16
|
+
chartKitLabelMode: 'absolute',
|
|
17
|
+
chartKitFormat: 'number',
|
|
18
|
+
chartKitShowRankDelimiter: true,
|
|
19
|
+
},
|
|
20
|
+
data: [
|
|
21
|
+
{ name: 'Furniture', y: 14344, label: 14344 },
|
|
22
|
+
{ name: 'Domestic chemistry', y: 14244, label: 14244 },
|
|
23
|
+
{ name: 'Household goods', y: 14181, label: 14181 },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
categories: ['Furniture', 'Domestic chemistry', 'Household goods'],
|
|
28
|
+
},
|
|
29
|
+
config: {
|
|
30
|
+
showPercentInTooltip: true,
|
|
31
|
+
},
|
|
32
|
+
libraryConfig: {
|
|
33
|
+
chart: {
|
|
34
|
+
type: 'pie',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/* eslint callback-return: 0 */
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import block from 'bem-cn-lite';
|
|
3
4
|
import { get, debounce } from 'lodash';
|
|
5
|
+
import { getRandomCKId } from '../../../../../utils';
|
|
4
6
|
import { chartTypesWithoutCrosshair } from '../../helpers/config/config';
|
|
5
7
|
import { StyledSplitPane } from '../StyledSplitPane/StyledSplitPane';
|
|
6
8
|
import './WithSplitPane.css';
|
|
@@ -78,6 +80,7 @@ export const withSplitPane = (ComposedComponent) => {
|
|
|
78
80
|
paneSplit: window.innerWidth > window.innerHeight
|
|
79
81
|
? PaneSplits.VERTICAL
|
|
80
82
|
: PaneSplits.HORIZONTAL,
|
|
83
|
+
componentKey: getRandomCKId(),
|
|
81
84
|
};
|
|
82
85
|
this.tooltipContainerRef = React.createRef();
|
|
83
86
|
this.rootRef = React.createRef();
|
|
@@ -97,13 +100,11 @@ export const withSplitPane = (ComposedComponent) => {
|
|
|
97
100
|
if (this.state.paneSplit === PaneSplits.HORIZONTAL) {
|
|
98
101
|
this.setInitialPaneSize(callback);
|
|
99
102
|
}
|
|
103
|
+
else if (waitForFirstRedraw) {
|
|
104
|
+
chart.afterRedrawCallback = callback;
|
|
105
|
+
}
|
|
100
106
|
else {
|
|
101
|
-
|
|
102
|
-
chart.afterRedrawCallback = callback;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
callback();
|
|
106
|
-
}
|
|
107
|
+
callback();
|
|
107
108
|
}
|
|
108
109
|
};
|
|
109
110
|
this.afterCreateCallback = (chart) => {
|
|
@@ -123,6 +124,7 @@ export const withSplitPane = (ComposedComponent) => {
|
|
|
123
124
|
this.setState({
|
|
124
125
|
paneSize: paneSize > maxPaneSize ? maxPaneSize : paneSize,
|
|
125
126
|
maxPaneSize,
|
|
127
|
+
componentKey: getRandomCKId(),
|
|
126
128
|
}, () => {
|
|
127
129
|
this.reflow();
|
|
128
130
|
setTimeout(callback, 0);
|
|
@@ -192,13 +194,14 @@ export const withSplitPane = (ComposedComponent) => {
|
|
|
192
194
|
: this.renderHorizontal()));
|
|
193
195
|
}
|
|
194
196
|
renderHorizontal() {
|
|
195
|
-
const { paneSize, maxPaneSize } = this.state;
|
|
197
|
+
const { paneSize, maxPaneSize, componentKey } = this.state;
|
|
196
198
|
const thirdOfViewport = window.innerHeight / 3;
|
|
197
|
-
return (React.createElement(StyledSplitPane, { split: "horizontal", onChange: this.debouncedHandlePaneChange, minSize: thirdOfViewport, maxSize: maxPaneSize || undefined, size: paneSize, paneOneRender: () => (React.createElement(ComposedComponent, Object.assign({}, this.props, { ref: this.props.forwardedRef, callback: this.afterCreateCallback }))), paneTwoRender: () => React.createElement("div", { ref: this.tooltipContainerRef }) }));
|
|
199
|
+
return (React.createElement(StyledSplitPane, { split: "horizontal", onChange: this.debouncedHandlePaneChange, minSize: thirdOfViewport, maxSize: maxPaneSize || undefined, size: paneSize, paneOneRender: () => (React.createElement(ComposedComponent, Object.assign({}, this.props, { key: componentKey, ref: this.props.forwardedRef, callback: this.afterCreateCallback }))), paneTwoRender: () => React.createElement("div", { ref: this.tooltipContainerRef }) }));
|
|
198
200
|
}
|
|
199
201
|
renderVertical() {
|
|
202
|
+
const { componentKey } = this.state;
|
|
200
203
|
const paneSize = window.innerWidth * CHART_SECTION_PERCENTAGE;
|
|
201
|
-
return (React.createElement(StyledSplitPane, { split: "vertical", allowResize: false, size: paneSize, paneOneRender: () => (React.createElement(ComposedComponent, Object.assign({}, this.props, { ref: this.props.forwardedRef, callback: this.afterCreateCallback }))), paneTwoRender: () => React.createElement("div", { ref: this.tooltipContainerRef }) }));
|
|
204
|
+
return (React.createElement(StyledSplitPane, { split: "vertical", allowResize: false, size: paneSize, paneOneRender: () => (React.createElement(ComposedComponent, Object.assign({}, this.props, { key: componentKey, ref: this.props.forwardedRef, callback: this.afterCreateCallback }))), paneTwoRender: () => React.createElement("div", { ref: this.tooltipContainerRef }) }));
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
207
|
return React.forwardRef((props, ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * as Highcharts from 'highcharts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * as Highcharts from 'highcharts';
|
|
@@ -25,6 +25,11 @@ export declare type HighchartsWidgetData = {
|
|
|
25
25
|
hideLegend?: boolean;
|
|
26
26
|
/** @deprecated use `hideLegend` instead */
|
|
27
27
|
showLegend?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Percentage value displayed in tooltip.
|
|
30
|
+
* Relevant in case of initialized [stacking](https://api.highcharts.com/highcharts/plotOptions.column.stacking) property only.
|
|
31
|
+
*/
|
|
32
|
+
showPercentInTooltip?: boolean;
|
|
28
33
|
disableExternalComments?: boolean;
|
|
29
34
|
normalizeDiv?: boolean;
|
|
30
35
|
normalizeSub?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "React component used to render charts based on any sources you need",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git@github.com:gravity-ui/ChartKit.git",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@gravity-ui/yagr": "^2.2.
|
|
16
|
+
"@gravity-ui/yagr": "^2.2.2",
|
|
17
17
|
"bem-cn-lite": "^4.1.0",
|
|
18
18
|
"highcharts": "^8.2.2",
|
|
19
19
|
"highcharts-react-official": "^3.0.0",
|