@gravity-ui/chartkit 1.0.0 → 1.2.0
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 +55 -79
- package/README.md +3 -3
- package/build/plugins/index.d.ts +1 -1
- package/build/plugins/index.js +1 -0
- package/build/plugins/yagr/__stories__/mocks/line10.js +0 -2
- package/build/plugins/yagr/__tests__/utils.test.d.ts +1 -0
- package/build/plugins/yagr/__tests__/utils.test.js +26 -0
- package/build/plugins/yagr/renderer/tooltip/renderTooltip.d.ts +1 -1
- package/build/plugins/yagr/renderer/useWidgetData.d.ts +1 -2
- package/build/plugins/yagr/renderer/useWidgetData.js +2 -24
- package/build/plugins/yagr/renderer/utils.d.ts +9 -3
- package/build/plugins/yagr/renderer/utils.js +37 -1
- package/build/plugins/yagr/types.d.ts +3 -2
- package/build/plugins/yagr/types.js +1 -1
- package/build/types/widget.d.ts +1 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,237 +1,213 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [1.
|
|
3
|
+
## [1.2.0](https://github.com/gravity-ui/chartkit/compare/v1.1.0...v1.2.0) (2022-12-09)
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
###
|
|
6
|
+
### Features
|
|
7
7
|
|
|
8
|
-
* update yagr to
|
|
8
|
+
* update yagr to 2.1.0 ([#87](https://github.com/gravity-ui/chartkit/issues/87)) ([5dfd6d0](https://github.com/gravity-ui/chartkit/commit/5dfd6d0098729b4813f6a783457e40203e269272))
|
|
9
|
+
|
|
10
|
+
## [1.1.0](https://github.com/gravity-ui/chartkit/compare/v1.0.0...v1.1.0) (2022-12-08)
|
|
9
11
|
|
|
10
12
|
### Features
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
- add export of all yagr lib types to yagr plugin
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
13
17
|
|
|
18
|
+
- fix config object merging in `useWidgetData` yagr plugin hook
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
## [1.0.0](https://github.com/gravity-ui/chartkit/compare/v0.13.0...v1.0.0) (2022-12-07)
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
### ⚠ BREAKING CHANGES
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
- update Yagr to v2. Read more about [changes](https://github.com/yandex-cloud/yagr/blob/master/CHANGELOG.md#200-19-04-2022)
|
|
20
25
|
|
|
26
|
+
## [0.13.0](https://github.com/gravity-ui/chartkit/compare/v0.12.3...v0.13.0) (2022-12-05)
|
|
21
27
|
|
|
22
28
|
### Features
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
- remove direct import @gravity-ui/uikit styles in ChartKit component ([#80](https://github.com/gravity-ui/chartkit/issues/80)) ([49642d7](https://github.com/gravity-ui/chartkit/commit/49642d7cfbd358a399ead674b2d3a040b05bf669))
|
|
25
31
|
|
|
26
32
|
## [0.12.3](https://github.com/gravity-ui/chartkit/compare/v0.12.2...v0.12.3) (2022-12-01)
|
|
27
33
|
|
|
28
|
-
|
|
29
34
|
### Bug Fixes
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
- **Yagr:** added common no-data case handling ([#78](https://github.com/gravity-ui/chartkit/issues/78)) ([100efaa](https://github.com/gravity-ui/chartkit/commit/100efaaff20e03048146ca084ee91c2be2568640))
|
|
32
37
|
|
|
33
38
|
## [0.12.2](https://github.com/gravity-ui/chartkit/compare/v0.12.1...v0.12.2) (2022-11-30)
|
|
34
39
|
|
|
35
|
-
|
|
36
40
|
### Bug Fixes
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
- **ChartKit:** id not to be new on every render ([#76](https://github.com/gravity-ui/chartkit/issues/76)) ([230a992](https://github.com/gravity-ui/chartkit/commit/230a992fe99a176bbf85cbef363ccac45db7b3b4))
|
|
39
43
|
|
|
40
44
|
## [0.12.1](https://github.com/gravity-ui/chartkit/compare/v0.12.0...v0.12.1) (2022-11-22)
|
|
41
45
|
|
|
42
|
-
|
|
43
46
|
### Bug Fixes
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
- **Highcharts plugin:** remove style for chart background color ([#73](https://github.com/gravity-ui/chartkit/issues/73)) ([481b2f5](https://github.com/gravity-ui/chartkit/commit/481b2f5fe07d818f37ba220f70fbad14690b39ba))
|
|
46
49
|
|
|
47
50
|
## [0.12.0](https://github.com/gravity-ui/chartkit/compare/v0.11.1...v0.12.0) (2022-11-22)
|
|
48
51
|
|
|
49
|
-
|
|
50
52
|
### Features
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
- add support border color setting ([defdcf7](https://github.com/gravity-ui/chartkit/commit/defdcf768d33fe11f9de8dc14a1e9561c034f6ea))
|
|
53
55
|
|
|
54
56
|
## [0.11.1](https://github.com/gravity-ui/chartkit/compare/v0.11.0...v0.11.1) (2022-11-21)
|
|
55
57
|
|
|
56
|
-
|
|
57
58
|
### Bug Fixes
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
- **Highcharts plugin:** fix tooltip holidays handling ([#69](https://github.com/gravity-ui/chartkit/issues/69)) ([9bc3f8c](https://github.com/gravity-ui/chartkit/commit/9bc3f8c7a62d3b269626be87a46de1d8a6949f57))
|
|
60
61
|
|
|
61
62
|
## [0.11.0](https://github.com/gravity-ui/chartkit/compare/v0.10.1...v0.11.0) (2022-11-18)
|
|
62
63
|
|
|
63
|
-
|
|
64
64
|
### Features
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
- types improvements ([#67](https://github.com/gravity-ui/chartkit/issues/67)) ([33b4f07](https://github.com/gravity-ui/chartkit/commit/33b4f07a24abdfde52005ddbbf17fb7a25817beb))
|
|
67
67
|
|
|
68
68
|
## [0.10.1](https://github.com/gravity-ui/chartkit/compare/v0.10.0...v0.10.1) (2022-11-18)
|
|
69
69
|
|
|
70
|
-
|
|
71
70
|
### Bug Fixes
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
- **Highcharts plugin:** add Highcharts lib type export ([#65](https://github.com/gravity-ui/chartkit/issues/65)) ([de24a26](https://github.com/gravity-ui/chartkit/commit/de24a264197441b21261438808838e5fbd0a8402))
|
|
74
73
|
|
|
75
74
|
## [0.10.0](https://github.com/gravity-ui/chartkit/compare/v0.9.1...v0.10.0) (2022-11-18)
|
|
76
75
|
|
|
77
|
-
|
|
78
76
|
### Features
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
- add highcharts plugin ([#61](https://github.com/gravity-ui/chartkit/issues/61)) ([9329ede](https://github.com/gravity-ui/chartkit/commit/9329edeaba8c4ef84b1fc30bb7196ba350dc3abd))
|
|
82
79
|
|
|
83
80
|
### Bug Fixes
|
|
84
81
|
|
|
85
|
-
|
|
82
|
+
- yagr & indicator types fixes ([#64](https://github.com/gravity-ui/chartkit/issues/64)) ([479c552](https://github.com/gravity-ui/chartkit/commit/479c552f5ce1890451f3f104fc8efb730f2baf67))
|
|
86
83
|
|
|
87
84
|
## [0.9.1](https://github.com/gravity-ui/chartkit/compare/v0.9.0...v0.9.1) (2022-11-14)
|
|
88
85
|
|
|
89
|
-
|
|
90
86
|
### Bug Fixes
|
|
91
87
|
|
|
92
|
-
|
|
88
|
+
- fix yagr theme initialization ([#59](https://github.com/gravity-ui/chartkit/issues/59)) ([7247873](https://github.com/gravity-ui/chartkit/commit/724787380b8d81f6dfdaae1f6e5c1b806af32e3c))
|
|
93
89
|
|
|
94
90
|
## [0.9.0](https://github.com/gravity-ui/chartkit/compare/v0.8.0...v0.9.0) (2022-11-08)
|
|
95
91
|
|
|
96
|
-
|
|
97
92
|
### Features
|
|
98
93
|
|
|
99
|
-
|
|
94
|
+
- add isMobile property ([#57](https://github.com/gravity-ui/chartkit/issues/57)) ([a2e87ed](https://github.com/gravity-ui/chartkit/commit/a2e87edf1d05705fb92c2571b5a71496c48d9215))
|
|
100
95
|
|
|
101
96
|
## [0.8.0](https://github.com/gravity-ui/chartkit/compare/v0.7.2...v0.8.0) (2022-10-04)
|
|
102
97
|
|
|
103
|
-
|
|
104
98
|
### Features
|
|
105
99
|
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
- move to @gravity-ui/i18n ([#45](https://github.com/gravity-ui/chartkit/issues/45)) ([ad401d8](https://github.com/gravity-ui/chartkit/commit/ad401d85bf50ab4ceb0ae8a837c4b11cd36a4acd))
|
|
108
101
|
|
|
109
102
|
### Bug Fixes
|
|
110
103
|
|
|
111
|
-
|
|
104
|
+
- add ChartKitOnError type export ([#54](https://github.com/gravity-ui/chartkit/issues/54)) ([7660be7](https://github.com/gravity-ui/chartkit/commit/7660be756cd3ec1057aa9fd4bb45226c9632e80f))
|
|
112
105
|
|
|
113
106
|
## [0.7.2](https://github.com/gravity-ui/chartkit/compare/v0.7.1...v0.7.2) (2022-10-03)
|
|
114
107
|
|
|
115
|
-
|
|
116
108
|
### Bug Fixes
|
|
117
109
|
|
|
118
|
-
|
|
110
|
+
- package.json fixes ([#50](https://github.com/gravity-ui/chartkit/issues/50)) ([aca306d](https://github.com/gravity-ui/chartkit/commit/aca306dc8872951a48c1db0362ae1912138d72ed))
|
|
119
111
|
|
|
120
112
|
## [0.7.1](https://github.com/gravity-ui/chartkit/compare/v0.7.0...v0.7.1) (2022-10-03)
|
|
121
113
|
|
|
122
|
-
|
|
123
114
|
### Bug Fixes
|
|
124
115
|
|
|
125
|
-
|
|
116
|
+
- move to gravity-ui configs ([#48](https://github.com/gravity-ui/chartkit/issues/48)) ([620587b](https://github.com/gravity-ui/chartkit/commit/620587b41febade698f12e67506aab683934e7b3))
|
|
126
117
|
|
|
127
118
|
## [0.7.0](https://github.com/yandex-cloud/chartkit/compare/v0.6.0...v0.7.0) (2022-10-01)
|
|
128
119
|
|
|
129
|
-
|
|
130
120
|
### Features
|
|
131
121
|
|
|
132
|
-
|
|
122
|
+
- use gravity-ui/uikit instead of yandex-cloud/uikit ([#46](https://github.com/yandex-cloud/chartkit/issues/46)) ([afb2300](https://github.com/yandex-cloud/chartkit/commit/afb230036bb26573159e5f03e0972653b6692d86))
|
|
133
123
|
|
|
134
124
|
## [0.6.0](https://github.com/yandex-cloud/chartkit/compare/v0.5.4...v0.6.0) (2022-08-12)
|
|
135
125
|
|
|
136
|
-
|
|
137
126
|
### Features
|
|
138
127
|
|
|
139
|
-
|
|
128
|
+
- remove uikit css variables proxing ([#43](https://github.com/yandex-cloud/chartkit/issues/43)) ([4d5131e](https://github.com/yandex-cloud/chartkit/commit/4d5131e0d77270e44bef94f0ba05c9fc5c317704))
|
|
140
129
|
|
|
141
130
|
## [0.5.4](https://github.com/yandex-cloud/chartkit/compare/v0.5.3...v0.5.4) (2022-08-08)
|
|
142
131
|
|
|
143
|
-
|
|
144
132
|
### Bug Fixes
|
|
145
133
|
|
|
146
|
-
|
|
147
|
-
|
|
134
|
+
- add Yagr type export ([#42](https://github.com/yandex-cloud/chartkit/issues/42)) ([a8b9475](https://github.com/yandex-cloud/chartkit/commit/a8b94755bbb0d42652db3e4266e0ca04481ad99f))
|
|
135
|
+
- npm vulnerabilities fixes ([#40](https://github.com/yandex-cloud/chartkit/issues/40)) ([1509bcf](https://github.com/yandex-cloud/chartkit/commit/1509bcf87a50d9281c3ea47074c694db429ad5d4))
|
|
148
136
|
|
|
149
137
|
## [0.5.3](https://github.com/yandex-cloud/chartkit/compare/v0.5.2...v0.5.3) (2022-08-01)
|
|
150
138
|
|
|
151
|
-
|
|
152
139
|
### Bug Fixes
|
|
153
140
|
|
|
154
|
-
|
|
141
|
+
- dev and peer dependencies fixes ([#36](https://github.com/yandex-cloud/chartkit/issues/36)) ([faeccd9](https://github.com/yandex-cloud/chartkit/commit/faeccd9aca9b84ee02edeadef3db2d2abeedb143))
|
|
155
142
|
|
|
156
143
|
## [0.5.2](https://github.com/yandex-cloud/chartkit/compare/v0.5.1...v0.5.2) (2022-07-28)
|
|
157
144
|
|
|
158
|
-
|
|
159
145
|
### Bug Fixes
|
|
160
146
|
|
|
161
|
-
|
|
147
|
+
- Indicator onLoad invocation fixes ([#34](https://github.com/yandex-cloud/chartkit/issues/34)) ([95fafc3](https://github.com/yandex-cloud/chartkit/commit/95fafc381bbafe47173f802310a67e7ced243d80))
|
|
162
148
|
|
|
163
149
|
## [0.5.1](https://github.com/yandex-cloud/chartkit/compare/v0.5.0...v0.5.1) (2022-07-27)
|
|
164
150
|
|
|
165
|
-
|
|
166
151
|
### Bug Fixes
|
|
167
152
|
|
|
168
|
-
|
|
153
|
+
- error handling fixes ([#31](https://github.com/yandex-cloud/chartkit/issues/31)) ([e20fb9d](https://github.com/yandex-cloud/chartkit/commit/e20fb9df1d811efa08a8a68110b1a6819a384af4))
|
|
169
154
|
|
|
170
155
|
## [0.5.0](https://github.com/yandex-cloud/chartkit/compare/v0.4.0...v0.5.0) (2022-07-25)
|
|
171
156
|
|
|
172
|
-
|
|
173
157
|
### Features
|
|
174
158
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
159
|
+
- add chartkit-error ([#28](https://github.com/yandex-cloud/chartkit/issues/28)) ([8342073](https://github.com/yandex-cloud/chartkit/commit/83420738dd431fa1ce2b96f18631f84ca36ed4af))
|
|
160
|
+
- add indicator chart ([#30](https://github.com/yandex-cloud/chartkit/issues/30)) ([4f465de](https://github.com/yandex-cloud/chartkit/commit/4f465de3afdee721f96868d975f3aee647177f76))
|
|
161
|
+
- change error handling ([#29](https://github.com/yandex-cloud/chartkit/issues/29)) ([993958a](https://github.com/yandex-cloud/chartkit/commit/993958a68e1c4376e037bd006d6b19f013b58cfb))
|
|
179
162
|
|
|
180
163
|
### Bug Fixes
|
|
181
164
|
|
|
182
|
-
|
|
165
|
+
- remove react-dom from peer dependencies ([#26](https://github.com/yandex-cloud/chartkit/issues/26)) ([22b6525](https://github.com/yandex-cloud/chartkit/commit/22b6525c767104e56cc51cf5dee5340253f7c080))
|
|
183
166
|
|
|
184
167
|
## [0.4.0](https://github.com/yandex-cloud/chartkit/compare/v0.3.1...v0.4.0) (2022-07-18)
|
|
185
168
|
|
|
186
|
-
|
|
187
169
|
### Features
|
|
188
170
|
|
|
189
|
-
|
|
171
|
+
- add onError property ([#24](https://github.com/yandex-cloud/chartkit/issues/24)) ([0b51f19](https://github.com/yandex-cloud/chartkit/commit/0b51f195612cb80ab8e40b5d115eb7650f986888))
|
|
190
172
|
|
|
191
173
|
## [0.3.1](https://github.com/yandex-cloud/chartkit/compare/v0.3.0...v0.3.1) (2022-07-14)
|
|
192
174
|
|
|
193
|
-
|
|
194
175
|
### Bug Fixes
|
|
195
176
|
|
|
196
|
-
|
|
197
|
-
|
|
177
|
+
- add test for settings ([#21](https://github.com/yandex-cloud/chartkit/issues/21)) ([b848503](https://github.com/yandex-cloud/chartkit/commit/b8485032d9ab14edda0a8f193f9174e3a6c687bf))
|
|
178
|
+
- build task fixes ([#23](https://github.com/yandex-cloud/chartkit/issues/23)) ([2f13233](https://github.com/yandex-cloud/chartkit/commit/2f13233005d8fe7d10d496464ec3aed0a9ea5743))
|
|
198
179
|
|
|
199
180
|
## [0.3.0](https://github.com/yandex-cloud/chartkit/compare/v0.2.0...v0.3.0) (2022-07-13)
|
|
200
181
|
|
|
201
|
-
|
|
202
182
|
### Features
|
|
203
183
|
|
|
204
|
-
|
|
184
|
+
- add root types export ([#18](https://github.com/yandex-cloud/chartkit/issues/18)) ([06265a1](https://github.com/yandex-cloud/chartkit/commit/06265a10f518836ac63f2b847e73dd19b3e2e8ca))
|
|
205
185
|
|
|
206
186
|
## [0.2.0](https://github.com/yandex-cloud/chartkit/compare/v0.1.1...v0.2.0) (2022-07-11)
|
|
207
187
|
|
|
208
|
-
|
|
209
188
|
### Features
|
|
210
189
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
190
|
+
- add cn lib ([#10](https://github.com/yandex-cloud/chartkit/issues/10)) ([796bdda](https://github.com/yandex-cloud/chartkit/commit/796bdda22fbf69ea8fc37965486e358ea3779a7e))
|
|
191
|
+
- add i18n ([#13](https://github.com/yandex-cloud/chartkit/issues/13)) ([3f0204b](https://github.com/yandex-cloud/chartkit/commit/3f0204bb949aeb596632b3479d7e5ee130d91225))
|
|
192
|
+
- add reflow handler ([#15](https://github.com/yandex-cloud/chartkit/issues/15)) ([80210af](https://github.com/yandex-cloud/chartkit/commit/80210af775ca7476f107f6ecc2ae9983baa9a8e3))
|
|
193
|
+
- add yagr plugin types export ([#17](https://github.com/yandex-cloud/chartkit/issues/17)) ([6e4cf1d](https://github.com/yandex-cloud/chartkit/commit/6e4cf1dc5cc584a9bda99b39122f489ed35f90e2))
|
|
194
|
+
- change lib structure ([#7](https://github.com/yandex-cloud/chartkit/issues/7)) ([dfb6ed8](https://github.com/yandex-cloud/chartkit/commit/dfb6ed839fd49a13006e75bca77abfd43849653b))
|
|
217
195
|
|
|
218
196
|
### Bug Fixes
|
|
219
197
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
198
|
+
- change cn workflow ([#12](https://github.com/yandex-cloud/chartkit/issues/12)) ([aba5148](https://github.com/yandex-cloud/chartkit/commit/aba5148237aa0dd0bfd89744c77e30ebbcbcb90e))
|
|
199
|
+
- downgrade i18n to v0.5.0 ([#16](https://github.com/yandex-cloud/chartkit/issues/16)) ([454985a](https://github.com/yandex-cloud/chartkit/commit/454985a6c339775ebc0a96d77a20792b31b305c7))
|
|
200
|
+
- move all storybook decorators into one ([#14](https://github.com/yandex-cloud/chartkit/issues/14)) ([de1e8e9](https://github.com/yandex-cloud/chartkit/commit/de1e8e90325142e41ece8edc785119440b49fa0c))
|
|
223
201
|
|
|
224
202
|
### [0.1.1](https://www.github.com/yandex-cloud/ChartKit/compare/v0.1.0...v0.1.1) (2022-02-17)
|
|
225
203
|
|
|
226
|
-
|
|
227
204
|
### Bug Fixes
|
|
228
205
|
|
|
229
|
-
|
|
206
|
+
- add publishConfig ([5cfdfff](https://www.github.com/yandex-cloud/ChartKit/commit/5cfdfffbdcafb8baeb05338ef07dd3a602c51797))
|
|
230
207
|
|
|
231
208
|
## 0.1.0 (2022-02-17)
|
|
232
209
|
|
|
233
|
-
|
|
234
210
|
### Bug Fixes
|
|
235
211
|
|
|
236
|
-
|
|
237
|
-
|
|
212
|
+
- init ([2804dac](https://www.github.com/yandex-cloud/ChartKit/commit/2804dacfd0f11e15cda6a84ca22172bf2d74b532))
|
|
213
|
+
- init ([4b747d4](https://www.github.com/yandex-cloud/ChartKit/commit/4b747d409122fc4ae330040e75e273ee9a602bcf))
|
package/README.md
CHANGED
|
@@ -36,21 +36,21 @@ const data: YagrWidgetData = {
|
|
|
36
36
|
id: '0',
|
|
37
37
|
name: 'Serie 1',
|
|
38
38
|
color: '#6c59c2',
|
|
39
|
-
visible: true,
|
|
40
39
|
data: [25, 52, 89, 72, 39, 49, 82, 59, 36, 5],
|
|
41
40
|
},
|
|
42
41
|
{
|
|
43
42
|
id: '1',
|
|
44
43
|
name: 'Serie 2',
|
|
45
44
|
color: '#6e8188',
|
|
46
|
-
visible: true,
|
|
47
45
|
data: [37, 6, 51, 10, 65, 35, 72, 0, 94, 54],
|
|
48
46
|
},
|
|
49
47
|
],
|
|
50
48
|
},
|
|
51
49
|
libraryConfig: {
|
|
52
50
|
chart: {
|
|
53
|
-
|
|
51
|
+
series: {
|
|
52
|
+
type: 'line',
|
|
53
|
+
},
|
|
54
54
|
},
|
|
55
55
|
title: {
|
|
56
56
|
text: 'line: random 10 pts',
|
package/build/plugins/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { YagrPlugin } from './yagr';
|
|
2
|
-
export
|
|
2
|
+
export * from './yagr/types';
|
|
3
3
|
export { IndicatorPlugin } from './indicator';
|
|
4
4
|
export type { IndicatorWidgetData } from './indicator/types';
|
|
5
5
|
export { HighchartsPlugin } from './highcharts';
|
package/build/plugins/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { shapeYagrConfig } from '../renderer/utils';
|
|
2
|
+
const DATA = {
|
|
3
|
+
timeline: [1],
|
|
4
|
+
graphs: [{ data: [45] }],
|
|
5
|
+
};
|
|
6
|
+
describe('plugins/yagr/utils', () => {
|
|
7
|
+
describe('shapeYagrConfig > check chart property', () => {
|
|
8
|
+
test.each([
|
|
9
|
+
[{}, { appereance: { locale: 'en', theme: 'dark' } }],
|
|
10
|
+
[{ appereance: { locale: 'ru' } }, { appereance: { locale: 'ru', theme: 'dark' } }],
|
|
11
|
+
[{ appereance: { theme: 'light' } }, { appereance: { locale: 'en', theme: 'light' } }],
|
|
12
|
+
[
|
|
13
|
+
{ series: { type: 'dots' }, select: { zoom: false }, timeMultiplier: 1 },
|
|
14
|
+
{
|
|
15
|
+
appereance: { locale: 'en', theme: 'dark' },
|
|
16
|
+
series: { type: 'dots' },
|
|
17
|
+
select: { zoom: false },
|
|
18
|
+
timeMultiplier: 1,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
])('(args: %j)', (chart, expected) => {
|
|
22
|
+
const config = shapeYagrConfig({ data: DATA, libraryConfig: { chart }, theme: 'dark' });
|
|
23
|
+
expect(config.chart).toEqual(expected);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TooltipRenderOptions } from '
|
|
1
|
+
import type { TooltipRenderOptions } from '../../types';
|
|
2
2
|
export declare const renderTooltip: (data: TooltipRenderOptions) => string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { MinimalValidConfig } from 'yagr';
|
|
2
1
|
import type { YagrChartProps } from 'yagr/dist/react';
|
|
3
|
-
import type { YagrWidgetData } from '../types';
|
|
2
|
+
import type { YagrWidgetData, MinimalValidConfig } from '../types';
|
|
4
3
|
export declare const useWidgetData: (args: YagrWidgetData & {
|
|
5
4
|
id: string;
|
|
6
5
|
}) => {
|
|
@@ -1,32 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useThemeType } from '@gravity-ui/uikit';
|
|
3
|
-
import {
|
|
4
|
-
import { settings } from '../../../libs';
|
|
5
|
-
import { renderTooltip } from './tooltip';
|
|
6
|
-
import { getXAxisFormatter } from './utils';
|
|
3
|
+
import { shapeYagrConfig } from './utils';
|
|
7
4
|
export const useWidgetData = (args) => {
|
|
8
5
|
const { id, data, sources, libraryConfig } = args;
|
|
9
6
|
const theme = useThemeType();
|
|
10
|
-
const config = React.useMemo(() => {
|
|
11
|
-
var _a, _b, _c;
|
|
12
|
-
const result = Object.assign(Object.assign({}, libraryConfig), { timeline: data.timeline, series: data.graphs });
|
|
13
|
-
result.chart = Object.assign({ appereance: Object.assign({ locale: settings.get('lang'), theme }, (_a = result.chart) === null || _a === void 0 ? void 0 : _a.appereance) }, result.chart);
|
|
14
|
-
if (((_b = result.tooltip) === null || _b === void 0 ? void 0 : _b.show) !== false) {
|
|
15
|
-
result.tooltip = result.tooltip || {};
|
|
16
|
-
result.tooltip.render = ((_c = result.tooltip) === null || _c === void 0 ? void 0 : _c.render) || renderTooltip;
|
|
17
|
-
}
|
|
18
|
-
result.axes = result.axes || {};
|
|
19
|
-
const xAxis = result.axes[defaults.DEFAULT_X_SCALE];
|
|
20
|
-
if (xAxis && !xAxis.values) {
|
|
21
|
-
xAxis.values = getXAxisFormatter(result.chart.timeMultiplier);
|
|
22
|
-
}
|
|
23
|
-
if (!xAxis) {
|
|
24
|
-
result.axes[defaults.DEFAULT_X_SCALE] = {
|
|
25
|
-
values: getXAxisFormatter(result.chart.timeMultiplier),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
return result;
|
|
29
|
-
}, [data, libraryConfig, theme]);
|
|
7
|
+
const config = React.useMemo(() => shapeYagrConfig({ data, libraryConfig, theme }), [data, libraryConfig, theme]);
|
|
30
8
|
const debug = React.useMemo(() => {
|
|
31
9
|
const filename = sources
|
|
32
10
|
? Object.values(sources)
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Yagr, YagrWidgetData, YagrTheme, MinimalValidConfig } from '../types';
|
|
2
|
+
declare type ShapeYagrConfigArgs = {
|
|
3
|
+
data: YagrWidgetData['data'];
|
|
4
|
+
libraryConfig: YagrWidgetData['libraryConfig'];
|
|
5
|
+
theme: YagrTheme;
|
|
6
|
+
};
|
|
2
7
|
export declare const synchronizeTooltipTablesCellsWidth: (tooltipContainer: HTMLElement) => void;
|
|
3
8
|
export declare const checkFocus: (args: {
|
|
4
9
|
tooltip: HTMLElement;
|
|
@@ -10,6 +15,7 @@ export declare const detectClickOutside: (args: {
|
|
|
10
15
|
pin: (state: boolean) => void;
|
|
11
16
|
hide: () => void;
|
|
12
17
|
};
|
|
13
|
-
yagr?: Yagr<
|
|
18
|
+
yagr?: Yagr<MinimalValidConfig> | undefined;
|
|
14
19
|
}) => (event: MouseEvent) => void;
|
|
15
|
-
export declare const
|
|
20
|
+
export declare const shapeYagrConfig: (args: ShapeYagrConfigArgs) => MinimalValidConfig;
|
|
21
|
+
export {};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
|
+
import merge from 'lodash/merge';
|
|
3
|
+
import { defaults } from 'yagr';
|
|
4
|
+
import { settings } from '../../../libs';
|
|
5
|
+
import { renderTooltip } from './tooltip';
|
|
2
6
|
const TOOLTIP_HEADER_CLASS_NAME = '_tooltip-header';
|
|
3
7
|
const TOOLTIP_LIST_CLASS_NAME = '_tooltip-list';
|
|
4
8
|
export const synchronizeTooltipTablesCellsWidth = (tooltipContainer) => {
|
|
@@ -68,7 +72,7 @@ export const detectClickOutside = (args) => (event) => {
|
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
};
|
|
71
|
-
|
|
75
|
+
const getXAxisFormatter = (msm = 1) => (_, ticks) => {
|
|
72
76
|
const range = (ticks[ticks.length - 1] - ticks[0]) / msm;
|
|
73
77
|
return ticks.map((rawValue) => {
|
|
74
78
|
const d = moment(rawValue / msm);
|
|
@@ -78,3 +82,35 @@ export const getXAxisFormatter = (msm = 1) => (_, ticks) => {
|
|
|
78
82
|
return d.format(range < 300 ? 'HH:mm:ss' : 'HH:mm');
|
|
79
83
|
});
|
|
80
84
|
};
|
|
85
|
+
export const shapeYagrConfig = (args) => {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const { data, libraryConfig, theme } = args;
|
|
88
|
+
const config = Object.assign(Object.assign({}, libraryConfig), { timeline: data.timeline, series: data.graphs });
|
|
89
|
+
const chart = {
|
|
90
|
+
appereance: {
|
|
91
|
+
locale: settings.get('lang'),
|
|
92
|
+
theme,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
merge(chart, config.chart);
|
|
96
|
+
config.chart = chart;
|
|
97
|
+
if ((_a = config.tooltip) === null || _a === void 0 ? void 0 : _a.show) {
|
|
98
|
+
config.tooltip = config.tooltip || {};
|
|
99
|
+
config.tooltip.render = ((_b = config.tooltip) === null || _b === void 0 ? void 0 : _b.render) || renderTooltip;
|
|
100
|
+
if (!config.tooltip.className) {
|
|
101
|
+
// "className" property prevent default yagr styles adding
|
|
102
|
+
config.tooltip.className = 'chartkit-yagr-tooltip';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
config.axes = config.axes || {};
|
|
106
|
+
const xAxis = config.axes[defaults.DEFAULT_X_SCALE];
|
|
107
|
+
if (xAxis && !xAxis.values) {
|
|
108
|
+
xAxis.values = getXAxisFormatter(config.chart.timeMultiplier);
|
|
109
|
+
}
|
|
110
|
+
if (!xAxis) {
|
|
111
|
+
config.axes[defaults.DEFAULT_X_SCALE] = {
|
|
112
|
+
values: getXAxisFormatter(config.chart.timeMultiplier),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return config;
|
|
116
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export
|
|
1
|
+
import type { RawSerieData, YagrConfig } from 'yagr';
|
|
2
|
+
export type { default as Yagr } from 'yagr';
|
|
3
|
+
export * from 'yagr/dist/types';
|
|
3
4
|
export declare type YagrWidgetData = {
|
|
4
5
|
data: {
|
|
5
6
|
graphs: RawSerieData[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from 'yagr/dist/types';
|
package/build/types/widget.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type Yagr from 'yagr';
|
|
2
|
-
import type { YagrWidgetData } from '../plugins/yagr/types';
|
|
1
|
+
import type { Yagr, YagrWidgetData } from '../plugins/yagr/types';
|
|
3
2
|
import type { IndicatorWidgetData } from '../plugins/indicator/types';
|
|
4
3
|
import type { Highcharts, HighchartsWidgetData, StringParams } from '../plugins/highcharts/types';
|
|
5
4
|
export interface ChartKitWidget {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/chartkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"highcharts-react-official": "^3.0.0",
|
|
19
19
|
"lodash": "^4.17.21",
|
|
20
20
|
"react-split-pane": "^0.1.92",
|
|
21
|
-
"yagr": "^2.0
|
|
21
|
+
"yagr": "^2.1.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@gravity-ui/eslint-config": "^1.0.2",
|