@sgratzl/chartjs-chart-boxplot
Advanced tools
Comparing version 3.0.0-alpha.20 to 3.0.0-beta.1
123
package.json
{ | ||
"name": "@sgratzl/chartjs-chart-boxplot", | ||
"description": "Chart.js module for charting boxplots and violin charts", | ||
"version": "3.0.0-alpha.20", | ||
"version": "3.0.0-beta.1", | ||
"publishConfig": { | ||
@@ -9,11 +9,11 @@ "access": "public" | ||
"author": { | ||
"name": "datavisyn", | ||
"email": "contact@datavisyn.io", | ||
"url": "https://www.datavisyn.io" | ||
"name": "Samuel Gratzl", | ||
"email": "sam@sgratzl.com", | ||
"url": "https://www.sgratzl.com" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Samuel Gratzl", | ||
"email": "sam@sgratzl.com", | ||
"url": "https://www.sgratzl.com" | ||
"name": "datavisyn", | ||
"email": "contact@datavisyn.io", | ||
"url": "https://www.datavisyn.io" | ||
}, | ||
@@ -27,2 +27,11 @@ { | ||
"license": "MIT", | ||
"homepage": "https://github.com/sgratzl/chartjs-chart-boxplot", | ||
"bugs": { | ||
"url": "https://github.com/sgratzl/chartjs-chart-boxplot/issues" | ||
}, | ||
"keywords": [ | ||
"chart.js", | ||
"boxplot", | ||
"violin" | ||
], | ||
"repository": { | ||
@@ -32,63 +41,81 @@ "type": "git", | ||
}, | ||
"main": "build/Chart.BoxPlot.js", | ||
"unpkg": "build/Chart.BoxPlot.min.js", | ||
"module": "build/Chart.BoxPlot.esm.js", | ||
"global": "ChartBoxPlot", | ||
"module": "build/index.esm.js", | ||
"main": "build/index.js", | ||
"unpkg": "build/index.umd.min.js", | ||
"jsdelivr": "build/index.umd.min.js", | ||
"types": "build/index.d.ts", | ||
"sideEffects": false, | ||
"files": [ | ||
"build", | ||
"src/**/*.js" | ||
"src/**/*.ts" | ||
], | ||
"peerDependencies": { | ||
"@sgratzl/chartjs-esm-facade": "^3.0.0-alpha.2", | ||
"chart.js": "^3.0.0-alpha.2" | ||
"chart.js": "^3.0.0-beta" | ||
}, | ||
"browserslist": [ | ||
"Firefox ESR", | ||
"last 2 Chrome versions", | ||
"last 2 Firefox versions" | ||
], | ||
"dependencies": { | ||
"@babel/runtime": "^7.10.5", | ||
"@sgratzl/boxplots": "^1.2.1", | ||
"@sgratzl/science": "^2.0.0" | ||
"@sgratzl/boxplots": "^1.2.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.10.5", | ||
"@babel/plugin-transform-runtime": "^7.10.5", | ||
"@babel/preset-env": "^7.10.4", | ||
"@rollup/plugin-alias": "^3.1.1", | ||
"@rollup/plugin-babel": "^5.1.0", | ||
"@rollup/plugin-commonjs": "^14.0.0", | ||
"@rollup/plugin-node-resolve": "^8.4.0", | ||
"@sgratzl/chartjs-esm-facade": "^3.0.0-alpha.2", | ||
"@yarnpkg/pnpify": "^2.1.0", | ||
"babel-jest": "^26.1.0", | ||
"@rollup/plugin-commonjs": "^15.0.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@rollup/plugin-replace": "^2.3.3", | ||
"@rollup/plugin-typescript": "^5.0.2", | ||
"@types/jest": "^26.0.12", | ||
"@types/jest-image-snapshot": "^3.1.0", | ||
"@types/node": "^14.6.2", | ||
"@typescript-eslint/eslint-plugin": "^4.0.1", | ||
"@typescript-eslint/parser": "^4.0.1", | ||
"@yarnpkg/pnpify": "^2.2.1", | ||
"canvas": "^2.6.1", | ||
"chart.js": "^3.0.0-alpha.2", | ||
"eslint": "^7.4.0", | ||
"chart.js": "^3.0.0-beta", | ||
"eslint": "^7.8.1", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-config-react-app": "^5.2.1", | ||
"eslint-plugin-flowtype": "^5.2.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-jsx-a11y": "^6.3.1", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"jest": "^26.1.0", | ||
"jest-image-snapshot": "^4.0.2", | ||
"prettier": "^2.0.5", | ||
"release-it": "^13.6.5", | ||
"eslint-plugin-react": "^7.20.6", | ||
"eslint-plugin-react-hooks": "^4.1.0", | ||
"jest": "^26.4.2", | ||
"jest-image-snapshot": "^4.2.0", | ||
"prettier": "^2.1.1", | ||
"release-it": "^13.7.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.22.0", | ||
"rollup-plugin-pnp-resolve": "^2.0.0", | ||
"uglify-es": "^3.3.9" | ||
"rollup": "^2.26.9", | ||
"rollup-plugin-cleanup": "^3.1.1", | ||
"rollup-plugin-dts": "^1.4.12", | ||
"rollup-plugin-terser": "^7.0.1", | ||
"ts-jest": "^26.3.0", | ||
"tslib": "^2.0.1", | ||
"typedoc": "^0.19.0", | ||
"typescript": "^4.0.2" | ||
}, | ||
"scripts": { | ||
"clean": "rimraf build *.tgz", | ||
"clean": "rimraf build node_modules \"*.tgz\"", | ||
"compile": "tsc -p tsconfig.json --noEmit", | ||
"start": "npm run watch", | ||
"watch": "rollup -c -w", | ||
"lint": "eslint src", | ||
"build": "rollup -c", | ||
"test": "jest --passWithNoTests", | ||
"test:watch": "jest --watch", | ||
"posttest": "npm run lint", | ||
"build:dev": "rollup -c", | ||
"build:prod": "npm run build:dev && uglifyjs build/Chart.BoxPlot.js -c -m -o build/Chart.BoxPlot.min.js", | ||
"prebuild": "npm run clean && npm test", | ||
"build": "npm run build:prod", | ||
"format": "prettier --write samples src package.json *.js README.md", | ||
"preversion": "npm run test", | ||
"prepare": "npm run build:dev", | ||
"prepublishOnly": "npm run build:prod", | ||
"test:watch": "jest --passWithNoTests --watch", | ||
"test:coverage": "jest --passWithNoTests --coverage", | ||
"lint": "npm run eslint && npm run prettier", | ||
"fix": "npm run eslint:fix && npm run prettier:write", | ||
"prettier:write": "prettier */** --write", | ||
"prettier": "prettier */** --check", | ||
"eslint": "eslint src --ext .ts,.tsx", | ||
"eslint:fix": "npm run eslint -- --fix", | ||
"docs": "typedoc", | ||
"prepare": "npm run build", | ||
"release": "release-it --disable-metrics --npm.skipChecks", | ||
"release:pre": "release-it --disable-metrics --npm.skipChecks --preRelease=alpha --npm.tag=next", | ||
"sample": "cd sample_treeshake && rollup -c" | ||
"release:beta": "release-it --disable-metrics --npm.skipChecks --preRelease=beta --npm.tag=next" | ||
} | ||
} |
295
README.md
# Chart.js Box and Violin Plot | ||
[![datavisyn][datavisyn-image]][datavisyn-url] [![License: MIT][mit-image]][mit-url] [![NPM Package][npm-image]][npm-url] [![Github Actions][github-actions-image]][github-actions-url] | ||
[![License: MIT][mit-image]][mit-url] [![NPM Package][npm-image]][npm-url] [![Github Actions][github-actions-image]][github-actions-url] | ||
Chart.js module for charting box and violin plots. | ||
Chart.js module for charting box and violin plots. This is a maintained fork of [@datavisyn/chartjs-chart-box-and-violin-plot](https://github.com/datavisyn/chartjs-chart-box-and-violin-plot), which I originally developed during my time at datavisyn. | ||
@@ -26,3 +26,3 @@ **Works only with Chart.js >= 3.0.0** | ||
four new types: `boxplot`, `horizontalBoxplot`, `violin`, and `horizontalViolin`. | ||
four new types: `boxplot` and `violin`. | ||
@@ -33,228 +33,4 @@ ## Config | ||
```ts | ||
interface IBaseOptions { | ||
/** | ||
* statistic measure that should be used for computing the minimal data limit | ||
* @default 'min' | ||
*/ | ||
minStats: 'min' | 'q1' | 'whiskerMin'; | ||
see https://github.com/sgratzl/chartjs-chart-boxplot/blob/develop/src/data.ts#L100-L147 | ||
/** | ||
* statistic measure that should be used for computing the maximal data limit | ||
* @default 'max' | ||
*/ | ||
maxStats: 'max' | 'q3' | 'whiskerMax'; | ||
/** | ||
* from the R doc: this determines how far the plot ‘whiskers’ extend out from | ||
* the box. If coef is positive, the whiskers extend to the most extreme data | ||
* point which is no more than coef times the length of the box away from the | ||
* box. A value of zero causes the whiskers to extend to the data extremes | ||
* @default 1.5 | ||
*/ | ||
coef: number; | ||
/** | ||
* the method to compute the quantiles. | ||
* | ||
* 7, 'quantiles': the type-7 method as used by R 'quantiles' method. | ||
* 'hinges' and 'fivenum': the method used by R 'boxplot.stats' method. | ||
* 'linear': the interpolation method 'linear' as used by 'numpy.percentile' function | ||
* 'lower': the interpolation method 'lower' as used by 'numpy.percentile' function | ||
* 'higher': the interpolation method 'higher' as used by 'numpy.percentile' function | ||
* 'nearest': the interpolation method 'nearest' as used by 'numpy.percentile' function | ||
* 'midpoint': the interpolation method 'midpoint' as used by 'numpy.percentile' function | ||
* @default 7 | ||
*/ | ||
quantiles: | ||
| 7 | ||
| 'quantiles' | ||
| 'hinges' | ||
| 'fivenum' | ||
| 'linear' | ||
| 'lower' | ||
| 'higher' | ||
| 'nearest' | ||
| 'midpoint' | ||
| ((sortedArr: number[]) => { min: number; q1: number; median: number; q3: number; max: number }); | ||
} | ||
interface IBoxplotOptions extends IBaseOptions { | ||
// no extra options | ||
} | ||
interface IViolinOptions extends IBaseOptions { | ||
/** | ||
* number of points that should be samples of the KDE | ||
* @default 100 | ||
*/ | ||
points: number; | ||
} | ||
interface IChartJSOptions { | ||
boxplot: { | ||
datasets: {}; | ||
}; | ||
} | ||
``` | ||
## Styling | ||
The boxplot element is called `boxandwhiskers`. The basic options are from the `rectangle` element. The violin element is called `violin` also based on the `rectangle` element. | ||
```ts | ||
interface IBaseStyling { | ||
/** | ||
* @default see rectangle | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
backgroundColor: string; | ||
/** | ||
* @default see rectangle | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
borderColor: string; | ||
/** | ||
* @default 1 | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
borderWidth: number; | ||
/** | ||
* item style used to render outliers | ||
* @default circle | ||
*/ | ||
outlierStyle: | ||
| 'circle' | ||
| 'triangle' | ||
| 'rect' | ||
| 'rectRounded' | ||
| 'rectRot' | ||
| 'cross' | ||
| 'crossRot' | ||
| 'star' | ||
| 'line' | ||
| 'dash'; | ||
/** | ||
* radius used to render outliers | ||
* @default 2 | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
outlierRadius: number; | ||
/** | ||
* @default see rectangle.backgroundColor | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
outlierBackgroundColor: string; | ||
/** | ||
* @default see rectangle.borderColor | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
outlierBorderColor: string; | ||
/** | ||
* @default 1 | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
outlierBorderWidth: number; | ||
/** | ||
* item style used to render items | ||
* @default circle | ||
*/ | ||
itemStyle: | ||
| 'circle' | ||
| 'triangle' | ||
| 'rect' | ||
| 'rectRounded' | ||
| 'rectRot' | ||
| 'cross' | ||
| 'crossRot' | ||
| 'star' | ||
| 'line' | ||
| 'dash'; | ||
/** | ||
* radius used to render items | ||
* @default 0 so disabled | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
itemRadius: number; | ||
/** | ||
* background color for items | ||
* @default see rectangle.backgroundColor | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
itemBackgroundColor: string; | ||
/** | ||
* border color for items | ||
* @default see rectangle.borderColor | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
itemBorderColor: string; | ||
/** | ||
* border width for items | ||
* @default 0 | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
itemBorderColor: number; | ||
/** | ||
* padding that is added around the bounding box when computing a mouse hit | ||
* @default 2 | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
hitPadding: number; | ||
/** | ||
* hit radius for hit test of outliers | ||
* @default 4 | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
outlierHitRadius: number; | ||
} | ||
interface IBoxPlotStyling extends IBaseStyling { | ||
/** | ||
* separate color for the median line | ||
* @default 'transparent' takes the current borderColor | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
medianColor: string; | ||
/** | ||
* color the lower half (median-q3) of the box in a different color | ||
* @default 'transparent' takes the current borderColor | ||
* @scriptable | ||
* @indexable | ||
*/ | ||
lowerBackgroundColor: string; | ||
} | ||
interface IViolinElementStyling extends IBaseStyling { | ||
// no extras | ||
} | ||
``` | ||
## Data structure | ||
@@ -264,43 +40,4 @@ | ||
```ts | ||
interface IBaseItem { | ||
min: number; | ||
median: number; | ||
max: number; | ||
/** | ||
* values of the raw items used for rendering jittered background points | ||
*/ | ||
items?: number[]; | ||
} | ||
see https://github.com/sgratzl/chartjs-chart-boxplot/blob/develop/src/data.ts#L24-L49 | ||
interface IBoxPlotItem extends IBaseItem { | ||
q1: number; | ||
q3: number; | ||
whiskerMin?: number; | ||
whiskerMax?: number; | ||
/** | ||
* list of box plot outlier values | ||
*/ | ||
outliers?: number[]; | ||
} | ||
interface IKDESamplePoint { | ||
/** | ||
* sample value | ||
*/ | ||
v: number; | ||
/** | ||
* sample estimation | ||
*/ | ||
estimate: number; | ||
} | ||
interface IViolinItem extends IBaseItem { | ||
/** | ||
* samples of the underlying KDE | ||
*/ | ||
coords: IKDESamplePoint[]; | ||
} | ||
``` | ||
## Tooltips | ||
@@ -369,21 +106,25 @@ | ||
npm i -g yarn | ||
yarn set version 2.1.0 | ||
yarn set version 2 | ||
cat .yarnrc_patch.yml >> .yarnrc.yml | ||
yarn | ||
yarn pnpify --sdk vscode | ||
yarn pnpify --sdk | ||
``` | ||
### Building | ||
### Common commands | ||
```sh | ||
yarn install | ||
yarn compile | ||
yarn test | ||
yarn lint | ||
yarn fix | ||
yarn build | ||
yarn docs | ||
yarn release | ||
yarn release:pre | ||
``` | ||
--- | ||
## Credits | ||
<a href="https://www.datavisyn.io"><img src="https://www.datavisyn.io/img/logos/datavisyn-d-logo.png" align="left" width="25px" hspace="10" vspace="6"></a> | ||
developed by **[datavisyn][datavisyn-url]**. | ||
Original credits belong to [@datavisyn](https://www.datavisyn.io). | ||
[datavisyn-image]: https://img.shields.io/badge/datavisyn-io-black.svg | ||
[datavisyn-url]: https://www.datavisyn.io | ||
[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg | ||
@@ -390,0 +131,0 @@ [mit-url]: https://opensource.org/licenses/MIT |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
337161
2
32
5109
0
2
34
133
1
- Removed@babel/runtime@^7.10.5
- Removed@sgratzl/science@^2.0.0
- Removed@babel/runtime@7.26.0(transitive)
- Removed@sgratzl/chartjs-esm-facade@3.0.0-alpha.21(transitive)
- Removed@sgratzl/science@2.0.0(transitive)
- Removedregenerator-runtime@0.14.1(transitive)