Skip to content

Commit 2bf2188

Browse files
committed
Update README
1 parent 6c2b7f2 commit 2bf2188

File tree

1 file changed

+56
-1
lines changed

1 file changed

+56
-1
lines changed

README.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<br>
44
<a href="https://vue-data-ui.graphieros.com/"><img width="100%" src="https://github.com/user-attachments/assets/0474eb0e-0918-43e1-9756-30a5a8052d82"></a>
55

6-
76
</p>
87

98
# vue-data-ui
@@ -895,6 +894,8 @@ import {
895894
lightenColor,
896895
shiftColorHue,
897896
createTSpans,
897+
getCumulativeAverage,
898+
getCumulativeMedian,
898899
} from "vue-data-ui";
899900
```
900901

@@ -966,6 +967,60 @@ const textContent = createTSpans({
966967
/>
967968
```
968969

970+
### getCumulativeAverage
971+
972+
```js
973+
import { getCumulativeAverage } from "vue-data-ui";
974+
975+
// simple usage
976+
const arr = [0, 1, 2, 3, 4];
977+
const cumulativeAvg = getCumulativeAverage({ values: arr });
978+
979+
// Ignore invalid values entirely
980+
const arrWithInvalid = [1, null, 2, Infinity, NaN, undefined];
981+
const cumulativeAvgNoInvalid = getCumulativeAverage({
982+
values: arrWithInvalid,
983+
config: {
984+
keepInvalid: false,
985+
},
986+
});
987+
988+
// Convert invalid values to zero
989+
const cumulativeAvgZeroed = getCumulativeAverage({
990+
values: arrWithInvalid,
991+
config: {
992+
convertInvalidToZero: true,
993+
},
994+
});
995+
```
996+
997+
### getCumulativeMedian
998+
999+
```js
1000+
import { getCumulativeMedian } from "vue-data-ui";
1001+
1002+
// simple usage
1003+
const arr = [0, 1, 2, 3, 4];
1004+
const cumulativeMed = getCumulativeMedian({ values: arr });
1005+
1006+
// Ignore invalid values entirely
1007+
const arrWithInvalid = [1, null, 2, Infinity, NaN, undefined];
1008+
const cumulativeMedNoInvalid = getCumulativeMedian({
1009+
values: arrWithInvalid,
1010+
config: {
1011+
keepInvalid: false,
1012+
},
1013+
});
1014+
1015+
// Convert invalid values to zero
1016+
const cumulativeMedZeroed = getCumulativeMedian({
1017+
values: arrWithInvalid,
1018+
config: {
1019+
convertInvalidToZero: true,
1020+
},
1021+
});
1022+
```
1023+
9691024
## PDF generation
9701025

9711026
This package requires jspdf as a peer dependency. Please install it in your project if you intend on using the PDF printing feature.

0 commit comments

Comments
 (0)