Skip to content

Commit

Permalink
Merge pull request #80 from sgratzl/release/v4.2.4
Browse files Browse the repository at this point in the history
Release v4.2.4
  • Loading branch information
sgratzl authored Jul 13, 2023
2 parents 96a92b2 + b0de682 commit 3b07c66
Show file tree
Hide file tree
Showing 10 changed files with 724 additions and 715 deletions.
2 changes: 1 addition & 1 deletion 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.3",
"version": "4.2.4",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/BoxPlotController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import { boxOptionsKeys } from '../elements/BoxAndWiskers';

export class BoxPlotController extends StatsBase<IBoxPlot, Required<IBoxplotOptions>> {
/**
* @internal
* @hidden
*/
// eslint-disable-next-line class-methods-use-this
protected _parseStats(value: unknown, config: IBoxplotOptions): IBoxPlot | undefined {
return asBoxPlotStats(value, config);
}

/**
* @internal
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
protected _transformStats<T>(target: any, source: IBoxPlot, mapper: (v: number) => T): void {
Expand All @@ -43,7 +43,7 @@ export class BoxPlotController extends StatsBase<IBoxPlot, Required<IBoxplotOpti
static readonly id = 'boxplot';

/**
* @internal
* @hidden
*/
static readonly defaults: any = /* #__PURE__ */ merge({}, [
BarController.defaults,
Expand All @@ -63,7 +63,7 @@ export class BoxPlotController extends StatsBase<IBoxPlot, Required<IBoxplotOpti
]);

/**
* @internal
* @hidden
*/
static readonly overrides: any = /* #__PURE__ */ merge({}, [(BarController as any).overrides, defaultOverrides()]);
}
Expand Down
22 changes: 11 additions & 11 deletions src/controllers/StatsBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { interpolateNumberArray } from '../animation';
import { outlierPositioner, patchInHoveredOutlier } from '../tooltip';
import { defaultStatsOptions, IBaseOptions, IBaseStats } from '../data';
/**
* @internal
* @hidden
*/
export /* #__PURE__ */ function baseDefaults(keys: string[]): Record<string, unknown> {
const colorKeys = ['borderColor', 'backgroundColor'].concat(keys.filter((c) => c.endsWith('Color')));
Expand Down Expand Up @@ -60,12 +60,12 @@ export function defaultOverrides(): Record<string, unknown> {

export abstract class StatsBase<S extends IBaseStats, C extends Required<IBaseOptions>> extends BarController {
/**
* @internal
* @hidden
*/
declare options: C;

/**
* @internal
* @hidden
*/
// 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 {
Expand All @@ -85,7 +85,7 @@ export abstract class StatsBase<S extends IBaseStats, C extends Required<IBaseOp
}

/**
* @internal
* @hidden
*/
getMinMax(scale: Scale, canStack?: boolean | undefined): { min: number; max: number } {
const bak = scale.axis;
Expand All @@ -102,7 +102,7 @@ export abstract class StatsBase<S extends IBaseStats, C extends Required<IBaseOp
}

/**
* @internal
* @hidden
*/
parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Expand All @@ -126,26 +126,26 @@ export abstract class StatsBase<S extends IBaseStats, C extends Required<IBaseOp
}

/**
* @internal
* @hidden
*/
parseArrayData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] {
return this.parsePrimitiveData(meta, data, start, count);
}

/**
* @internal
* @hidden
*/
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] {
return this.parsePrimitiveData(meta, data, start, count);
}

/**
* @internal
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
protected abstract _parseStats(value: any, options: C): S | undefined;
/**
* @internal
* @hidden
*/
getLabelAndValue(index: number): { label: string; value: string & { raw: S; hoveredOutlierIndex: number } & S } {
const r = super.getLabelAndValue(index) as any;
Expand All @@ -172,7 +172,7 @@ export abstract class StatsBase<S extends IBaseStats, C extends Required<IBaseOp
}

/**
* @internal
* @hidden
*/
// eslint-disable-next-line class-methods-use-this
protected _toStringStats(b: S): string {
Expand All @@ -184,7 +184,7 @@ export abstract class StatsBase<S extends IBaseStats, C extends Required<IBaseOp
}

/**
* @internal
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
updateElement(rectangle: Element, index: number, properties: any, mode: UpdateMode): void {
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/ViolinController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ import patchController from './patchController';

export class ViolinController extends StatsBase<IViolin, Required<IViolinOptions>> {
/**
* @internal
* @hidden
*/
// eslint-disable-next-line class-methods-use-this,@typescript-eslint/explicit-module-boundary-types
protected _parseStats(value: any, config: IViolinOptions): IViolin | undefined {
return asViolinStats(value, config);
}

/**
* @internal
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
protected _transformStats<T>(target: any, source: IViolin, mapper: (v: number) => T): void {
Expand All @@ -46,7 +46,7 @@ export class ViolinController extends StatsBase<IViolin, Required<IViolinOptions
static readonly id = 'violin';

/**
* @internal
* @hidden
*/
static readonly defaults: any = /* #__PURE__ */ merge({}, [
BarController.defaults,
Expand All @@ -71,7 +71,7 @@ export class ViolinController extends StatsBase<IViolin, Required<IViolinOptions
]);

/**
* @internal
* @hidden
*/
static readonly overrides: any = /* #__PURE__ */ merge({}, [(BarController as any).overrides, defaultOverrides()]);
}
Expand Down
12 changes: 6 additions & 6 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export interface IViolinOptions extends IBaseOptions {
}

/**
* @internal
* @hidden
*/
export const defaultStatsOptions = {
coef: 1.5,
Expand Down Expand Up @@ -184,7 +184,7 @@ function determineStatsOptions(options?: IBaseOptions) {
}

/**
* @internal
* @hidden
*/
export function boxplotStats(arr: readonly number[] | Float32Array | Float64Array, options: IBaseOptions): IBoxPlot {
const vs =
Expand Down Expand Up @@ -221,7 +221,7 @@ function computeSamples(min: number, max: number, points: number) {
}

/**
* @internal
* @hidden
*/
export function violinStats(arr: readonly number[], options: IViolinOptions): IViolin | undefined {
// console.assert(Array.isArray(arr));
Expand Down Expand Up @@ -254,7 +254,7 @@ export function violinStats(arr: readonly number[], options: IViolinOptions): IV
}

/**
* @internal
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export function asBoxPlotStats(value: any, options: IBoxplotOptions): IBoxPlot | undefined {
Expand Down Expand Up @@ -284,7 +284,7 @@ export function asBoxPlotStats(value: any, options: IBoxplotOptions): IBoxPlot |
}

/**
* @internal
* @hidden
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export function asViolinStats(value: any, options: IViolinOptions): IViolin | undefined {
Expand All @@ -301,7 +301,7 @@ export function asViolinStats(value: any, options: IViolinOptions): IViolin | un
}

/**
* @internal
* @hidden
*/
export function rnd(seed = Date.now()): () => number {
// Adapted from http://indiegamr.com/generate-repeatable-random-numbers-in-js/
Expand Down
16 changes: 8 additions & 8 deletions src/elements/BoxAndWiskers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
type IStatsBaseProps,
} from './base';
/**
* @internal
* @hidden
*/
export const boxOptionsKeys = baseOptionKeys.concat(['medianColor', 'lowerBackgroundColor']);

Expand Down Expand Up @@ -41,7 +41,7 @@ export interface IBoxAndWhiskerProps extends IStatsBaseProps {

export class BoxAndWiskers extends StatsBase<IBoxAndWhiskerProps, IBoxAndWhiskersOptions> {
/**
* @internal
* @hidden
*/
draw(ctx: CanvasRenderingContext2D): void {
ctx.save();
Expand All @@ -60,7 +60,7 @@ export class BoxAndWiskers extends StatsBase<IBoxAndWhiskerProps, IBoxAndWhisker
}

/**
* @internal
* @hidden
*/
protected _drawBoxPlot(ctx: CanvasRenderingContext2D): void {
if (this.isVertical()) {
Expand All @@ -71,7 +71,7 @@ export class BoxAndWiskers extends StatsBase<IBoxAndWhiskerProps, IBoxAndWhisker
}

/**
* @internal
* @hidden
*/
protected _drawBoxPlotVertical(ctx: CanvasRenderingContext2D): void {
const { options } = this;
Expand Down Expand Up @@ -137,7 +137,7 @@ export class BoxAndWiskers extends StatsBase<IBoxAndWhiskerProps, IBoxAndWhisker
}

/**
* @internal
* @hidden
*/
protected _drawBoxPlotHorizontal(ctx: CanvasRenderingContext2D): void {
const { options } = this;
Expand Down Expand Up @@ -200,7 +200,7 @@ export class BoxAndWiskers extends StatsBase<IBoxAndWhiskerProps, IBoxAndWhisker
}

/**
* @internal
* @hidden
*/
_getBounds(useFinalPosition?: boolean): { left: number; top: number; right: number; bottom: number } {
const vert = this.isVertical();
Expand Down Expand Up @@ -242,7 +242,7 @@ export class BoxAndWiskers extends StatsBase<IBoxAndWhiskerProps, IBoxAndWhisker
static id = 'boxandwhiskers';

/**
* @internal
* @hidden
*/
static defaults = /* #__PURE__ */ {
...BarElement.defaults,
Expand All @@ -252,7 +252,7 @@ export class BoxAndWiskers extends StatsBase<IBoxAndWhiskerProps, IBoxAndWhisker
};

/**
* @internal
* @hidden
*/
static defaultRoutes = /* #__PURE__ */ { ...BarElement.defaultRoutes, ...baseRoutes };
}
Expand Down
10 changes: 5 additions & 5 deletions src/elements/Violin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface IViolinElementProps extends IStatsBaseProps {

export class Violin extends StatsBase<IViolinElementProps, IViolinElementOptions> {
/**
* @internal
* @hidden
*/
draw(ctx: CanvasRenderingContext2D): void {
ctx.save();
Expand Down Expand Up @@ -58,7 +58,7 @@ export class Violin extends StatsBase<IViolinElementProps, IViolinElementOptions
}

/**
* @internal
* @hidden
*/
protected _drawCoords(
ctx: CanvasRenderingContext2D,
Expand Down Expand Up @@ -103,7 +103,7 @@ export class Violin extends StatsBase<IViolinElementProps, IViolinElementOptions
}

/**
* @internal
* @hidden
*/
_getBounds(useFinalPosition?: boolean): { left: number; top: number; right: number; bottom: number } {
if (this.isVertical()) {
Expand All @@ -129,12 +129,12 @@ export class Violin extends StatsBase<IViolinElementProps, IViolinElementOptions
static id = 'violin';

/**
* @internal
* @hidden
*/
static defaults = /* #__PURE__ */ { ...BarElement.defaults, ...baseDefaults };

/**
* @internal
* @hidden
*/
static defaultRoutes = /* #__PURE__ */ { ...BarElement.defaultRoutes, ...baseRoutes };
}
Expand Down
Loading

0 comments on commit 3b07c66

Please sign in to comment.