@gravity-ui/chartkit 2.10.0 → 2.10.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 +7 -0
- package/build/plugins/highcharts/__stories__/pie/WithTotals.stories.d.ts +4 -0
- package/build/plugins/highcharts/__stories__/pie/WithTotals.stories.js +12 -0
- package/build/plugins/highcharts/mocks/pie-with-totals.d.ts +2 -0
- package/build/plugins/highcharts/mocks/pie-with-totals.js +43 -0
- package/build/plugins/highcharts/renderer/helpers/config/config.js +4 -1
- package/build/plugins/highcharts/types/widget.d.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.10.1](https://github.com/gravity-ui/chartkit/compare/v2.10.0...v2.10.1) (2023-06-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **Highcharts plugin:** show totals of selected series on legend click ([#176](https://github.com/gravity-ui/chartkit/issues/176)) ([ac7fe22](https://github.com/gravity-ui/chartkit/commit/ac7fe224363f7379f6dd35db0a3a682cdc7a2bc2))
|
|
9
|
+
|
|
3
10
|
## [2.10.0](https://github.com/gravity-ui/chartkit/compare/v2.9.0...v2.10.0) (2023-06-05)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChartKit } from '../../../../components/ChartKit';
|
|
3
|
+
import { data } from '../../mocks/pie-with-totals';
|
|
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 WithTotals = Template.bind({});
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
totals: 42769,
|
|
29
|
+
},
|
|
30
|
+
config: {
|
|
31
|
+
showPercentInTooltip: true,
|
|
32
|
+
},
|
|
33
|
+
libraryConfig: {
|
|
34
|
+
chart: {
|
|
35
|
+
type: 'pie',
|
|
36
|
+
},
|
|
37
|
+
plotOptions: {
|
|
38
|
+
pie: {
|
|
39
|
+
innerSize: '50%',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -1227,11 +1227,14 @@ export function prepareConfig(data, options, isMobile, holidays) {
|
|
|
1227
1227
|
} }, (chartType === 'pie' &&
|
|
1228
1228
|
totals && {
|
|
1229
1229
|
render: function () {
|
|
1230
|
+
var _a;
|
|
1230
1231
|
const chart = this;
|
|
1231
1232
|
const chartSeries = chart.series[0];
|
|
1232
1233
|
const innerWidth = chartSeries === null || chartSeries === void 0 ? void 0 : chartSeries.center[3];
|
|
1234
|
+
const formatOptions = (_a = chartSeries === null || chartSeries === void 0 ? void 0 : chartSeries.userOptions) === null || _a === void 0 ? void 0 : _a.tooltip;
|
|
1235
|
+
const value = formatDonutTotals(chartSeries === null || chartSeries === void 0 ? void 0 : chartSeries.total, formatOptions) || totals;
|
|
1233
1236
|
if (innerWidth) {
|
|
1234
|
-
debouncedAdjustDonutFontSize(chart, chartSeries, innerWidth,
|
|
1237
|
+
debouncedAdjustDonutFontSize(chart, chartSeries, innerWidth, value);
|
|
1235
1238
|
}
|
|
1236
1239
|
},
|
|
1237
1240
|
})),
|
package/package.json
CHANGED