@gravity-ui/chartkit 1.6.4 → 1.6.5

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.6.5](https://github.com/gravity-ui/chartkit/compare/v1.6.4...v1.6.5) (2023-02-10)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **Highcharts plugin:** fix optional id usage for series identifier ([#125](https://github.com/gravity-ui/chartkit/issues/125)) ([f08b414](https://github.com/gravity-ui/chartkit/commit/f08b4145360db78c9efc6bd056772cd9f21a5fdb))
9
+
3
10
  ## [1.6.4](https://github.com/gravity-ui/chartkit/compare/v1.6.3...v1.6.4) (2023-02-09)
4
11
 
5
12
 
@@ -2,6 +2,7 @@ export const data = {
2
2
  data: {
3
3
  graphs: [
4
4
  {
5
+ id: 'uniq-1',
5
6
  title: 'Office Supplies',
6
7
  tooltip: {
7
8
  chartKitFormatting: true,
@@ -90,6 +91,7 @@ export const data = {
90
91
  type: 'line',
91
92
  },
92
93
  {
94
+ id: 'uniq-2',
93
95
  title: 'Technology',
94
96
  tooltip: {
95
97
  chartKitFormatting: true,
@@ -136,6 +138,7 @@ export const data = {
136
138
  type: 'line',
137
139
  },
138
140
  {
141
+ id: 'uniq-3',
139
142
  title: 'Furniture',
140
143
  tooltip: {
141
144
  chartKitFormatting: true,
@@ -196,6 +199,7 @@ export const data = {
196
199
  type: 'line',
197
200
  },
198
201
  {
202
+ id: 'uniq-4',
199
203
  title: 'Furniture',
200
204
  tooltip: {
201
205
  chartKitFormatting: true,
@@ -256,6 +260,7 @@ export const data = {
256
260
  stack: 'c44bfc70-a7a5-11ed-96a0-9bb7dddec993__',
257
261
  },
258
262
  {
263
+ id: 'uniq-5',
259
264
  title: 'Office Supplies',
260
265
  tooltip: {
261
266
  chartKitFormatting: true,
@@ -344,6 +349,7 @@ export const data = {
344
349
  stack: 'c44bfc70-a7a5-11ed-96a0-9bb7dddec993__',
345
350
  },
346
351
  {
352
+ id: 'uniq-6',
347
353
  title: 'Technology',
348
354
  tooltip: {
349
355
  chartKitFormatting: true,
@@ -1,32 +1,32 @@
1
1
  import { drawComments, hideComments } from '../comments/drawing';
2
2
  import { isNavigatorSeries } from './utils';
3
- const getUniqueSeriesName = (series) => {
4
- return `${series.name}__${series.index}`;
3
+ const getSeriesIdentifier = (series) => {
4
+ return series.userOptions.id || series.name;
5
5
  };
6
6
  const needSetVisible = (seriesName, seriesVisible, chartSeries) => {
7
7
  if (!seriesVisible) {
8
8
  return false;
9
9
  }
10
10
  const hasAnotherVisibleSeries = chartSeries
11
- .filter((series) => series.options.showInLegend !== false && getUniqueSeriesName(series) !== seriesName)
11
+ .filter((series) => series.options.showInLegend !== false && getSeriesIdentifier(series) !== seriesName)
12
12
  .some((series) => series.visible);
13
13
  return seriesVisible && !hasAnotherVisibleSeries;
14
14
  };
15
15
  const updateSeries = (series, chartSeries, type) => {
16
- const clickedSeriesName = getUniqueSeriesName(series);
16
+ const clickedSeriesName = getSeriesIdentifier(series);
17
17
  switch (type) {
18
18
  case 'extended': {
19
19
  chartSeries.forEach((item) => {
20
- if (getUniqueSeriesName(item) === clickedSeriesName) {
20
+ if (getSeriesIdentifier(item) === clickedSeriesName) {
21
21
  item.setVisible(!item.visible, false);
22
22
  }
23
23
  });
24
24
  break;
25
25
  }
26
26
  case 'default': {
27
- const visible = needSetVisible(getUniqueSeriesName(series), series.visible, chartSeries);
27
+ const visible = needSetVisible(getSeriesIdentifier(series), series.visible, chartSeries);
28
28
  chartSeries.forEach((item) => {
29
- if (getUniqueSeriesName(item) === clickedSeriesName) {
29
+ if (getSeriesIdentifier(item) === clickedSeriesName) {
30
30
  item.setVisible(true, false);
31
31
  }
32
32
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/chartkit",
3
- "version": "1.6.4",
3
+ "version": "1.6.5",
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",