@gravity-ui/chartkit 1.4.1 → 1.4.3
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 +16 -0
- package/build/plugins/highcharts/__stories__/Line.stories.js +2 -11
- package/build/plugins/highcharts/__stories__/Pie.stories.d.ts +4 -0
- package/build/plugins/highcharts/__stories__/Pie.stories.js +12 -0
- package/build/plugins/highcharts/__stories__/{AreaRange.stories.d.ts → area/Range.stories.d.ts} +0 -0
- package/build/plugins/highcharts/__stories__/area/Range.stories.js +12 -0
- package/build/plugins/highcharts/__stories__/area/Stacked.stories.d.ts +4 -0
- package/build/plugins/highcharts/__stories__/area/Stacked.stories.js +12 -0
- package/build/plugins/highcharts/__stories__/column/HorizontalStacked.stories.d.ts +4 -0
- package/build/plugins/highcharts/__stories__/column/HorizontalStacked.stories.js +12 -0
- package/build/plugins/highcharts/__stories__/{Column.stories.d.ts → column/Vertical.stories.d.ts} +1 -1
- package/build/plugins/highcharts/__stories__/column/Vertical.stories.js +12 -0
- package/build/plugins/highcharts/__stories__/{Bar.stories.d.ts → column/VerticalStacked.stories.d.ts} +1 -1
- package/build/plugins/highcharts/__stories__/column/VerticalStacked.stories.js +12 -0
- package/build/plugins/highcharts/__stories__/components/ChartStory.d.ts +8 -0
- package/build/plugins/highcharts/__stories__/components/ChartStory.js +22 -0
- package/build/plugins/highcharts/__stories__/mocks/{bar.d.ts → area-stacked.d.ts} +0 -0
- package/build/plugins/highcharts/__stories__/mocks/area-stacked.js +104 -0
- package/build/plugins/highcharts/__stories__/mocks/{column.d.ts → column-hor-stacked.d.ts} +0 -0
- package/build/plugins/highcharts/__stories__/mocks/{bar.js → column-hor-stacked.js} +0 -0
- package/build/plugins/highcharts/__stories__/mocks/column-ver-stacked.d.ts +2 -0
- package/build/plugins/highcharts/__stories__/mocks/{column.js → column-ver-stacked.js} +0 -0
- package/build/plugins/highcharts/__stories__/mocks/column-ver.d.ts +2 -0
- package/build/plugins/highcharts/__stories__/mocks/column-ver.js +73 -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/HighchartsComponent.d.ts +5 -0
- package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +12 -9
- package/build/plugins/highcharts/renderer/helpers/config/config.d.ts +10 -0
- package/build/plugins/highcharts/renderer/helpers/config/config.js +3 -0
- package/build/plugins/highcharts/renderer/helpers/graph.d.ts +5 -0
- package/build/plugins/highcharts/renderer/helpers/tooltip/index.js +2 -3
- 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/build/plugins/yagr/renderer/YagrWidget.d.ts +1 -0
- package/build/plugins/yagr/renderer/YagrWidget.js +1 -0
- package/package.json +7 -2
- package/build/plugins/highcharts/__stories__/AreaRange.stories.js +0 -22
- package/build/plugins/highcharts/__stories__/Bar.stories.js +0 -31
- package/build/plugins/highcharts/__stories__/Column.stories.js +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.3](https://github.com/gravity-ui/chartkit/compare/v1.4.2...v1.4.3) (2022-12-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **Highcharts plugin:** fix colorAxis legend title color ([#100](https://github.com/gravity-ui/chartkit/issues/100)) ([06c992a](https://github.com/gravity-ui/chartkit/commit/06c992a5a614798a475aa7c3358058ed7080c6c1))
|
|
9
|
+
* **Highcharts plugin:** remove tooltip lines sorting ([#103](https://github.com/gravity-ui/chartkit/issues/103)) ([5e57035](https://github.com/gravity-ui/chartkit/commit/5e57035b7c1d572d66926c48889e8b5905399592))
|
|
10
|
+
* **Yagr plugin:** add core styles import ([#104](https://github.com/gravity-ui/chartkit/issues/104)) ([4de763d](https://github.com/gravity-ui/chartkit/commit/4de763d7f502f4bacf202beddeb0e5ef27381917))
|
|
11
|
+
|
|
12
|
+
## [1.4.2](https://github.com/gravity-ui/chartkit/compare/v1.4.1...v1.4.2) (2022-12-13)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **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))
|
|
18
|
+
|
|
3
19
|
## [1.4.1](https://github.com/gravity-ui/chartkit/compare/v1.4.0...v1.4.1) (2022-12-12)
|
|
4
20
|
|
|
5
21
|
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button } from '@gravity-ui/uikit';
|
|
3
|
-
import { settings } from '../../../libs';
|
|
4
|
-
import { HighchartsPlugin } from '../../../plugins';
|
|
5
2
|
import { ChartKit } from '../../../components/ChartKit';
|
|
6
3
|
import { data } from './mocks/line';
|
|
4
|
+
import { ChartStory } from './components/ChartStory';
|
|
7
5
|
export default {
|
|
8
6
|
title: 'Plugins/Highcharts/Line',
|
|
9
7
|
component: ChartKit,
|
|
10
8
|
};
|
|
11
9
|
const Template = () => {
|
|
12
|
-
|
|
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, id: "1", type: "highcharts", data: data, hoistConfigError: false, onError: () => console.log('onError invoked') })));
|
|
10
|
+
return React.createElement(ChartStory, { data: data });
|
|
20
11
|
};
|
|
21
12
|
export const Line = Template.bind({});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChartKit } from '../../../components/ChartKit';
|
|
3
|
+
import { data } from './mocks/pie';
|
|
4
|
+
import { ChartStory } from './components/ChartStory';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Plugins/Highcharts/Pie',
|
|
7
|
+
component: ChartKit,
|
|
8
|
+
};
|
|
9
|
+
const Template = () => {
|
|
10
|
+
return React.createElement(ChartStory, { data: data });
|
|
11
|
+
};
|
|
12
|
+
export const Pie = Template.bind({});
|
package/build/plugins/highcharts/__stories__/{AreaRange.stories.d.ts → area/Range.stories.d.ts}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChartKit } from '../../../../components/ChartKit';
|
|
3
|
+
import { data } from '../mocks/area-range';
|
|
4
|
+
import { ChartStory } from '../components/ChartStory';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Plugins/Highcharts/Area',
|
|
7
|
+
component: ChartKit,
|
|
8
|
+
};
|
|
9
|
+
const Template = () => {
|
|
10
|
+
return React.createElement(ChartStory, { data: data });
|
|
11
|
+
};
|
|
12
|
+
export const AreaRange = Template.bind({});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChartKit } from '../../../../components/ChartKit';
|
|
3
|
+
import { data } from '../mocks/area-stacked';
|
|
4
|
+
import { ChartStory } from '../components/ChartStory';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Plugins/Highcharts/Area',
|
|
7
|
+
component: ChartKit,
|
|
8
|
+
};
|
|
9
|
+
const Template = () => {
|
|
10
|
+
return React.createElement(ChartStory, { data: data, height: "500px" });
|
|
11
|
+
};
|
|
12
|
+
export const AreaStacked = Template.bind({});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChartKit } from '../../../../components/ChartKit';
|
|
3
|
+
import { data } from '../mocks/column-hor-stacked';
|
|
4
|
+
import { ChartStory } from '../components/ChartStory';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Plugins/Highcharts/Column',
|
|
7
|
+
component: ChartKit,
|
|
8
|
+
};
|
|
9
|
+
const Template = () => {
|
|
10
|
+
return React.createElement(ChartStory, { data: data });
|
|
11
|
+
};
|
|
12
|
+
export const HorizontalStacked = Template.bind({});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChartKit } from '../../../../components/ChartKit';
|
|
3
|
+
import { data } from '../mocks/column-ver';
|
|
4
|
+
import { ChartStory } from '../components/ChartStory';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Plugins/Highcharts/Column',
|
|
7
|
+
component: ChartKit,
|
|
8
|
+
};
|
|
9
|
+
const Template = () => {
|
|
10
|
+
return React.createElement(ChartStory, { data: data });
|
|
11
|
+
};
|
|
12
|
+
export const Vertical = Template.bind({});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChartKit } from '../../../../components/ChartKit';
|
|
3
|
+
import { data } from '../mocks/column-ver-stacked';
|
|
4
|
+
import { ChartStory } from '../components/ChartStory';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Plugins/Highcharts/Column',
|
|
7
|
+
component: ChartKit,
|
|
8
|
+
};
|
|
9
|
+
const Template = () => {
|
|
10
|
+
return React.createElement(ChartStory, { data: data });
|
|
11
|
+
};
|
|
12
|
+
export const VerticalStacked = Template.bind({});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '@gravity-ui/uikit';
|
|
3
|
+
import { settings } from '../../../../libs';
|
|
4
|
+
import { HighchartsPlugin } from '../../index';
|
|
5
|
+
import holidays from '../mocks/holidays';
|
|
6
|
+
import { ChartKit } from '../../../../components/ChartKit';
|
|
7
|
+
const DEFAULT_STORY_HEIGHT = '300px';
|
|
8
|
+
const DEFAULT_STORY_WIDTH = '100%';
|
|
9
|
+
export const ChartStory = (props) => {
|
|
10
|
+
const { height, width, data } = props;
|
|
11
|
+
const [visible, setVisible] = React.useState(false);
|
|
12
|
+
const chartKitRef = React.useRef();
|
|
13
|
+
if (!visible) {
|
|
14
|
+
settings.set({ plugins: [HighchartsPlugin], extra: { holidays } });
|
|
15
|
+
return React.createElement(Button, { onClick: () => setVisible(true) }, "Show chart");
|
|
16
|
+
}
|
|
17
|
+
return (React.createElement("div", { style: {
|
|
18
|
+
height: height || DEFAULT_STORY_HEIGHT,
|
|
19
|
+
width: width || DEFAULT_STORY_WIDTH,
|
|
20
|
+
} },
|
|
21
|
+
React.createElement(ChartKit, { ref: chartKitRef, type: "highcharts", data: data })));
|
|
22
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export const data = {
|
|
2
|
+
data: {
|
|
3
|
+
graphs: [
|
|
4
|
+
{
|
|
5
|
+
title: 'Appliances',
|
|
6
|
+
tooltip: {
|
|
7
|
+
chartKitFormatting: true,
|
|
8
|
+
chartKitPrecision: 0,
|
|
9
|
+
},
|
|
10
|
+
data: [
|
|
11
|
+
{
|
|
12
|
+
y: 2420,
|
|
13
|
+
x: 2014,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
y: 2472,
|
|
17
|
+
x: 2015,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
y: 5248,
|
|
21
|
+
x: 2016,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
y: 7787,
|
|
25
|
+
x: 2017,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
legendTitle: 'Appliances',
|
|
29
|
+
connectNulls: false,
|
|
30
|
+
yAxis: 0,
|
|
31
|
+
color: '#FF3D64',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: 'Bookcases',
|
|
35
|
+
tooltip: {
|
|
36
|
+
chartKitFormatting: true,
|
|
37
|
+
chartKitPrecision: 0,
|
|
38
|
+
},
|
|
39
|
+
data: [
|
|
40
|
+
{
|
|
41
|
+
y: -363,
|
|
42
|
+
x: 2014,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
y: -2777,
|
|
46
|
+
x: 2015,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
y: 1880,
|
|
50
|
+
x: 2016,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
y: -616,
|
|
54
|
+
x: 2017,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
legendTitle: 'Bookcases',
|
|
58
|
+
connectNulls: false,
|
|
59
|
+
yAxis: 0,
|
|
60
|
+
color: '#8AD554',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
categories: ['2014', '2015', '2016', '2017'],
|
|
64
|
+
},
|
|
65
|
+
config: {
|
|
66
|
+
withoutLineLimit: true,
|
|
67
|
+
hideHolidaysBands: true,
|
|
68
|
+
enableSum: true,
|
|
69
|
+
},
|
|
70
|
+
libraryConfig: {
|
|
71
|
+
chart: {
|
|
72
|
+
type: 'area',
|
|
73
|
+
zoomType: 'x',
|
|
74
|
+
},
|
|
75
|
+
xAxis: {
|
|
76
|
+
endOnTick: false,
|
|
77
|
+
type: 'linear',
|
|
78
|
+
labels: {
|
|
79
|
+
enabled: true,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
yAxis: {
|
|
83
|
+
opposite: false,
|
|
84
|
+
labels: {
|
|
85
|
+
y: 3,
|
|
86
|
+
enabled: true,
|
|
87
|
+
},
|
|
88
|
+
type: 'linear',
|
|
89
|
+
},
|
|
90
|
+
plotOptions: {
|
|
91
|
+
area: {
|
|
92
|
+
stacking: 'normal',
|
|
93
|
+
},
|
|
94
|
+
series: {
|
|
95
|
+
dataGrouping: {
|
|
96
|
+
enabled: false,
|
|
97
|
+
},
|
|
98
|
+
dataLabels: {
|
|
99
|
+
allowOverlap: false,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export const data = {
|
|
2
|
+
data: {
|
|
3
|
+
graphs: [
|
|
4
|
+
{
|
|
5
|
+
data: [
|
|
6
|
+
{
|
|
7
|
+
y: 50.55,
|
|
8
|
+
color: 'rgb(255, 61, 9)',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
y: 80.45,
|
|
12
|
+
color: 'rgb(255, 65, 9)',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
y: 100.34,
|
|
16
|
+
color: 'rgb(255, 83, 9)',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
name: 'Profit',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
data: [
|
|
23
|
+
{
|
|
24
|
+
y: 350.65,
|
|
25
|
+
color: 'rgb(208, 189, 48)',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
y: 119.82,
|
|
29
|
+
color: 'rgb(255, 95, 88)',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
y: 452.15,
|
|
33
|
+
color: 'rgb(84, 165, 32)',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
name: 'Sales',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
categories: ['Furniture', 'Office Supplies', 'Technology'],
|
|
40
|
+
},
|
|
41
|
+
config: {
|
|
42
|
+
enableSum: true,
|
|
43
|
+
precision: 2,
|
|
44
|
+
},
|
|
45
|
+
libraryConfig: {
|
|
46
|
+
chart: {
|
|
47
|
+
type: 'column',
|
|
48
|
+
},
|
|
49
|
+
legend: {
|
|
50
|
+
title: {
|
|
51
|
+
text: 'Measure Values',
|
|
52
|
+
},
|
|
53
|
+
enabled: true,
|
|
54
|
+
},
|
|
55
|
+
colorAxis: {
|
|
56
|
+
startOnTick: false,
|
|
57
|
+
endOnTick: false,
|
|
58
|
+
min: 50.55,
|
|
59
|
+
max: 452.72057380654326,
|
|
60
|
+
stops: [
|
|
61
|
+
[0, 'rgb(255, 61, 100)'],
|
|
62
|
+
[0.5, 'rgb(255, 198, 54)'],
|
|
63
|
+
[1, 'rgb(84, 165, 32)'],
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
plotOptions: {
|
|
67
|
+
column: {
|
|
68
|
+
maxPointWidth: 50,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
enableSum: true,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -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) => {
|
|
@@ -10,6 +10,11 @@ export function buildLegend(options: any): {
|
|
|
10
10
|
color: string;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
+
title: {
|
|
14
|
+
style: {
|
|
15
|
+
color: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
13
18
|
};
|
|
14
19
|
export function hasChartVisibleSeries(chart: any): any;
|
|
15
20
|
export function handleScroll(): false | undefined;
|
|
@@ -486,6 +491,11 @@ export function prepareConfig(data: any, options: any, isMobile: any, holidays:
|
|
|
486
491
|
color: string;
|
|
487
492
|
};
|
|
488
493
|
};
|
|
494
|
+
title: {
|
|
495
|
+
style: {
|
|
496
|
+
color: string;
|
|
497
|
+
};
|
|
498
|
+
};
|
|
489
499
|
} | {
|
|
490
500
|
enabled: boolean;
|
|
491
501
|
};
|
|
@@ -162,6 +162,9 @@ export function buildLegend(options) {
|
|
|
162
162
|
inactiveColor: 'var(--yc-color-base-generic-accent-disabled)',
|
|
163
163
|
style: { color: 'var(--yc-color-text-primary)' },
|
|
164
164
|
},
|
|
165
|
+
title: {
|
|
166
|
+
style: { color: 'var(--yc-color-text-secondary)' },
|
|
167
|
+
},
|
|
165
168
|
};
|
|
166
169
|
if (options.outsideLegend) {
|
|
167
170
|
options.legendPosition = null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable complexity */
|
|
2
|
-
import
|
|
2
|
+
import _escape from 'lodash/escape';
|
|
3
3
|
import { i18n } from '../../../../../i18n';
|
|
4
4
|
import { renderShapeIcon } from './render-shape-icon';
|
|
5
5
|
import { escapeHTML } from './helpers';
|
|
@@ -131,7 +131,6 @@ export const formatTooltip = (data, tooltip, isMobile) => {
|
|
|
131
131
|
const selectedLineIndex = data.lines.findIndex(({ selectedSeries }) => selectedSeries);
|
|
132
132
|
const selectedLine = data.lines[selectedLineIndex];
|
|
133
133
|
const lines = data.lines.slice(0, (tooltip.lastVisibleRowIndex || data.lines.length) + 1);
|
|
134
|
-
const sortedLines = _orderBy(lines, ['originalValue'], ['desc']);
|
|
135
134
|
const withShapes = lines.every((line) => line.seriesShape);
|
|
136
135
|
const unsafe = data.unsafe;
|
|
137
136
|
const tooltipHeaderRaw = (_a = data.tooltipHeader) === null || _a === void 0 ? void 0 : _a.trim();
|
|
@@ -212,7 +211,7 @@ export const formatTooltip = (data, tooltip, isMobile) => {
|
|
|
212
211
|
.join('')}</tr>
|
|
213
212
|
</thead>`}
|
|
214
213
|
<tbody class="${TOOLTIP_LIST_CLASS_NAME}">
|
|
215
|
-
${
|
|
214
|
+
${lines
|
|
216
215
|
.map((line, index) => renderRow(line, getRowRenderConfig(index)))
|
|
217
216
|
.join('')}
|
|
218
217
|
</tbody>
|
|
@@ -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;
|
|
@@ -6,6 +6,7 @@ import { CHARTKIT_ERROR_CODE, ChartKitError } from '../../../libs';
|
|
|
6
6
|
import { useWidgetData } from './useWidgetData';
|
|
7
7
|
import { checkFocus, detectClickOutside, synchronizeTooltipTablesCellsWidth } from './utils';
|
|
8
8
|
import './polyfills';
|
|
9
|
+
import '@gravity-ui/yagr/dist/index.css';
|
|
9
10
|
import './YagrWidget.css';
|
|
10
11
|
const YagrWidget = React.forwardRef((props, forwardedRef) => {
|
|
11
12
|
const { id, data: { data }, onLoad, } = props;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
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",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"@types/react": "^17.0.48",
|
|
38
38
|
"@types/react-dom": "^17.0.17",
|
|
39
39
|
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
40
|
+
"cross-env": "^7.0.3",
|
|
41
|
+
"css-loader": "^5.2.7",
|
|
40
42
|
"eslint": "^8.11.0",
|
|
41
43
|
"gulp": "^4.0.2",
|
|
42
44
|
"gulp-cli": "^2.3.0",
|
|
@@ -51,9 +53,12 @@
|
|
|
51
53
|
"npm-run-all": "^4.1.5",
|
|
52
54
|
"prettier": "^2.6.0",
|
|
53
55
|
"react": "^17.0.2",
|
|
56
|
+
"react-docgen-typescript": "^2.2.2",
|
|
54
57
|
"react-dom": "^17.0.2",
|
|
55
58
|
"rimraf": "^3.0.2",
|
|
59
|
+
"sass": "^1.56.2",
|
|
56
60
|
"sass-loader": "^10.2.1",
|
|
61
|
+
"style-loader": "^2.0.0",
|
|
57
62
|
"stylelint": "^14.6.0",
|
|
58
63
|
"ts-jest": "^28.0.5",
|
|
59
64
|
"ts-node": "^10.2.1",
|
|
@@ -68,7 +73,7 @@
|
|
|
68
73
|
"test": "jest",
|
|
69
74
|
"test:watch": "jest --watchAll",
|
|
70
75
|
"clean": "gulp clean",
|
|
71
|
-
"start": "start-storybook -p 7007",
|
|
76
|
+
"start": "cross-env TS_NODE_PROJECT=.storybook/tsconfig.json start-storybook -p 7007",
|
|
72
77
|
"build": "gulp",
|
|
73
78
|
"lint:js": "eslint --quiet --ext .js,.jsx,.ts,.tsx .",
|
|
74
79
|
"lint:styles": "stylelint '{styles,src}/**/*.scss' --quiet",
|
|
@@ -1,22 +0,0 @@
|
|
|
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/area-range';
|
|
7
|
-
import holidays from './mocks/holidays';
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Plugins/Highcharts/AreaRange',
|
|
10
|
-
component: ChartKit,
|
|
11
|
-
};
|
|
12
|
-
const Template = () => {
|
|
13
|
-
const [shown, setShown] = React.useState(false);
|
|
14
|
-
const chartkitRef = React.useRef();
|
|
15
|
-
if (!shown) {
|
|
16
|
-
settings.set({ plugins: [HighchartsPlugin], extra: { holidays } });
|
|
17
|
-
return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
|
|
18
|
-
}
|
|
19
|
-
return (React.createElement("div", { style: { height: 300, width: '100%' } },
|
|
20
|
-
React.createElement(ChartKit, { ref: chartkitRef, id: "1", type: "highcharts", data: data })));
|
|
21
|
-
};
|
|
22
|
-
export const AreaRange = Template.bind({});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button, ThemeProvider } from '@gravity-ui/uikit';
|
|
3
|
-
import { ChartKit } from '../../../components/ChartKit';
|
|
4
|
-
import { settings } from '../../../libs';
|
|
5
|
-
import { HighchartsPlugin } from '../index';
|
|
6
|
-
import { defaultChartKitPropsControlsState } from './constants/story-settings';
|
|
7
|
-
import holidays from './mocks/holidays';
|
|
8
|
-
import { data } from './mocks/bar';
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Plugins/Highcharts/Bar',
|
|
11
|
-
component: ChartKit,
|
|
12
|
-
args: {
|
|
13
|
-
theme: 'light',
|
|
14
|
-
},
|
|
15
|
-
argTypes: Object.assign({ theme: {
|
|
16
|
-
options: ['light', 'light-hc', 'dark', 'dark-hc'],
|
|
17
|
-
control: { type: 'radio' },
|
|
18
|
-
} }, defaultChartKitPropsControlsState),
|
|
19
|
-
};
|
|
20
|
-
const Template = (args) => {
|
|
21
|
-
const [shown, setShown] = React.useState(false);
|
|
22
|
-
const chartkitRef = React.useRef();
|
|
23
|
-
if (!shown) {
|
|
24
|
-
settings.set({ plugins: [HighchartsPlugin], extra: { holidays } });
|
|
25
|
-
return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
|
|
26
|
-
}
|
|
27
|
-
return (React.createElement(ThemeProvider, { theme: args.theme },
|
|
28
|
-
React.createElement("div", { style: { height: '600px', width: '100%' } },
|
|
29
|
-
React.createElement(ChartKit, { ref: chartkitRef, id: "1", type: "highcharts", data: data, onError: () => console.log('onError invoked') }))));
|
|
30
|
-
};
|
|
31
|
-
export const Bar = Template.bind({});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button, ThemeProvider } from '@gravity-ui/uikit';
|
|
3
|
-
import { ChartKit } from '../../../components/ChartKit';
|
|
4
|
-
import { settings } from '../../../libs';
|
|
5
|
-
import { HighchartsPlugin } from '../index';
|
|
6
|
-
import { defaultChartKitPropsControlsState } from './constants/story-settings';
|
|
7
|
-
import holidays from './mocks/holidays';
|
|
8
|
-
import { data } from './mocks/column';
|
|
9
|
-
export default {
|
|
10
|
-
title: 'Plugins/Highcharts/Column',
|
|
11
|
-
component: ChartKit,
|
|
12
|
-
args: {
|
|
13
|
-
theme: 'light',
|
|
14
|
-
},
|
|
15
|
-
argTypes: Object.assign({ theme: {
|
|
16
|
-
options: ['light', 'light-hc', 'dark', 'dark-hc'],
|
|
17
|
-
control: { type: 'radio' },
|
|
18
|
-
} }, defaultChartKitPropsControlsState),
|
|
19
|
-
};
|
|
20
|
-
const Template = (args) => {
|
|
21
|
-
const [shown, setShown] = React.useState(false);
|
|
22
|
-
const chartkitRef = React.useRef();
|
|
23
|
-
if (!shown) {
|
|
24
|
-
settings.set({ plugins: [HighchartsPlugin], extra: { holidays } });
|
|
25
|
-
return React.createElement(Button, { onClick: () => setShown(true) }, "Show chart");
|
|
26
|
-
}
|
|
27
|
-
return (React.createElement(ThemeProvider, { theme: args.theme },
|
|
28
|
-
React.createElement(ChartKit, { ref: chartkitRef, id: "1", type: "highcharts", data: data, onError: () => console.log('onError invoked') })));
|
|
29
|
-
};
|
|
30
|
-
export const Column = Template.bind({});
|