@sgratzl/chartjs-chart-boxplot
Advanced tools
Comparing version 4.4.1 to 4.4.2
@@ -278,4 +278,3 @@ /** | ||
type BoxPlotDataPoint = number[] | (Partial<IBoxPlot> & Pick<IBoxPlot, 'min' | 'max' | 'median' | 'q1' | 'q3'>); | ||
interface IBoxPlotChartOptions extends IBoxplotOptions { | ||
} | ||
type IBoxPlotChartOptions = IBoxplotOptions; | ||
declare module 'chart.js' { | ||
@@ -288,3 +287,3 @@ interface ChartTypeRegistry { | ||
scales: keyof CartesianScaleTypeRegistry; | ||
metaExtensions: {}; | ||
metaExtensions: object; | ||
parsedDataType: IBoxPlot & ChartTypeRegistry['bar']['parsedDataType']; | ||
@@ -309,4 +308,3 @@ }; | ||
} | ||
interface IViolinChartOptions extends IViolinOptions { | ||
} | ||
type IViolinChartOptions = IViolinOptions; | ||
declare module 'chart.js' { | ||
@@ -319,3 +317,3 @@ interface ChartTypeRegistry { | ||
scales: keyof CartesianScaleTypeRegistry; | ||
metaExtensions: {}; | ||
metaExtensions: object; | ||
parsedDataType: IViolin & ChartTypeRegistry['bar']['parsedDataType']; | ||
@@ -322,0 +320,0 @@ }; |
{ | ||
"name": "@sgratzl/chartjs-chart-boxplot", | ||
"description": "Chart.js module for charting boxplots and violin charts", | ||
"version": "4.4.1", | ||
"version": "4.4.2", | ||
"publishConfig": { | ||
@@ -72,51 +72,39 @@ "access": "public" | ||
"dependencies": { | ||
"@sgratzl/boxplots": "^1.3.0" | ||
"@sgratzl/boxplots": "^1.3.2" | ||
}, | ||
"devDependencies": { | ||
"@chiogen/rollup-plugin-terser": "^7.1.3", | ||
"@rollup/plugin-commonjs": "^26.0.1", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-replace": "^5.0.7", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@types/jest": "^29.5.12", | ||
"@eslint/js": "^9.11.1", | ||
"@rollup/plugin-commonjs": "^28.0.0", | ||
"@rollup/plugin-node-resolve": "^15.3.0", | ||
"@rollup/plugin-replace": "^6.0.1", | ||
"@rollup/plugin-typescript": "^12.1.0", | ||
"@types/jest-image-snapshot": "^6.4.0", | ||
"@types/node": "^20.14.2", | ||
"@typescript-eslint/eslint-plugin": "^7.12.0", | ||
"@typescript-eslint/parser": "^7.12.0", | ||
"@yarnpkg/sdks": "^3.1.2", | ||
"@types/node": "^22.7.4", | ||
"@yarnpkg/sdks": "^3.2.0", | ||
"canvas": "^2.11.2", | ||
"canvas-5-polyfill": "^0.1.5", | ||
"chart.js": "^4.4.3", | ||
"eslint": "^8.57.0", | ||
"eslint-config-airbnb-typescript": "^18.0.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-config-react-app": "^7.0.1", | ||
"eslint-plugin-flowtype": "^8.0.3", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-jsx-a11y": "^6.8.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-react": "^7.34.2", | ||
"eslint-plugin-react-hooks": "^4.6.2", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"chart.js": "^4.4.4", | ||
"eslint": "^9.11.1", | ||
"eslint-plugin-prettier": "^5.2.1", | ||
"jest-image-snapshot": "^6.4.0", | ||
"prettier": "^3.3.1", | ||
"rimraf": "^5.0.7", | ||
"rollup": "^4.18.0", | ||
"jsdom": "^25.0.1", | ||
"prettier": "^3.3.3", | ||
"rimraf": "^6.0.1", | ||
"rollup": "^4.22.5", | ||
"rollup-plugin-cleanup": "^3.2.1", | ||
"rollup-plugin-dts": "^6.1.1", | ||
"ts-jest": "^29.1.4", | ||
"tslib": "^2.6.3", | ||
"typedoc": "^0.25.13", | ||
"typedoc-plugin-markdown": "^4.0.3", | ||
"typedoc-vitepress-theme": "^1.0.0", | ||
"typescript": "^5.4.5", | ||
"vitepress": "^1.2.3", | ||
"vue": "^3.4.27", | ||
"ts-jest": "^29.2.5", | ||
"tslib": "^2.7.0", | ||
"typedoc": "^0.26.7", | ||
"typedoc-plugin-markdown": "^4.2.8", | ||
"typedoc-vitepress-theme": "^1.0.1", | ||
"typescript": "^5.6.2", | ||
"typescript-eslint": "^8.7.0", | ||
"vite": "^5.4.8", | ||
"vitepress": "^1.3.4", | ||
"vitest": "^2.1.1", | ||
"vue": "^3.5.10", | ||
"vue-chartjs": "^5.3.1" | ||
}, | ||
"resolutions": { | ||
"@typescript-eslint/eslint-plugin": "^7.2.0", | ||
"@typescript-eslint/parser": "^7.2.0" | ||
}, | ||
"scripts": { | ||
@@ -128,3 +116,3 @@ "clean": "rimraf --glob build node_modules \"*.tgz\" \"*.tsbuildinfo\"", | ||
"build": "rollup -c", | ||
"test": "yarn node --experimental-vm-modules $(yarn bin jest) --passWithNoTests --detectOpenHandles --forceExit", | ||
"test": "vitest --passWithNoTests", | ||
"test:watch": "yarn run test --watch", | ||
@@ -136,3 +124,3 @@ "test:coverage": "yarn run test --coverage", | ||
"prettier": "prettier \"*\" \"*/**\" --check", | ||
"eslint": "eslint src --ext .ts,.tsx --cache", | ||
"eslint": "eslint src --cache", | ||
"eslint:fix": "yarn run eslint --fix", | ||
@@ -145,3 +133,3 @@ "prepare": "yarn run build", | ||
}, | ||
"packageManager": "yarn@4.2.2" | ||
"packageManager": "yarn@4.5.0" | ||
} |
@@ -1,4 +0,4 @@ | ||
/// <reference types="jest" /> | ||
/// <reference types="node" /> | ||
import { expect } from 'vitest'; | ||
import { Chart, ChartConfiguration, defaults, ChartType, DefaultDataPoint } from 'chart.js'; | ||
@@ -15,3 +15,3 @@ import { toMatchImageSnapshot, MatchImageSnapshotOptions } from 'jest-image-snapshot'; | ||
file.onload = () => resolve(Buffer.from(file.result as ArrayBuffer)); | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
file.readAsArrayBuffer(b!); | ||
@@ -44,3 +44,3 @@ }); | ||
// defaults.color = 'transparent'; | ||
// eslint-disable-next-line no-param-reassign | ||
config.options = { | ||
@@ -61,3 +61,3 @@ responsive: false, | ||
} as any; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const ctx = canvas.getContext('2d')!; | ||
@@ -64,0 +64,0 @@ |
@@ -1,2 +0,1 @@ | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
import type { BoxPlotDataPoint } from '../BoxPlotController'; | ||
@@ -49,3 +48,2 @@ | ||
// eslint-disable-next-line class-methods-use-this | ||
months({ count = 12, section }: { count?: number; section?: number }): string[] { | ||
@@ -123,3 +121,2 @@ const values: string[] = []; | ||
// eslint-disable-next-line class-methods-use-this | ||
labels({ | ||
@@ -126,0 +123,0 @@ min = 0, |
@@ -12,2 +12,3 @@ import { | ||
} from 'chart.js'; | ||
import { describe, beforeAll, test } from 'vitest'; | ||
import createChart from '../__tests__/createChart'; | ||
@@ -14,0 +15,0 @@ import { BoxPlotController, BoxPlotDataPoint } from './BoxPlotController'; |
@@ -27,3 +27,3 @@ import { | ||
*/ | ||
// eslint-disable-next-line class-methods-use-this | ||
protected _parseStats(value: unknown, config: IBoxplotOptions): IBoxPlot | undefined { | ||
@@ -36,7 +36,6 @@ return asBoxPlotStats(value, config); | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
protected _transformStats<T>(target: any, source: IBoxPlot, mapper: (v: number) => T): void { | ||
super._transformStats(target, source, mapper); | ||
for (const key of ['whiskerMin', 'whiskerMax']) { | ||
// eslint-disable-next-line no-param-reassign | ||
target[key] = mapper(source[key as 'whiskerMin' | 'whiskerMax']); | ||
@@ -87,4 +86,3 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface IBoxPlotChartOptions extends IBoxplotOptions {} | ||
export type IBoxPlotChartOptions = IBoxplotOptions; | ||
@@ -98,3 +96,3 @@ declare module 'chart.js' { | ||
scales: keyof CartesianScaleTypeRegistry; | ||
metaExtensions: {}; | ||
metaExtensions: object; | ||
parsedDataType: IBoxPlot & ChartTypeRegistry['bar']['parsedDataType']; | ||
@@ -101,0 +99,0 @@ }; |
@@ -70,3 +70,3 @@ import { BarController, Element, ChartMeta, LinearScale, Scale, UpdateMode } from 'chart.js'; | ||
*/ | ||
// eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types | ||
protected _transformStats<T>(target: any, source: S, mapper: (v: number) => T): void { | ||
@@ -76,3 +76,2 @@ for (const key of ['min', 'max', 'median', 'q3', 'q1', 'mean']) { | ||
if (typeof v === 'number') { | ||
// eslint-disable-next-line no-param-reassign | ||
target[key] = mapper(v); | ||
@@ -83,3 +82,2 @@ } | ||
if (Array.isArray(source[key as keyof IBaseStats])) { | ||
// eslint-disable-next-line no-param-reassign | ||
target[key] = source[key as 'outliers' | 'items'].map(mapper); | ||
@@ -96,9 +94,9 @@ } | ||
const config = this.options; | ||
// eslint-disable-next-line no-param-reassign | ||
scale.axis = config.minStats; | ||
const { min } = super.getMinMax(scale, canStack); | ||
// eslint-disable-next-line no-param-reassign | ||
scale.axis = config.maxStats; | ||
const { max } = super.getMinMax(scale, canStack); | ||
// eslint-disable-next-line no-param-reassign | ||
scale.axis = bak; | ||
@@ -112,5 +110,4 @@ return { min, max }; | ||
parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const vScale = meta.vScale!; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const iScale = meta.iScale!; | ||
@@ -150,3 +147,3 @@ const labels = iScale.getLabels(); | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
protected abstract _parseStats(value: any, options: C): S | undefined; | ||
@@ -191,5 +188,4 @@ /** | ||
*/ | ||
// eslint-disable-next-line class-methods-use-this | ||
protected _toStringStats(b: S): string { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const f = (v: number) => (v == null ? 'NaN' : formatNumber(v, this.chart.options.locale!, {})); | ||
@@ -204,3 +200,3 @@ return `(min: ${f(b.min)}, 25% quantile: ${f(b.q1)}, median: ${f(b.median)}, mean: ${f(b.mean)}, 75% quantile: ${f( | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
updateElement(rectangle: Element, index: number, properties: any, mode: UpdateMode): void { | ||
@@ -211,5 +207,5 @@ const reset = mode === 'reset'; | ||
const base = scale.getBasePixel(); | ||
// eslint-disable-next-line no-param-reassign | ||
properties._datasetIndex = this.index; | ||
// eslint-disable-next-line no-param-reassign | ||
properties._index = index; | ||
@@ -216,0 +212,0 @@ this._transformStats(properties, parsed, (v) => (reset ? base : scale.getPixelForValue(v, index))); |
@@ -6,2 +6,3 @@ import { CategoryScale, LinearScale, registry } from 'chart.js'; | ||
import { Violin } from '../elements'; | ||
import { describe, beforeAll, test } from 'vitest'; | ||
@@ -8,0 +9,0 @@ describe('violin', () => { |
@@ -28,3 +28,3 @@ import { | ||
*/ | ||
// eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types | ||
protected _parseStats(value: any, config: IViolinOptions): IViolin | undefined { | ||
@@ -37,9 +37,8 @@ return asViolinStats(value, config); | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
protected _transformStats<T>(target: any, source: IViolin, mapper: (v: number) => T): void { | ||
super._transformStats(target, source, mapper); | ||
// eslint-disable-next-line no-param-reassign | ||
target.maxEstimate = source.maxEstimate; | ||
if (Array.isArray(source.coords)) { | ||
// eslint-disable-next-line no-param-reassign | ||
target.coords = source.coords.map((c) => ({ ...c, v: mapper(c.v) })); | ||
@@ -94,4 +93,3 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface IViolinChartOptions extends IViolinOptions {} | ||
export type IViolinChartOptions = IViolinOptions; | ||
@@ -105,3 +103,3 @@ declare module 'chart.js' { | ||
scales: keyof CartesianScaleTypeRegistry; | ||
metaExtensions: {}; | ||
metaExtensions: object; | ||
parsedDataType: IViolin & ChartTypeRegistry['bar']['parsedDataType']; | ||
@@ -108,0 +106,0 @@ }; |
@@ -274,3 +274,2 @@ import { | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
export function asBoxPlotStats(value: any, options: IBoxplotOptions): IBoxPlot | undefined { | ||
@@ -289,5 +288,3 @@ if (!value) { | ||
); | ||
// eslint-disable-next-line no-param-reassign | ||
value.whiskerMin = whiskerMin; | ||
// eslint-disable-next-line no-param-reassign | ||
value.whiskerMax = whiskerMax; | ||
@@ -306,3 +303,3 @@ } | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
export function asViolinStats(value: any, options: IViolinOptions): IViolin | undefined { | ||
@@ -309,0 +306,0 @@ if (!value) { |
@@ -9,4 +9,4 @@ import { Element } from 'chart.js'; | ||
* @default see rectangle | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -17,4 +17,4 @@ backgroundColor: string; | ||
* @default see rectangle | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -25,4 +25,4 @@ borderColor: string; | ||
* @default 1 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -50,4 +50,4 @@ borderWidth: number; | ||
* @default 2 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -58,4 +58,4 @@ outlierRadius: number; | ||
* @default see rectangle.backgroundColor | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -66,4 +66,4 @@ outlierBackgroundColor: string; | ||
* @default see rectangle.borderColor | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -73,4 +73,4 @@ outlierBorderColor: string; | ||
* @default 1 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -98,4 +98,4 @@ outlierBorderWidth: number; | ||
* @default 0 so disabled | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -107,4 +107,4 @@ itemRadius: number; | ||
* @default see rectangle.backgroundColor | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -116,4 +116,4 @@ itemBackgroundColor: string; | ||
* @default see rectangle.borderColor | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -125,4 +125,4 @@ itemBorderColor: string; | ||
* @default 0 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -133,4 +133,4 @@ itemBorderWidth: number; | ||
* @default 0 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -142,4 +142,4 @@ itemHitRadius: number; | ||
* @default 2 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -151,4 +151,4 @@ hitPadding: number; | ||
* @default 4 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -176,4 +176,4 @@ outlierHitRadius: number; | ||
* @default 3 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -185,4 +185,4 @@ meanRadius: number; | ||
* @default see rectangle.backgroundColor | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -194,4 +194,4 @@ meanBackgroundColor: string; | ||
* @default see rectangle.borderColor | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -203,4 +203,4 @@ meanBorderColor: string; | ||
* @default 0 | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -394,3 +394,3 @@ meanBorderWidth: number; | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,class-methods-use-this | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
_getBounds(_useFinalPosition?: boolean): { left: number; top: number; right: number; bottom: number } { | ||
@@ -563,5 +563,4 @@ // abstract | ||
if (tooltip) { | ||
// eslint-disable-next-line no-param-reassign | ||
delete tooltip._tooltipOutlier; | ||
// eslint-disable-next-line no-param-reassign | ||
delete tooltip._tooltipItem; | ||
@@ -574,3 +573,3 @@ } | ||
// hack in the data of the hovered outlier | ||
// eslint-disable-next-line no-param-reassign | ||
tooltip._tooltipOutlier = { | ||
@@ -589,3 +588,3 @@ index: info.index, | ||
// hack in the data of the hovered outlier | ||
// eslint-disable-next-line no-param-reassign | ||
tooltip._tooltipItem = { | ||
@@ -592,0 +591,0 @@ index: itemInfo.index, |
@@ -19,4 +19,4 @@ import { BarElement, ChartType, CommonHoverOptions, ScriptableAndArrayOptions, ScriptableContext } from 'chart.js'; | ||
* @default 'transparent' takes the current borderColor | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -28,4 +28,4 @@ medianColor: string; | ||
* @default 'transparent' takes the current borderColor | ||
* @scriptable | ||
* @indexable | ||
* scriptable | ||
* indexable | ||
*/ | ||
@@ -32,0 +32,0 @@ lowerBackgroundColor: string; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
33
384957
5793
Updated@sgratzl/boxplots@^1.3.2