Skip to content

Commit

Permalink
Merge pull request #91 from sgratzl/release/v4.2.7
Browse files Browse the repository at this point in the history
Release v4.2.7
  • Loading branch information
sgratzl committed Oct 20, 2023
2 parents faf3b8d + 38b8c1e commit 932bc0c
Show file tree
Hide file tree
Showing 4 changed files with 436 additions and 406 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: ci

on: [push]
on:
- push
- pull_request

jobs:
build:
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sgratzl/chartjs-chart-boxplot",
"description": "Chart.js module for charting boxplots and violin charts",
"version": "4.2.6",
"version": "4.2.7",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -73,15 +73,15 @@
},
"devDependencies": {
"@chiogen/rollup-plugin-terser": "^7.1.3",
"@rollup/plugin-commonjs": "^25.0.5",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.3",
"@rollup/plugin-replace": "^5.0.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/jest": "^29.5.5",
"@types/jest-image-snapshot": "^6.2.1",
"@types/node": "^20.8.3",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@types/jest": "^29.5.6",
"@types/jest-image-snapshot": "^6.2.2",
"@types/node": "^20.8.7",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@yarnpkg/sdks": "^2.7.1",
"canvas": "^2.11.2",
"canvas-5-polyfill": "^0.1.5",
Expand All @@ -93,15 +93,15 @@
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-image-snapshot": "^6.2.0",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"rollup": "^4.0.2",
"rollup": "^4.1.4",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-dts": "^6.1.0",
"ts-jest": "^29.1.1",
Expand All @@ -110,7 +110,7 @@
"typedoc-plugin-markdown": "^4.0.0-next.16",
"typedoc-vitepress-theme": "^1.0.0-next.3",
"typescript": "^5.2.2",
"vitepress": "^1.0.0-rc.20",
"vitepress": "^1.0.0-rc.22",
"vue": "^3.3.4",
"vue-chartjs": "^5.2.0"
},
Expand Down
17 changes: 16 additions & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ export interface IBaseOptions {
* @default 7
*/
quantiles?: QuantileMethod;

/**
* the method to compute the whiskers.
*
* 'nearest': with this mode computed whisker values will be replaced with nearest real data points
* 'exact': with this mode exact computed whisker values will be displayed on chart
* @default 'nearest'
*/
whiskersMode?: 'nearest' | 'exact';
}

export type IBoxplotOptions = IBaseOptions;
Expand All @@ -150,9 +159,10 @@ export interface IViolinOptions extends IBaseOptions {
/**
* @hidden
*/
export const defaultStatsOptions = {
export const defaultStatsOptions: Required<Omit<IBaseOptions, 'minStats' | 'maxStats'>> = {
coef: 1.5,
quantiles: 7,
whiskersMode: 'nearest',
};

function determineQuantiles(q: QuantileMethod) {
Expand All @@ -177,9 +187,14 @@ function determineStatsOptions(options?: IBaseOptions) {
const coef = options == null || typeof options.coef !== 'number' ? defaultStatsOptions.coef : options.coef;
const q = options == null || options.quantiles == null ? quantilesType7 : options.quantiles;
const quantiles = determineQuantiles(q);
const whiskersMode =
options == null || typeof options.whiskersMode !== 'string'
? defaultStatsOptions.whiskersMode
: options.whiskersMode;
return {
coef,
quantiles,
whiskersMode,
};
}

Expand Down
Loading

0 comments on commit 932bc0c

Please sign in to comment.