awing-library 2.1.203-dev → 2.1.204-dev
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.
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChartOptions, ChartType } from 'chart.js';
|
|
2
2
|
import { ChartProps, TypedChartComponent } from 'react-chartjs-2/dist/types';
|
|
3
3
|
export interface IPieComponent extends ChartProps {
|
|
4
|
-
dataConvert?: ChartData<ChartType>;
|
|
5
4
|
widthChart?: number;
|
|
6
5
|
heightChart?: number;
|
|
7
6
|
optionCustom?: ChartOptions<ChartType>;
|
|
8
|
-
chart: TypedChartComponent<
|
|
7
|
+
chart: TypedChartComponent<'pie'>;
|
|
9
8
|
}
|
|
10
|
-
declare const PieComponent: ({ chart, data,
|
|
9
|
+
declare const PieComponent: ({ chart, data, widthChart, heightChart, optionCustom, options, }: IPieComponent) => import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export default PieComponent;
|
|
@@ -11,17 +11,7 @@ var chartColorDefaults = [
|
|
|
11
11
|
'#4a536b',
|
|
12
12
|
];
|
|
13
13
|
var PieComponent = function (_a) {
|
|
14
|
-
var chart = _a.chart, data = _a.data, _b = _a.
|
|
15
|
-
labels: [],
|
|
16
|
-
datasets: [
|
|
17
|
-
{
|
|
18
|
-
data: [],
|
|
19
|
-
backgroundColor: chartColorDefaults,
|
|
20
|
-
borderColor: 'white',
|
|
21
|
-
borderWidth: 2,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
} : _b, _c = _a.widthChart, widthChart = _c === void 0 ? 300 : _c, _d = _a.heightChart, heightChart = _d === void 0 ? 300 : _d, _e = _a.optionCustom, optionCustom = _e === void 0 ? {} : _e, _f = _a.options, options = _f === void 0 ? {
|
|
14
|
+
var chart = _a.chart, data = _a.data, _b = _a.widthChart, widthChart = _b === void 0 ? 300 : _b, _c = _a.heightChart, heightChart = _c === void 0 ? 300 : _c, _d = _a.optionCustom, optionCustom = _d === void 0 ? {} : _d, _e = _a.options, options = _e === void 0 ? {
|
|
25
15
|
responsive: true,
|
|
26
16
|
elements: {
|
|
27
17
|
arc: {
|
|
@@ -70,8 +60,19 @@ var PieComponent = function (_a) {
|
|
|
70
60
|
},
|
|
71
61
|
},
|
|
72
62
|
},
|
|
73
|
-
} :
|
|
63
|
+
} : _e;
|
|
74
64
|
var Pie = chart;
|
|
75
|
-
|
|
65
|
+
var dataConvert = {
|
|
66
|
+
labels: [],
|
|
67
|
+
datasets: [
|
|
68
|
+
{
|
|
69
|
+
data: [],
|
|
70
|
+
backgroundColor: chartColorDefaults.slice(0, data.datasets[0].data.length),
|
|
71
|
+
borderColor: 'white',
|
|
72
|
+
borderWidth: 2,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(Pie, { data: (0, Helpers_1.updateObjectFields)(dataConvert, data), width: widthChart, height: heightChart, options: (0, Helpers_1.updateObjectFields)(options, optionCustom) }));
|
|
76
77
|
};
|
|
77
78
|
exports.default = PieComponent;
|