@kiva/kv-components 3.102.0 → 3.102.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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.102.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.102.0...@kiva/kv-components@3.102.1) (2024-09-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * pie chart not visible with only one value MP-791 ([6419cd8](https://github.com/kiva/kv-ui-elements/commit/6419cd8d0f348d32dddadd4170f87a6442bf1b29))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.102.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.101.3...@kiva/kv-components@3.102.0) (2024-09-16)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.102.0",
3
+ "version": "3.102.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -83,5 +83,5 @@
83
83
  "optional": true
84
84
  }
85
85
  },
86
- "gitHead": "20b68474c85a4df97dcf32d6a234a237f02cb9ae"
86
+ "gitHead": "6e2360df11de20e781c327c45d43fd8d4dae1c58"
87
87
  }
@@ -174,10 +174,18 @@ export default {
174
174
  const value = values.value[i];
175
175
  const end = start + value.percent;
176
176
  const [startX, startY] = circumPointFromAngle(cX, cY, r, start * Math.PI * 2);
177
- const [endX, endY] = circumPointFromAngle(cX, cY, r, end * Math.PI * 2);
178
- const largeArc = value.percent > 0.5 ? 1 : 0;
179
- // Draw just the outer arc of the slice
180
- const path = `M ${startX} ${startY} A ${r} ${r} 0 ${largeArc} 1 ${endX} ${endY}`;
177
+ let path = `M ${startX},${startY} `;
178
+ if (value.percent === 1) {
179
+ // Draw a full circle in two arcs
180
+ const [midX, midY] = circumPointFromAngle(cX, cY, r, (start + end) * Math.PI);
181
+ path += `A ${r},${r} 0 0,1 ${midX},${midY} `;
182
+ path += `A ${r},${r} 0 0,1 ${startX},${startY}`;
183
+ } else {
184
+ // Draw just the outer arc of the slice
185
+ const [endX, endY] = circumPointFromAngle(cX, cY, r, end * Math.PI * 2);
186
+ const largeArc = value.percent > 0.5 ? 1 : 0;
187
+ path += `A ${r},${r} 0 ${largeArc},1 ${endX},${endY}`;
188
+ }
181
189
  slicesArr.push({
182
190
  ...value,
183
191
  path,
@@ -40,3 +40,8 @@ export const ManyValues = Template.bind({});
40
40
  ManyValues.args = {
41
41
  values: sectorValues,
42
42
  };
43
+
44
+ export const OneValue = Template.bind({});
45
+ OneValue.args = {
46
+ values: [{ label: 'Female', value: 1, percent: 1 }],
47
+ };