@pie-element/fraction-model 4.3.4-next.0 → 5.0.0-beta.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/configure/lib/card-bar.js +45 -66
- package/configure/lib/card-bar.js.map +1 -1
- package/configure/lib/defaults.js +4 -5
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +127 -193
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +216 -276
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/model-options.js +119 -196
- package/configure/lib/model-options.js.map +1 -1
- package/configure/lib/number-text-field.js +31 -90
- package/configure/lib/number-text-field.js.map +1 -1
- package/configure/package.json +9 -6
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +66 -111
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +2 -2
- package/lib/answer-fraction.js +94 -159
- package/lib/answer-fraction.js.map +1 -1
- package/lib/fraction-model-chart.js +140 -219
- package/lib/fraction-model-chart.js.map +1 -1
- package/lib/index.js +68 -108
- package/lib/index.js.map +1 -1
- package/lib/main.js +150 -204
- package/lib/main.js.map +1 -1
- package/package.json +14 -14
|
@@ -1,181 +1,142 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
exports
|
|
11
|
-
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
6
|
+
exports.default = void 0;
|
|
16
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
8
|
var _recharts = require("recharts");
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
padding: '10px 0'
|
|
39
|
-
},
|
|
40
|
-
sectorOutline: {
|
|
41
|
-
outline: 'none'
|
|
9
|
+
var _styles = require("@mui/material/styles");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
const PieChartParentDiv = (0, _styles.styled)('div')({
|
|
12
|
+
display: 'grid',
|
|
13
|
+
gridTemplateColumns: '200px 200px 200px',
|
|
14
|
+
gap: '10px',
|
|
15
|
+
padding: '5px 0'
|
|
16
|
+
});
|
|
17
|
+
const BarChartParentDiv = (0, _styles.styled)('div')({
|
|
18
|
+
display: 'grid',
|
|
19
|
+
gridTemplateColumns: '200px 200px 200px',
|
|
20
|
+
gap: '20px',
|
|
21
|
+
padding: '10px 0'
|
|
22
|
+
});
|
|
23
|
+
const StyledPieChart = (0, _styles.styled)(_recharts.PieChart)({
|
|
24
|
+
'& .recharts-pie-sector': {
|
|
25
|
+
outline: 'none !important',
|
|
26
|
+
'&:focus': {
|
|
27
|
+
outline: 'none !important'
|
|
42
28
|
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
var FractionModelChart = function FractionModelChart(props) {
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const FractionModelChart = props => {
|
|
47
32
|
/*
|
|
48
33
|
* Function to handle click event on chart
|
|
49
34
|
* @param chartIndex: index of the chart
|
|
50
35
|
* @param sectorIndex: index of the sector
|
|
51
36
|
* */
|
|
52
|
-
|
|
37
|
+
const handleChartClick = (chartIndex, sectorIndex) => {
|
|
53
38
|
if (typeof sectorIndex === 'string') {
|
|
54
39
|
sectorIndex = parseInt(sectorIndex);
|
|
55
40
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return item.id === chartIndex;
|
|
59
|
-
});
|
|
60
|
-
var newClickedIndexArray;
|
|
61
|
-
|
|
41
|
+
const existingIndex = clickedIndexArray.findIndex(item => item.id === chartIndex);
|
|
42
|
+
let newClickedIndexArray;
|
|
62
43
|
if (existingIndex >= 0) {
|
|
63
|
-
|
|
64
|
-
|
|
44
|
+
const currentItem = clickedIndexArray[existingIndex];
|
|
65
45
|
if (currentItem.value === sectorIndex) {
|
|
66
|
-
newClickedIndexArray = clickedIndexArray.filter(
|
|
67
|
-
return index !== existingIndex;
|
|
68
|
-
});
|
|
46
|
+
newClickedIndexArray = clickedIndexArray.filter((_, index) => index !== existingIndex);
|
|
69
47
|
} else {
|
|
70
|
-
newClickedIndexArray = [
|
|
48
|
+
newClickedIndexArray = [...clickedIndexArray.slice(0, existingIndex), {
|
|
71
49
|
id: chartIndex,
|
|
72
50
|
value: sectorIndex
|
|
73
|
-
}
|
|
51
|
+
}, ...clickedIndexArray.slice(existingIndex + 1)];
|
|
74
52
|
}
|
|
75
53
|
} else {
|
|
76
|
-
newClickedIndexArray = [
|
|
54
|
+
newClickedIndexArray = [...clickedIndexArray, {
|
|
77
55
|
id: chartIndex,
|
|
78
56
|
value: sectorIndex
|
|
79
|
-
}]
|
|
57
|
+
}];
|
|
80
58
|
}
|
|
81
|
-
|
|
82
59
|
onChange(newClickedIndexArray);
|
|
83
60
|
setClickedIndexArray(newClickedIndexArray);
|
|
84
61
|
};
|
|
62
|
+
|
|
85
63
|
/*
|
|
86
64
|
* Function to handle mouse enter event on chart
|
|
87
65
|
* @param chartIndex: index of the chart
|
|
88
66
|
* @param sectorIndex: index of the sector
|
|
89
67
|
* */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var handleChartMouseEnter = function handleChartMouseEnter(chartIndex, sectorIndex) {
|
|
68
|
+
const handleChartMouseEnter = (chartIndex, sectorIndex) => {
|
|
93
69
|
setHoveredIndex(chartIndex + '-' + sectorIndex);
|
|
94
70
|
};
|
|
71
|
+
|
|
95
72
|
/*
|
|
96
73
|
* Function to handle mouse leave event on chart
|
|
97
|
-
* @param chartIndex: index of the chart
|
|
98
|
-
* @param sectorIndex: index of the sector
|
|
99
74
|
* */
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var handleChartMouseLeave = function handleChartMouseLeave(chartIndex, sectorIndex) {
|
|
75
|
+
const handleChartMouseLeave = () => {
|
|
103
76
|
setHoveredIndex(null);
|
|
104
77
|
};
|
|
78
|
+
|
|
105
79
|
/*
|
|
106
80
|
* Function to get fill color for sector
|
|
107
81
|
* @param hoveredIndex: hovered index
|
|
108
82
|
* @param selection: selected index
|
|
109
83
|
* */
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
_selection$split$map2 = (0, _slicedToArray2["default"])(_selection$split$map, 2),
|
|
115
|
-
selectionId = _selection$split$map2[0],
|
|
116
|
-
selectionValue = _selection$split$map2[1]; // Check for a matching clicked item
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var clickedItem = clickedIndexArray.find(function (item) {
|
|
120
|
-
return item.id === selectionId;
|
|
121
|
-
});
|
|
122
|
-
|
|
84
|
+
const getSectorFill = (hoveredIndex, selection) => {
|
|
85
|
+
const [selectionId, selectionValue] = selection.split('-').map(Number);
|
|
86
|
+
// Check for a matching clicked item
|
|
87
|
+
const clickedItem = clickedIndexArray.find(item => item.id === selectionId);
|
|
123
88
|
if (clickedItem && selectionValue <= clickedItem.value) {
|
|
124
89
|
return 'rgb(60, 73, 150, 0.6)';
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
90
|
+
}
|
|
91
|
+
// Check for a matching hovered index
|
|
128
92
|
if (hoveredIndex) {
|
|
129
|
-
|
|
130
|
-
_hoveredIndex$split$m2 = (0, _slicedToArray2["default"])(_hoveredIndex$split$m, 2),
|
|
131
|
-
hoveredId = _hoveredIndex$split$m2[0],
|
|
132
|
-
hoveredValue = _hoveredIndex$split$m2[1];
|
|
133
|
-
|
|
93
|
+
const [hoveredId, hoveredValue] = hoveredIndex.split('-').map(Number);
|
|
134
94
|
if (hoveredId === selectionId && hoveredValue >= selectionValue) {
|
|
135
95
|
return 'rgb(0, 0, 0, 0.25)';
|
|
136
96
|
}
|
|
137
97
|
}
|
|
138
|
-
|
|
139
98
|
return '#FFFFFF';
|
|
140
99
|
};
|
|
100
|
+
|
|
141
101
|
/*
|
|
142
102
|
* Function to render label for pie chart
|
|
143
103
|
* @param props: properties of the label
|
|
144
104
|
* */
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return /*#__PURE__*/_react
|
|
105
|
+
const renderCustomizedLabelForPie = props => {
|
|
106
|
+
const {
|
|
107
|
+
cx,
|
|
108
|
+
cy,
|
|
109
|
+
midAngle,
|
|
110
|
+
outerRadius,
|
|
111
|
+
index
|
|
112
|
+
} = props;
|
|
113
|
+
const RADIAN = Math.PI / 180;
|
|
114
|
+
// const radius = outerRadius * 0.5; //If you want to show label inside the pie
|
|
115
|
+
const radius = outerRadius * 1.13;
|
|
116
|
+
const x = cx + radius * Math.cos(-midAngle * RADIAN);
|
|
117
|
+
const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
|
118
|
+
return /*#__PURE__*/_react.default.createElement("text", {
|
|
159
119
|
x: x,
|
|
160
120
|
y: y,
|
|
161
121
|
fill: "#000000",
|
|
162
122
|
textAnchor: x > cx ? 'start' : 'end',
|
|
163
123
|
dominantBaseline: "central"
|
|
164
|
-
},
|
|
124
|
+
}, `${(index + 1).toFixed(0)}`);
|
|
165
125
|
};
|
|
126
|
+
|
|
166
127
|
/*
|
|
167
128
|
* Function to create and return component for bar chart
|
|
168
129
|
* */
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return /*#__PURE__*/_react
|
|
130
|
+
const barWithBorder = () => {
|
|
131
|
+
return props => {
|
|
132
|
+
const {
|
|
133
|
+
fill,
|
|
134
|
+
x,
|
|
135
|
+
y,
|
|
136
|
+
width,
|
|
137
|
+
height
|
|
138
|
+
} = props;
|
|
139
|
+
return /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("rect", {
|
|
179
140
|
x: x,
|
|
180
141
|
y: y,
|
|
181
142
|
width: width,
|
|
@@ -185,121 +146,91 @@ var FractionModelChart = function FractionModelChart(props) {
|
|
|
185
146
|
}));
|
|
186
147
|
};
|
|
187
148
|
};
|
|
149
|
+
const {
|
|
150
|
+
value = [],
|
|
151
|
+
modelType = 'bar',
|
|
152
|
+
noOfModels = 0,
|
|
153
|
+
partsPerModel = 0,
|
|
154
|
+
showLabel = false,
|
|
155
|
+
disabled = false,
|
|
156
|
+
onChange
|
|
157
|
+
} = props;
|
|
158
|
+
const [hoveredIndex, setHoveredIndex] = (0, _react.useState)(null);
|
|
159
|
+
const [clickedIndexArray, setClickedIndexArray] = (0, _react.useState)(value);
|
|
188
160
|
|
|
189
|
-
var classes = props.classes,
|
|
190
|
-
_props$value = props.value,
|
|
191
|
-
value = _props$value === void 0 ? [] : _props$value,
|
|
192
|
-
_props$modelType = props.modelType,
|
|
193
|
-
modelType = _props$modelType === void 0 ? 'bar' : _props$modelType,
|
|
194
|
-
_props$noOfModels = props.noOfModels,
|
|
195
|
-
noOfModels = _props$noOfModels === void 0 ? 0 : _props$noOfModels,
|
|
196
|
-
_props$partsPerModel = props.partsPerModel,
|
|
197
|
-
partsPerModel = _props$partsPerModel === void 0 ? 0 : _props$partsPerModel,
|
|
198
|
-
_props$showLabel = props.showLabel,
|
|
199
|
-
showLabel = _props$showLabel === void 0 ? false : _props$showLabel,
|
|
200
|
-
_props$disabled = props.disabled,
|
|
201
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
202
|
-
onChange = props.onChange;
|
|
203
|
-
|
|
204
|
-
var _useState = (0, _react.useState)(null),
|
|
205
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
206
|
-
hoveredIndex = _useState2[0],
|
|
207
|
-
setHoveredIndex = _useState2[1];
|
|
208
|
-
|
|
209
|
-
var _useState3 = (0, _react.useState)(value),
|
|
210
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
211
|
-
clickedIndexArray = _useState4[0],
|
|
212
|
-
setClickedIndexArray = _useState4[1];
|
|
213
161
|
/*
|
|
214
162
|
* Function to create and return bar fraction model
|
|
215
163
|
* */
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
for (var i = 1; i < noOfModels + 1; i++) {
|
|
222
|
-
var data = [{
|
|
164
|
+
const getBarFractionModel = () => {
|
|
165
|
+
const parentData = [];
|
|
166
|
+
// Generate data for bar chart
|
|
167
|
+
for (let i = 1; i < noOfModels + 1; i++) {
|
|
168
|
+
const data = [{
|
|
223
169
|
name: i
|
|
224
170
|
}];
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
data[0]["".concat(j)] = 1;
|
|
171
|
+
for (let j = 1; j < partsPerModel + 1; j++) {
|
|
172
|
+
data[0][`${j}`] = 1;
|
|
228
173
|
}
|
|
229
|
-
|
|
230
174
|
parentData.push(data);
|
|
231
175
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
barItems.push( /*#__PURE__*/_react["default"].createElement(_recharts.BarChart, {
|
|
176
|
+
let barItems = [];
|
|
177
|
+
parentData.forEach((data, chartIndex) => {
|
|
178
|
+
barItems.push(/*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
236
179
|
width: 200,
|
|
237
180
|
height: 30 * partsPerModel,
|
|
238
181
|
data: data,
|
|
239
|
-
key:
|
|
240
|
-
}, /*#__PURE__*/_react
|
|
182
|
+
key: `bar-chart-${chartIndex + 1}`
|
|
183
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
|
|
241
184
|
hide: true,
|
|
242
185
|
type: "number",
|
|
243
186
|
domain: [0, partsPerModel]
|
|
244
|
-
}), Object.keys(data[0]).map(
|
|
187
|
+
}), Object.keys(data[0]).map((key, index) => {
|
|
245
188
|
if (key !== 'name') {
|
|
246
|
-
return /*#__PURE__*/_react
|
|
189
|
+
return /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
247
190
|
dataKey: key,
|
|
248
191
|
stackId: "a",
|
|
249
|
-
key:
|
|
250
|
-
onClick: disabled ? null :
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
onMouseEnter: disabled ? null : function () {
|
|
254
|
-
return handleChartMouseEnter(chartIndex + 1, key);
|
|
255
|
-
},
|
|
256
|
-
onMouseLeave: disabled ? null : function () {
|
|
257
|
-
return handleChartMouseLeave(chartIndex + 1, key);
|
|
258
|
-
},
|
|
192
|
+
key: `bar-${chartIndex + 1}-${index + 1}`,
|
|
193
|
+
onClick: disabled ? null : () => handleChartClick(chartIndex + 1, key),
|
|
194
|
+
onMouseEnter: disabled ? null : () => handleChartMouseEnter(chartIndex + 1, key),
|
|
195
|
+
onMouseLeave: disabled ? null : () => handleChartMouseLeave(chartIndex + 1, key),
|
|
259
196
|
shape: barWithBorder(),
|
|
260
197
|
isAnimationActive: false,
|
|
261
|
-
fill: getSectorFill(hoveredIndex,
|
|
262
|
-
}, showLabel && /*#__PURE__*/_react
|
|
198
|
+
fill: getSectorFill(hoveredIndex, `${chartIndex + 1}-${key}`)
|
|
199
|
+
}, showLabel && /*#__PURE__*/_react.default.createElement(_recharts.LabelList, {
|
|
263
200
|
position: "left",
|
|
264
201
|
fill: "#000000"
|
|
265
202
|
}));
|
|
266
203
|
}
|
|
267
204
|
})));
|
|
268
205
|
});
|
|
269
|
-
return /*#__PURE__*/_react
|
|
270
|
-
className: classes.barChartParentDiv
|
|
271
|
-
}, barItems);
|
|
206
|
+
return /*#__PURE__*/_react.default.createElement(BarChartParentDiv, null, barItems);
|
|
272
207
|
};
|
|
208
|
+
const pieChartRef = (0, _react.useRef)(null);
|
|
273
209
|
|
|
274
|
-
var pieChartRef = (0, _react.useRef)(null);
|
|
275
210
|
/*
|
|
276
211
|
* Function to create and return pie fraction model
|
|
277
212
|
* */
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
var data = Array.from({
|
|
213
|
+
const getPieFractionModel = () => {
|
|
214
|
+
const parentData = [];
|
|
215
|
+
// Generate data for pie chart
|
|
216
|
+
for (let i = 1; i < noOfModels + 1; i++) {
|
|
217
|
+
const data = Array.from({
|
|
284
218
|
length: partsPerModel
|
|
285
|
-
},
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
};
|
|
290
|
-
});
|
|
219
|
+
}, (_, index) => ({
|
|
220
|
+
name: `${index + 1}`,
|
|
221
|
+
value: 1
|
|
222
|
+
}));
|
|
291
223
|
parentData.push(data);
|
|
292
224
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
pieItems.push( /*#__PURE__*/_react["default"].createElement(_recharts.PieChart, {
|
|
225
|
+
let pieItems = [];
|
|
226
|
+
parentData.forEach((data, chartIndex) => {
|
|
227
|
+
pieItems.push(/*#__PURE__*/_react.default.createElement(StyledPieChart, {
|
|
297
228
|
width: 200,
|
|
298
229
|
height: 200,
|
|
299
|
-
key:
|
|
300
|
-
}, /*#__PURE__*/_react
|
|
230
|
+
key: `pie-chart-${chartIndex}`
|
|
231
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.Pie, {
|
|
301
232
|
data: data,
|
|
302
|
-
key:
|
|
233
|
+
key: `pie-${chartIndex + 1}`,
|
|
303
234
|
fill: "#FFFFFF",
|
|
304
235
|
stroke: "#000000",
|
|
305
236
|
dataKey: "value",
|
|
@@ -308,41 +239,34 @@ var FractionModelChart = function FractionModelChart(props) {
|
|
|
308
239
|
isAnimationActive: false,
|
|
309
240
|
labelLine: false,
|
|
310
241
|
label: showLabel && renderCustomizedLabelForPie
|
|
311
|
-
}, data.map(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
return handleChartMouseLeave(chartIndex + 1, sectorIndex + 1);
|
|
323
|
-
},
|
|
324
|
-
fill: getSectorFill(hoveredIndex, "".concat(chartIndex + 1, "-").concat(sectorIndex + 1))
|
|
325
|
-
});
|
|
326
|
-
}))));
|
|
242
|
+
}, data.map((entry, sectorIndex) => /*#__PURE__*/_react.default.createElement(_recharts.Cell, {
|
|
243
|
+
key: `${chartIndex + 1}-${sectorIndex + 1}`,
|
|
244
|
+
onClick: disabled ? null : () => handleChartClick(chartIndex + 1, sectorIndex + 1),
|
|
245
|
+
onMouseEnter: disabled ? null : () => handleChartMouseEnter(chartIndex + 1, sectorIndex + 1),
|
|
246
|
+
onMouseLeave: disabled ? null : () => handleChartMouseLeave(chartIndex + 1, sectorIndex + 1),
|
|
247
|
+
fill: getSectorFill(hoveredIndex, `${chartIndex + 1}-${sectorIndex + 1}`),
|
|
248
|
+
style: {
|
|
249
|
+
outline: 'none',
|
|
250
|
+
cursor: disabled ? 'default' : 'pointer'
|
|
251
|
+
}
|
|
252
|
+
})))));
|
|
327
253
|
});
|
|
328
|
-
return /*#__PURE__*/_react
|
|
329
|
-
ref: pieChartRef
|
|
330
|
-
className: classes.pieChartParentDiv
|
|
254
|
+
return /*#__PURE__*/_react.default.createElement(PieChartParentDiv, {
|
|
255
|
+
ref: pieChartRef
|
|
331
256
|
}, pieItems);
|
|
332
|
-
};
|
|
333
|
-
|
|
257
|
+
};
|
|
334
258
|
|
|
259
|
+
//Render bar or pie models as per model type
|
|
335
260
|
if (modelType === 'bar') {
|
|
336
261
|
return getBarFractionModel();
|
|
337
262
|
} else if (modelType === 'pie') {
|
|
338
263
|
//Remove the last sector line of pie chart if parts per model is 1
|
|
339
|
-
(0, _react.useEffect)(
|
|
340
|
-
if (pieChartRef
|
|
341
|
-
|
|
342
|
-
|
|
264
|
+
(0, _react.useEffect)(() => {
|
|
265
|
+
if (pieChartRef?.current && partsPerModel === 1) {
|
|
266
|
+
const paths = pieChartRef.current.querySelectorAll('path');
|
|
343
267
|
if (paths.length > 0) {
|
|
344
|
-
paths.forEach(
|
|
345
|
-
|
|
268
|
+
paths.forEach(path => {
|
|
269
|
+
let d = path.getAttribute('d');
|
|
346
270
|
path.setAttribute('d', d.replaceAll('L 100,100', ''));
|
|
347
271
|
});
|
|
348
272
|
}
|
|
@@ -351,8 +275,5 @@ var FractionModelChart = function FractionModelChart(props) {
|
|
|
351
275
|
return getPieFractionModel();
|
|
352
276
|
}
|
|
353
277
|
};
|
|
354
|
-
|
|
355
|
-
var _default = (0, _styles.withStyles)(styles)(FractionModelChart);
|
|
356
|
-
|
|
357
|
-
exports["default"] = _default;
|
|
278
|
+
var _default = exports.default = FractionModelChart;
|
|
358
279
|
//# sourceMappingURL=fraction-model-chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fraction-model-chart.js"],"names":["styles","theme","pieChartParentDiv","display","gridTemplateColumns","gap","padding","barChartParentDiv","sectorOutline","outline","FractionModelChart","props","handleChartClick","chartIndex","sectorIndex","parseInt","existingIndex","clickedIndexArray","findIndex","item","id","newClickedIndexArray","currentItem","value","filter","_","index","slice","onChange","setClickedIndexArray","handleChartMouseEnter","setHoveredIndex","handleChartMouseLeave","getSectorFill","hoveredIndex","selection","split","map","Number","selectionId","selectionValue","clickedItem","find","hoveredId","hoveredValue","renderCustomizedLabelForPie","cx","cy","midAngle","outerRadius","RADIAN","Math","PI","radius","x","cos","y","sin","toFixed","barWithBorder","fill","width","height","classes","modelType","noOfModels","partsPerModel","showLabel","disabled","getBarFractionModel","parentData","i","data","name","j","push","barItems","forEach","Object","keys","key","pieChartRef","getPieFractionModel","Array","from","length","pieItems","entry","current","paths","querySelectorAll","path","d","getAttribute","setAttribute","replaceAll"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,iBAAiB,EAAE;AACjBC,MAAAA,OAAO,EAAE,MADQ;AAEjBC,MAAAA,mBAAmB,EAAE,mBAFJ;AAGjBC,MAAAA,GAAG,EAAE,MAHY;AAIjBC,MAAAA,OAAO,EAAE;AAJQ,KADM;AAOzBC,IAAAA,iBAAiB,EAAE;AACjBJ,MAAAA,OAAO,EAAE,MADQ;AAEjBC,MAAAA,mBAAmB,EAAE,mBAFJ;AAGjBC,MAAAA,GAAG,EAAE,MAHY;AAIjBC,MAAAA,OAAO,EAAE;AAJQ,KAPM;AAazBE,IAAAA,aAAa,EAAE;AACbC,MAAAA,OAAO,EAAE;AADI;AAbU,GAAZ;AAAA,CAAf;;AAkBA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,KAAD,EAAW;AACpC;AACF;AACA;AACA;AACA;AACE,MAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,UAAD,EAAaC,WAAb,EA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AAuB,MAAA,SAAS,EAAElB,OAAO,CAAC7D;AAA1C,OAA8DoF,QAA9D,CAAP;AACD,GAzCD,CAnKoC,CA8MpC;;;AACA,MAAItB,SAAS,KAAK,KAAlB,EAAyB;AACvB,WAAOK,mBAAmB,EAA1B;AACD,GAFD,MAEO,IAAIL,SAAS,KAAK,KAAlB,EAAyB;AAC9B;AACA,0BAAU,YAAM;AACd,UAAIiB,WAAW,SAAX,IAAAA,WAAW,WAAX,IAAAA,WAAW,CAAEO,OAAb,IAAwBtB,aAAa,KAAK,CAA9C,EAAgD;AAC9C,YAAMuB,KAAK,GAAGR,WAAW,CAACO,OAAZ,CAAoBE,gBAApB,CAAqC,MAArC,CAAd;;AACA,YAAID,KAAK,CAACJ,MAAN,GAAe,CAAnB,EAAsB;AACpBI,UAAAA,KAAK,CAACZ,OAAN,CAAc,UAACc,IAAD,EAAU;AACtB,gBAAIC,CAAC,GAAGD,IAAI,CAACE,YAAL,CAAkB,GAAlB,CAAR;AACAF,YAAAA,IAAI,CAACG,YAAL,CAAkB,GAAlB,EAAuBF,CAAC,CAACG,UAAF,CAAa,WAAb,EAA0B,EAA1B,CAAvB;AACD,WAHD;AAID;AACF;AACF,KAVD,EAUG,EAVH;AAWA,WAAOb,mBAAmB,EAA1B;AACD;AACF,CAhOD;;eAkOe,wBAAWlF,MAAX,EAAmBU,kBAAnB,C","sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\nimport { Bar, BarChart, Cell, LabelList, Pie, PieChart, YAxis } from 'recharts';\nimport { withStyles } from '@material-ui/core/styles';\n\nconst styles = (theme) => ({\n pieChartParentDiv: {\n display: 'grid',\n gridTemplateColumns: '200px 200px 200px',\n gap: '10px',\n padding: '5px 0',\n },\n barChartParentDiv: {\n display: 'grid',\n gridTemplateColumns: '200px 200px 200px',\n gap: '20px',\n padding: '10px 0',\n },\n sectorOutline: {\n outline: 'none',\n },\n});\n\nconst FractionModelChart = (props) => {\n /*\n * Function to handle click event on chart\n * @param chartIndex: index of the chart\n * @param sectorIndex: index of the sector\n * */\n const handleChartClick = (chartIndex, sectorIndex) => {\n if (typeof sectorIndex === 'string') {\n sectorIndex = parseInt(sectorIndex);\n }\n const existingIndex = clickedIndexArray.findIndex((item) => item.id === chartIndex);\n let newClickedIndexArray;\n if (existingIndex >= 0) {\n const currentItem = clickedIndexArray[existingIndex];\n if (currentItem.value === sectorIndex) {\n newClickedIndexArray = clickedIndexArray.filter((_, index) => index !== existingIndex);\n } else {\n newClickedIndexArray = [\n ...clickedIndexArray.slice(0, existingIndex),\n { id: chartIndex, value: sectorIndex },\n ...clickedIndexArray.slice(existingIndex + 1),\n ];\n }\n } else {\n newClickedIndexArray = [...clickedIndexArray, { id: chartIndex, value: sectorIndex }];\n }\n onChange(newClickedIndexArray);\n setClickedIndexArray(newClickedIndexArray);\n };\n\n /*\n * Function to handle mouse enter event on chart\n * @param chartIndex: index of the chart\n * @param sectorIndex: index of the sector\n * */\n const handleChartMouseEnter = (chartIndex, sectorIndex) => {\n setHoveredIndex(chartIndex + '-' + sectorIndex);\n };\n\n /*\n * Function to handle mouse leave event on chart\n * @param chartIndex: index of the chart\n * @param sectorIndex: index of the sector\n * */\n const handleChartMouseLeave = (chartIndex, sectorIndex) => {\n setHoveredIndex(null);\n };\n\n /*\n * Function to get fill color for sector\n * @param hoveredIndex: hovered index\n * @param selection: selected index\n * */\n const getSectorFill = (hoveredIndex, selection) => {\n const [selectionId, selectionValue] = selection.split('-').map(Number);\n // Check for a matching clicked item\n const clickedItem = clickedIndexArray.find((item) => item.id === selectionId);\n if (clickedItem && selectionValue <= clickedItem.value) {\n return 'rgb(60, 73, 150, 0.6)';\n }\n // Check for a matching hovered index\n if (hoveredIndex) {\n const [hoveredId, hoveredValue] = hoveredIndex.split('-').map(Number);\n if (hoveredId === selectionId && hoveredValue >= selectionValue) {\n return 'rgb(0, 0, 0, 0.25)';\n }\n }\n return '#FFFFFF';\n };\n\n /*\n * Function to render label for pie chart\n * @param props: properties of the label\n * */\n const renderCustomizedLabelForPie = (props) => {\n const { cx, cy, midAngle, outerRadius, index } = props;\n const RADIAN = Math.PI / 180;\n // const radius = outerRadius * 0.5; //If you want to show label inside the pie\n const radius = outerRadius * 1.13;\n const x = cx + radius * Math.cos(-midAngle * RADIAN);\n const y = cy + radius * Math.sin(-midAngle * RADIAN);\n return (\n <text x={x} y={y} fill=\"#000000\" textAnchor={x > cx ? 'start' : 'end'} dominantBaseline=\"central\">\n {`${(index + 1).toFixed(0)}`}\n </text>\n );\n };\n\n /*\n * Function to create and return component for bar chart\n * */\n const barWithBorder = () => {\n return (props) => {\n const { fill, x, y, width, height } = props;\n return (\n <g>\n <rect x={x} y={y} width={width} height={height} stroke={'#000000'} fill={fill} />\n </g>\n );\n };\n };\n\n const {\n classes,\n value = [],\n modelType = 'bar',\n noOfModels = 0,\n partsPerModel = 0,\n showLabel = false,\n disabled = false,\n onChange,\n } = props;\n const [hoveredIndex, setHoveredIndex] = useState(null);\n const [clickedIndexArray, setClickedIndexArray] = useState(value);\n\n /*\n * Function to create and return bar fraction model\n * */\n const getBarFractionModel = () => {\n const parentData = [];\n // Generate data for bar chart\n for (let i = 1; i < noOfModels + 1; i++) {\n const data = [{ name: i }];\n for (let j = 1; j < partsPerModel + 1; j++) {\n data[0][`${j}`] = 1;\n }\n parentData.push(data);\n }\n let barItems = [];\n parentData.forEach((data, chartIndex) => {\n barItems.push(\n <BarChart width={200} height={30 * partsPerModel} data={data} key={`bar-chart-${chartIndex + 1}`}>\n <YAxis hide={true} type=\"number\" domain={[0, partsPerModel]} />\n {Object.keys(data[0]).map((key, index) => {\n if (key !== 'name') {\n return (\n <Bar\n dataKey={key}\n stackId=\"a\"\n key={`bar-${chartIndex + 1}-${index + 1}`}\n onClick={disabled ? null : () => handleChartClick(chartIndex + 1, key)}\n onMouseEnter={disabled ? null : () => handleChartMouseEnter(chartIndex + 1, key)}\n onMouseLeave={disabled ? null : () => handleChartMouseLeave(chartIndex + 1, key)}\n shape={barWithBorder()}\n isAnimationActive={false}\n fill={getSectorFill(hoveredIndex, `${chartIndex + 1}-${key}`)}\n >\n {showLabel && <LabelList position=\"left\" fill=\"#000000\" />}\n </Bar>\n );\n }\n })}\n </BarChart>,\n );\n });\n return <div className={classes.barChartParentDiv}>{barItems}</div>;\n };\n\n const pieChartRef = useRef(null);\n \n /*\n * Function to create and return pie fraction model\n * */\n const getPieFractionModel = () => {\n const parentData = [];\n // Generate data for pie chart\n for (let i = 1; i < noOfModels + 1; i++) {\n const data = Array.from({ length: partsPerModel }, (_, index) => ({\n name: `${index + 1}`,\n value: 1,\n }));\n parentData.push(data);\n }\n let pieItems = [];\n parentData.forEach((data, chartIndex) => {\n pieItems.push(\n <PieChart width={200} height={200} key={`pie-chart-${chartIndex}`}>\n <Pie\n data={data}\n key={`pie-${chartIndex + 1}`}\n fill=\"#FFFFFF\"\n stroke=\"#000000\"\n dataKey=\"value\"\n startAngle={90}\n endAngle={-270}\n isAnimationActive={false}\n labelLine={false}\n label={showLabel && renderCustomizedLabelForPie}\n >\n {data.map((entry, sectorIndex) => (\n <Cell\n className={classes.sectorOutline}\n key={`${chartIndex + 1}-${sectorIndex + 1}`}\n onClick={disabled ? null : () => handleChartClick(chartIndex + 1, sectorIndex + 1)}\n onMouseEnter={disabled ? null : () => handleChartMouseEnter(chartIndex + 1, sectorIndex + 1)}\n onMouseLeave={disabled ? null : () => handleChartMouseLeave(chartIndex + 1, sectorIndex + 1)}\n fill={getSectorFill(hoveredIndex, `${chartIndex + 1}-${sectorIndex + 1}`)}\n />\n ))}\n </Pie>\n </PieChart>,\n );\n });\n return <div ref={pieChartRef} className={classes.pieChartParentDiv}>{pieItems}</div>;\n };\n\n //Render bar or pie models as per model type\n if (modelType === 'bar') {\n return getBarFractionModel();\n } else if (modelType === 'pie') {\n //Remove the last sector line of pie chart if parts per model is 1\n useEffect(() => {\n if (pieChartRef?.current && partsPerModel === 1){\n const paths = pieChartRef.current.querySelectorAll('path');\n if (paths.length > 0) {\n paths.forEach((path) => {\n let d = path.getAttribute('d');\n path.setAttribute('d', d.replaceAll('L 100,100', ''));\n });\n }\n }\n }, []);\n return getPieFractionModel();\n }\n};\n\nexport default withStyles(styles)(FractionModelChart);\n"],"file":"fraction-model-chart.js"}
|
|
1
|
+
{"version":3,"file":"fraction-model-chart.js","names":["_react","_interopRequireWildcard","require","_recharts","_styles","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","PieChartParentDiv","styled","display","gridTemplateColumns","gap","padding","BarChartParentDiv","StyledPieChart","PieChart","outline","FractionModelChart","props","handleChartClick","chartIndex","sectorIndex","parseInt","existingIndex","clickedIndexArray","findIndex","item","id","newClickedIndexArray","currentItem","value","filter","_","index","slice","onChange","setClickedIndexArray","handleChartMouseEnter","setHoveredIndex","handleChartMouseLeave","getSectorFill","hoveredIndex","selection","selectionId","selectionValue","split","map","Number","clickedItem","find","hoveredId","hoveredValue","renderCustomizedLabelForPie","cx","cy","midAngle","outerRadius","RADIAN","Math","PI","radius","x","cos","y","sin","createElement","fill","textAnchor","dominantBaseline","toFixed","barWithBorder","width","height","stroke","modelType","noOfModels","partsPerModel","showLabel","disabled","useState","getBarFractionModel","parentData","data","name","j","push","barItems","forEach","BarChart","key","YAxis","hide","type","domain","keys","Bar","dataKey","stackId","onClick","onMouseEnter","onMouseLeave","shape","isAnimationActive","LabelList","position","pieChartRef","useRef","getPieFractionModel","Array","from","length","pieItems","Pie","startAngle","endAngle","labelLine","label","entry","Cell","style","cursor","ref","useEffect","current","paths","querySelectorAll","path","d","getAttribute","setAttribute","replaceAll","_default","exports"],"sources":["../src/fraction-model-chart.jsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\nimport { Bar, BarChart, Cell, LabelList, Pie, PieChart, YAxis } from 'recharts';\nimport { styled } from '@mui/material/styles';\n\nconst PieChartParentDiv = styled('div')({\n display: 'grid',\n gridTemplateColumns: '200px 200px 200px',\n gap: '10px',\n padding: '5px 0',\n});\n\nconst BarChartParentDiv = styled('div')({\n display: 'grid',\n gridTemplateColumns: '200px 200px 200px',\n gap: '20px',\n padding: '10px 0',\n});\n\nconst StyledPieChart = styled(PieChart)({\n '& .recharts-pie-sector': {\n outline: 'none !important',\n '&:focus': {\n outline: 'none !important',\n },\n },\n});\n\nconst FractionModelChart = (props) => {\n /*\n * Function to handle click event on chart\n * @param chartIndex: index of the chart\n * @param sectorIndex: index of the sector\n * */\n const handleChartClick = (chartIndex, sectorIndex) => {\n if (typeof sectorIndex === 'string') {\n sectorIndex = parseInt(sectorIndex);\n }\n const existingIndex = clickedIndexArray.findIndex((item) => item.id === chartIndex);\n let newClickedIndexArray;\n if (existingIndex >= 0) {\n const currentItem = clickedIndexArray[existingIndex];\n if (currentItem.value === sectorIndex) {\n newClickedIndexArray = clickedIndexArray.filter((_, index) => index !== existingIndex);\n } else {\n newClickedIndexArray = [\n ...clickedIndexArray.slice(0, existingIndex),\n { id: chartIndex, value: sectorIndex },\n ...clickedIndexArray.slice(existingIndex + 1),\n ];\n }\n } else {\n newClickedIndexArray = [...clickedIndexArray, { id: chartIndex, value: sectorIndex }];\n }\n onChange(newClickedIndexArray);\n setClickedIndexArray(newClickedIndexArray);\n };\n\n /*\n * Function to handle mouse enter event on chart\n * @param chartIndex: index of the chart\n * @param sectorIndex: index of the sector\n * */\n const handleChartMouseEnter = (chartIndex, sectorIndex) => {\n setHoveredIndex(chartIndex + '-' + sectorIndex);\n };\n\n /*\n * Function to handle mouse leave event on chart\n * */\n const handleChartMouseLeave = () => {\n setHoveredIndex(null);\n };\n\n /*\n * Function to get fill color for sector\n * @param hoveredIndex: hovered index\n * @param selection: selected index\n * */\n const getSectorFill = (hoveredIndex, selection) => {\n const [selectionId, selectionValue] = selection.split('-').map(Number);\n // Check for a matching clicked item\n const clickedItem = clickedIndexArray.find((item) => item.id === selectionId);\n if (clickedItem && selectionValue <= clickedItem.value) {\n return 'rgb(60, 73, 150, 0.6)';\n }\n // Check for a matching hovered index\n if (hoveredIndex) {\n const [hoveredId, hoveredValue] = hoveredIndex.split('-').map(Number);\n if (hoveredId === selectionId && hoveredValue >= selectionValue) {\n return 'rgb(0, 0, 0, 0.25)';\n }\n }\n return '#FFFFFF';\n };\n\n /*\n * Function to render label for pie chart\n * @param props: properties of the label\n * */\n const renderCustomizedLabelForPie = (props) => {\n const { cx, cy, midAngle, outerRadius, index } = props;\n const RADIAN = Math.PI / 180;\n // const radius = outerRadius * 0.5; //If you want to show label inside the pie\n const radius = outerRadius * 1.13;\n const x = cx + radius * Math.cos(-midAngle * RADIAN);\n const y = cy + radius * Math.sin(-midAngle * RADIAN);\n return (\n <text x={x} y={y} fill=\"#000000\" textAnchor={x > cx ? 'start' : 'end'} dominantBaseline=\"central\">\n {`${(index + 1).toFixed(0)}`}\n </text>\n );\n };\n\n /*\n * Function to create and return component for bar chart\n * */\n const barWithBorder = () => {\n return (props) => {\n const { fill, x, y, width, height } = props;\n return (\n <g>\n <rect x={x} y={y} width={width} height={height} stroke={'#000000'} fill={fill} />\n </g>\n );\n };\n };\n\n const {\n value = [],\n modelType = 'bar',\n noOfModels = 0,\n partsPerModel = 0,\n showLabel = false,\n disabled = false,\n onChange,\n } = props;\n const [hoveredIndex, setHoveredIndex] = useState(null);\n const [clickedIndexArray, setClickedIndexArray] = useState(value);\n\n /*\n * Function to create and return bar fraction model\n * */\n const getBarFractionModel = () => {\n const parentData = [];\n // Generate data for bar chart\n for (let i = 1; i < noOfModels + 1; i++) {\n const data = [{ name: i }];\n for (let j = 1; j < partsPerModel + 1; j++) {\n data[0][`${j}`] = 1;\n }\n parentData.push(data);\n }\n let barItems = [];\n parentData.forEach((data, chartIndex) => {\n barItems.push(\n <BarChart width={200} height={30 * partsPerModel} data={data} key={`bar-chart-${chartIndex + 1}`}>\n <YAxis hide={true} type=\"number\" domain={[0, partsPerModel]} />\n {Object.keys(data[0]).map((key, index) => {\n if (key !== 'name') {\n return (\n <Bar\n dataKey={key}\n stackId=\"a\"\n key={`bar-${chartIndex + 1}-${index + 1}`}\n onClick={disabled ? null : () => handleChartClick(chartIndex + 1, key)}\n onMouseEnter={disabled ? null : () => handleChartMouseEnter(chartIndex + 1, key)}\n onMouseLeave={disabled ? null : () => handleChartMouseLeave(chartIndex + 1, key)}\n shape={barWithBorder()}\n isAnimationActive={false}\n fill={getSectorFill(hoveredIndex, `${chartIndex + 1}-${key}`)}\n >\n {showLabel && <LabelList position=\"left\" fill=\"#000000\" />}\n </Bar>\n );\n }\n })}\n </BarChart>,\n );\n });\n return <BarChartParentDiv>{barItems}</BarChartParentDiv>;\n };\n\n const pieChartRef = useRef(null);\n \n /*\n * Function to create and return pie fraction model\n * */\n const getPieFractionModel = () => {\n const parentData = [];\n // Generate data for pie chart\n for (let i = 1; i < noOfModels + 1; i++) {\n const data = Array.from({ length: partsPerModel }, (_, index) => ({\n name: `${index + 1}`,\n value: 1,\n }));\n parentData.push(data);\n }\n let pieItems = [];\n parentData.forEach((data, chartIndex) => {\n pieItems.push(\n <StyledPieChart width={200} height={200} key={`pie-chart-${chartIndex}`}>\n <Pie\n data={data}\n key={`pie-${chartIndex + 1}`}\n fill=\"#FFFFFF\"\n stroke=\"#000000\"\n dataKey=\"value\"\n startAngle={90}\n endAngle={-270}\n isAnimationActive={false}\n labelLine={false}\n label={showLabel && renderCustomizedLabelForPie}\n >\n {data.map((entry, sectorIndex) => (\n <Cell\n key={`${chartIndex + 1}-${sectorIndex + 1}`}\n onClick={disabled ? null : () => handleChartClick(chartIndex + 1, sectorIndex + 1)}\n onMouseEnter={disabled ? null : () => handleChartMouseEnter(chartIndex + 1, sectorIndex + 1)}\n onMouseLeave={disabled ? null : () => handleChartMouseLeave(chartIndex + 1, sectorIndex + 1)}\n fill={getSectorFill(hoveredIndex, `${chartIndex + 1}-${sectorIndex + 1}`)}\n style={{ outline: 'none', cursor: disabled ? 'default' : 'pointer' }}\n />\n ))}\n </Pie>\n </StyledPieChart>,\n );\n });\n return <PieChartParentDiv ref={pieChartRef}>{pieItems}</PieChartParentDiv>;\n };\n\n //Render bar or pie models as per model type\n if (modelType === 'bar') {\n return getBarFractionModel();\n } else if (modelType === 'pie') {\n //Remove the last sector line of pie chart if parts per model is 1\n useEffect(() => {\n if (pieChartRef?.current && partsPerModel === 1){\n const paths = pieChartRef.current.querySelectorAll('path');\n if (paths.length > 0) {\n paths.forEach((path) => {\n let d = path.getAttribute('d');\n path.setAttribute('d', d.replaceAll('L 100,100', ''));\n });\n }\n }\n }, []);\n return getPieFractionModel();\n }\n};\n\nexport default FractionModelChart;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAA8C,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CA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