New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chartjs-chart-error-bars

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chartjs-chart-error-bars - npm Package Compare versions

Comparing version 3.0.0-beta.4 to 3.0.0-beta.5

src/elements/BarWithErrorBar.ts

84

build/index.d.ts

@@ -8,5 +8,5 @@ /**

import { Rectangle, Point, Arc, BarController, Scale, IChartMeta, UpdateMode, IBarControllerDatasetOptions, ScriptableAndArrayOptions, IBarControllerChartOptions, ICartesianScaleTypeRegistry, Chart, ChartItem, IChartConfiguration, LineController, ILineControllerDatasetOptions, ILineControllerChartOptions, ScatterController, IScatterControllerDatasetOptions, IScatterControllerChartOptions, PolarAreaController, Element, IPolarAreaControllerDatasetOptions, IPolarAreaControllerChartOptions } from 'chart.js';
import { BarElement, PointElement, ArcElement, BarController, Scale, ChartMeta, UpdateMode, BarControllerDatasetOptions, ScriptableAndArrayOptions, BarControllerChartOptions, CartesianScaleTypeRegistry, Chart, ChartItem, ChartConfiguration, LineController, LineControllerDatasetOptions, LineControllerChartOptions, ScatterController, ScatterControllerDatasetOptions, ScatterControllerChartOptions, PolarAreaController, Element, PolarAreaControllerDatasetOptions, PolarAreaControllerChartOptions } from 'chart.js';
declare class RectangleWithErrorBar extends Rectangle {
declare class BarWithErrorBar extends BarElement {
draw(ctx: CanvasRenderingContext2D): void;

@@ -20,3 +20,3 @@ static readonly id = "rectangleWithErrorBar";

declare class PointWithErrorBar extends Point {
declare class PointWithErrorBar extends PointElement {
draw(ctx: CanvasRenderingContext2D): void;

@@ -30,3 +30,3 @@ static readonly id = "pointWithErrorBar";

declare class ArcWithErrorBar extends Arc {
declare class ArcWithErrorBar extends ArcElement {
draw(ctx: CanvasRenderingContext2D): void;

@@ -141,4 +141,4 @@ static readonly id = "arcWithErrorBar";

};
parseObjectData(meta: IChartMeta, data: any[], start: number, count: number): any[];
updateElement(element: Rectangle, index: number | undefined, properties: any, mode: UpdateMode): void;
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): any[];
updateElement(element: BarElement, index: number | undefined, properties: any, mode: UpdateMode): void;
static readonly id = "barWithErrorBars";

@@ -150,14 +150,11 @@ static readonly defaults: any;

}
interface IBarWithErrorBarsControllerDatasetOptions extends IBarControllerDatasetOptions, ScriptableAndArrayOptions<IErrorBarOptions> {
interface BarWithErrorBarsControllerDatasetOptions extends BarControllerDatasetOptions, ScriptableAndArrayOptions<IErrorBarOptions> {
}
declare module 'chart.js' {
enum ChartTypeEnum {
barWithErrorBars = "barWithErrorBars"
}
interface IChartTypeRegistry {
interface ChartTypeRegistry {
barWithErrorBars: {
chartOptions: IBarControllerChartOptions;
datasetOptions: IBarWithErrorBarsControllerDatasetOptions;
chartOptions: BarControllerChartOptions;
datasetOptions: BarWithErrorBarsControllerDatasetOptions;
defaultDataPoint: IErrorBarXDataPoint[];
scales: keyof ICartesianScaleTypeRegistry;
scales: keyof CartesianScaleTypeRegistry;
};

@@ -168,3 +165,3 @@ }

static id: string;
constructor(item: ChartItem, config: Omit<IChartConfiguration<'barWithErrorBars', DATA, LABEL>, 'type'>);
constructor(item: ChartItem, config: Omit<ChartConfiguration<'barWithErrorBars', DATA, LABEL>, 'type'>);
}

@@ -177,4 +174,4 @@

};
parseObjectData(meta: IChartMeta, data: any[], start: number, count: number): any[];
updateElement(element: Point, index: number | undefined, properties: any, mode: UpdateMode): void;
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): any[];
updateElement(element: PointElement, index: number | undefined, properties: any, mode: UpdateMode): void;
static readonly id = "lineWithErrorBars";

@@ -186,14 +183,11 @@ static readonly defaults: any;

}
interface ILineWithErrorBarsControllerDatasetOptions extends ILineControllerDatasetOptions, ScriptableAndArrayOptions<IErrorBarOptions> {
interface LineWithErrorBarsControllerDatasetOptions extends LineControllerDatasetOptions, ScriptableAndArrayOptions<IErrorBarOptions> {
}
declare module 'chart.js' {
enum ChartTypeEnum {
lineWithErrorBars = "lineWithErrorBars"
}
interface IChartTypeRegistry {
interface ChartTypeRegistry {
lineWithErrorBars: {
chartOptions: ILineControllerChartOptions;
datasetOptions: ILineWithErrorBarsControllerDatasetOptions;
chartOptions: LineControllerChartOptions;
datasetOptions: LineWithErrorBarsControllerDatasetOptions;
defaultDataPoint: IErrorBarXDataPoint[];
scales: keyof ICartesianScaleTypeRegistry;
scales: keyof CartesianScaleTypeRegistry;
};

@@ -204,3 +198,3 @@ }

static id: string;
constructor(item: ChartItem, config: Omit<IChartConfiguration<'lineWithErrorBars', DATA, LABEL>, 'type'>);
constructor(item: ChartItem, config: Omit<ChartConfiguration<'lineWithErrorBars', DATA, LABEL>, 'type'>);
}

@@ -213,4 +207,4 @@

};
parseObjectData(meta: IChartMeta, data: any[], start: number, count: number): any[];
updateElement(element: Point, index: number | undefined, properties: any, mode: UpdateMode): void;
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): any[];
updateElement(element: PointElement, index: number | undefined, properties: any, mode: UpdateMode): void;
static readonly id = "scatterWithErrorBars";

@@ -222,14 +216,11 @@ static readonly defaults: any;

}
interface IScatterWithErrorBarsControllerDatasetOptions extends IScatterControllerDatasetOptions, ScriptableAndArrayOptions<IErrorBarOptions> {
interface ScatterWithErrorBarsControllerDatasetOptions extends ScatterControllerDatasetOptions, ScriptableAndArrayOptions<IErrorBarOptions> {
}
declare module 'chart.js' {
enum ChartTypeEnum {
scatterWithErrorBars = "scatterWithErrorBars"
}
interface IChartTypeRegistry {
interface ChartTypeRegistry {
scatterWithErrorBars: {
chartOptions: IScatterControllerChartOptions;
datasetOptions: IScatterWithErrorBarsControllerDatasetOptions;
chartOptions: ScatterControllerChartOptions;
datasetOptions: ScatterWithErrorBarsControllerDatasetOptions;
defaultDataPoint: IErrorBarXYDataPoint[];
scales: keyof ICartesianScaleTypeRegistry;
scales: keyof CartesianScaleTypeRegistry;
};

@@ -240,3 +231,3 @@ }

static id: string;
constructor(item: ChartItem, config: Omit<IChartConfiguration<'scatterWithErrorBars', DATA, LABEL>, 'type'>);
constructor(item: ChartItem, config: Omit<ChartConfiguration<'scatterWithErrorBars', DATA, LABEL>, 'type'>);
}

@@ -251,3 +242,3 @@

_computeAngle(index: number): any;
parseObjectData(meta: IChartMeta, data: any[], start: number, count: number): any[];
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): any[];
updateElement(element: Element, index: number | undefined, properties: any, mode: UpdateMode): void;

@@ -261,14 +252,11 @@ updateElements(arcs: Element[], start: number, count: number, mode: UpdateMode): void;

}
interface IPolarAreaWithErrorBarsControllerDatasetOptions extends IPolarAreaControllerDatasetOptions, ScriptableAndArrayOptions<IErrorBarOptions> {
interface PolarAreaWithErrorBarsControllerDatasetOptions extends PolarAreaControllerDatasetOptions, ScriptableAndArrayOptions<IErrorBarOptions> {
}
declare module 'chart.js' {
enum ChartTypeEnum {
polarAreaWithErrorBars = "polarAreaWithErrorBars"
}
interface IChartTypeRegistry {
interface ChartTypeRegistry {
polarAreaWithErrorBars: {
chartOptions: IPolarAreaControllerChartOptions;
datasetOptions: IPolarAreaWithErrorBarsControllerDatasetOptions;
chartOptions: PolarAreaControllerChartOptions;
datasetOptions: PolarAreaWithErrorBarsControllerDatasetOptions;
defaultDataPoint: IErrorBarRDataPoint[];
scales: keyof ICartesianScaleTypeRegistry;
scales: keyof CartesianScaleTypeRegistry;
};

@@ -279,6 +267,6 @@ }

static id: string;
constructor(item: ChartItem, config: Omit<IChartConfiguration<'polarAreaWithErrorBars', DATA, LABEL>, 'type'>);
constructor(item: ChartItem, config: Omit<ChartConfiguration<'polarAreaWithErrorBars', DATA, LABEL>, 'type'>);
}
export { ArcWithErrorBar, BarWithErrorBarsChart, BarWithErrorBarsController, IBarWithErrorBarsControllerDatasetOptions, IErrorBarRDataPoint, IErrorBarXDataPoint, IErrorBarXYDataPoint, IErrorBarYDataPoint, ILineWithErrorBarsControllerDatasetOptions, IPolarAreaWithErrorBarsControllerDatasetOptions, IScatterWithErrorBarsControllerDatasetOptions, LineWithErrorBarsChart, LineWithErrorBarsController, PointWithErrorBar, PolarAreaWithErrorBarsChart, PolarAreaWithErrorBarsController, RectangleWithErrorBar, ScatterWithErrorBarsChart, ScatterWithErrorBarsController };
export { ArcWithErrorBar, BarWithErrorBar, BarWithErrorBarsChart, BarWithErrorBarsController, BarWithErrorBarsControllerDatasetOptions, IErrorBarRDataPoint, IErrorBarXDataPoint, IErrorBarXYDataPoint, IErrorBarYDataPoint, LineWithErrorBarsChart, LineWithErrorBarsController, LineWithErrorBarsControllerDatasetOptions, PointWithErrorBar, PolarAreaWithErrorBarsChart, PolarAreaWithErrorBarsController, PolarAreaWithErrorBarsControllerDatasetOptions, ScatterWithErrorBarsChart, ScatterWithErrorBarsController, ScatterWithErrorBarsControllerDatasetOptions };
//# sourceMappingURL=index.d.ts.map

@@ -8,3 +8,3 @@ /**

import { Rectangle, Point, Arc, Tooltip, PolarAreaController, registry, BarController, Chart, LinearScale, CategoryScale, LineController, ScatterController, RadialLinearScale } from 'chart.js';
import { BarElement, PointElement, ArcElement, Tooltip, PolarAreaController, registry, BarController, Chart, LinearScale, CategoryScale, LineController, ScatterController, RadialLinearScale } from 'chart.js';
import { color, merge, resolve } from 'chart.js/helpers';

@@ -163,3 +163,3 @@

class RectangleWithErrorBar extends Rectangle {
class BarWithErrorBar extends BarElement {
draw(ctx) {

@@ -170,7 +170,7 @@ super.draw(ctx);

}
RectangleWithErrorBar.id = 'rectangleWithErrorBar';
RectangleWithErrorBar.defaults = Object.assign({}, Rectangle.defaults, errorBarDefaults);
RectangleWithErrorBar.defaultRoutes = Rectangle.defaultRoutes;
BarWithErrorBar.id = 'rectangleWithErrorBar';
BarWithErrorBar.defaults = Object.assign({}, BarElement.defaults, errorBarDefaults);
BarWithErrorBar.defaultRoutes = BarElement.defaultRoutes;
class PointWithErrorBar extends Point {
class PointWithErrorBar extends PointElement {
draw(ctx) {

@@ -182,6 +182,6 @@ super.draw(ctx);

PointWithErrorBar.id = 'pointWithErrorBar';
PointWithErrorBar.defaults = Object.assign({}, Point.defaults, errorBarDefaults);
PointWithErrorBar.defaultRoutes = Point.defaultRoutes;
PointWithErrorBar.defaults = Object.assign({}, PointElement.defaults, errorBarDefaults);
PointWithErrorBar.defaultRoutes = PointElement.defaultRoutes;
class ArcWithErrorBar extends Arc {
class ArcWithErrorBar extends ArcElement {
draw(ctx) {

@@ -193,4 +193,4 @@ super.draw(ctx);

ArcWithErrorBar.id = 'arcWithErrorBar';
ArcWithErrorBar.defaults = Object.assign({}, Arc.defaults, errorBarDefaults);
ArcWithErrorBar.defaultRoutes = Arc.defaultRoutes;
ArcWithErrorBar.defaults = Object.assign({}, ArcElement.defaults, errorBarDefaults);
ArcWithErrorBar.defaultRoutes = ArcElement.defaultRoutes;

@@ -408,3 +408,3 @@ const allModelKeys = ['xMin', 'xMax', 'yMin', 'yMax'];

dataElementOptions: BarController.defaults.dataElementOptions.concat(styleKeys),
dataElementType: RectangleWithErrorBar.id,
dataElementType: BarWithErrorBar.id,
},

@@ -415,3 +415,3 @@ ]);

constructor(item, config) {
super(item, patchController('barWithErrorBars', config, BarWithErrorBarsController, RectangleWithErrorBar, [
super(item, patchController('barWithErrorBars', config, BarWithErrorBarsController, BarWithErrorBar, [
LinearScale,

@@ -585,3 +585,3 @@ CategoryScale,

export { ArcWithErrorBar, BarWithErrorBarsChart, BarWithErrorBarsController, LineWithErrorBarsChart, LineWithErrorBarsController, PointWithErrorBar, PolarAreaWithErrorBarsChart, PolarAreaWithErrorBarsController, RectangleWithErrorBar, ScatterWithErrorBarsChart, ScatterWithErrorBarsController };
export { ArcWithErrorBar, BarWithErrorBar, BarWithErrorBarsChart, BarWithErrorBarsController, LineWithErrorBarsChart, LineWithErrorBarsController, PointWithErrorBar, PolarAreaWithErrorBarsChart, PolarAreaWithErrorBarsController, ScatterWithErrorBarsChart, ScatterWithErrorBarsController };
//# sourceMappingURL=index.esm.js.map

@@ -166,3 +166,3 @@ /**

class RectangleWithErrorBar extends chart_js.Rectangle {
class BarWithErrorBar extends chart_js.BarElement {
draw(ctx) {

@@ -173,7 +173,7 @@ super.draw(ctx);

}
RectangleWithErrorBar.id = 'rectangleWithErrorBar';
RectangleWithErrorBar.defaults = Object.assign({}, chart_js.Rectangle.defaults, errorBarDefaults);
RectangleWithErrorBar.defaultRoutes = chart_js.Rectangle.defaultRoutes;
BarWithErrorBar.id = 'rectangleWithErrorBar';
BarWithErrorBar.defaults = Object.assign({}, chart_js.BarElement.defaults, errorBarDefaults);
BarWithErrorBar.defaultRoutes = chart_js.BarElement.defaultRoutes;
class PointWithErrorBar extends chart_js.Point {
class PointWithErrorBar extends chart_js.PointElement {
draw(ctx) {

@@ -185,6 +185,6 @@ super.draw(ctx);

PointWithErrorBar.id = 'pointWithErrorBar';
PointWithErrorBar.defaults = Object.assign({}, chart_js.Point.defaults, errorBarDefaults);
PointWithErrorBar.defaultRoutes = chart_js.Point.defaultRoutes;
PointWithErrorBar.defaults = Object.assign({}, chart_js.PointElement.defaults, errorBarDefaults);
PointWithErrorBar.defaultRoutes = chart_js.PointElement.defaultRoutes;
class ArcWithErrorBar extends chart_js.Arc {
class ArcWithErrorBar extends chart_js.ArcElement {
draw(ctx) {

@@ -196,4 +196,4 @@ super.draw(ctx);

ArcWithErrorBar.id = 'arcWithErrorBar';
ArcWithErrorBar.defaults = Object.assign({}, chart_js.Arc.defaults, errorBarDefaults);
ArcWithErrorBar.defaultRoutes = chart_js.Arc.defaultRoutes;
ArcWithErrorBar.defaults = Object.assign({}, chart_js.ArcElement.defaults, errorBarDefaults);
ArcWithErrorBar.defaultRoutes = chart_js.ArcElement.defaultRoutes;

@@ -411,3 +411,3 @@ const allModelKeys = ['xMin', 'xMax', 'yMin', 'yMax'];

dataElementOptions: chart_js.BarController.defaults.dataElementOptions.concat(styleKeys),
dataElementType: RectangleWithErrorBar.id,
dataElementType: BarWithErrorBar.id,
},

@@ -418,3 +418,3 @@ ]);

constructor(item, config) {
super(item, patchController('barWithErrorBars', config, BarWithErrorBarsController, RectangleWithErrorBar, [
super(item, patchController('barWithErrorBars', config, BarWithErrorBarsController, BarWithErrorBar, [
chart_js.LinearScale,

@@ -589,2 +589,3 @@ chart_js.CategoryScale,

exports.ArcWithErrorBar = ArcWithErrorBar;
exports.BarWithErrorBar = BarWithErrorBar;
exports.BarWithErrorBarsChart = BarWithErrorBarsChart;

@@ -597,5 +598,4 @@ exports.BarWithErrorBarsController = BarWithErrorBarsController;

exports.PolarAreaWithErrorBarsController = PolarAreaWithErrorBarsController;
exports.RectangleWithErrorBar = RectangleWithErrorBar;
exports.ScatterWithErrorBarsChart = ScatterWithErrorBarsChart;
exports.ScatterWithErrorBarsController = ScatterWithErrorBarsController;
//# sourceMappingURL=index.js.map

@@ -201,3 +201,3 @@ /**

class RectangleWithErrorBar extends chart_js.Rectangle {
class BarWithErrorBar extends chart_js.BarElement {
draw(ctx) {

@@ -208,7 +208,7 @@ super.draw(ctx);

}
RectangleWithErrorBar.id = 'rectangleWithErrorBar';
RectangleWithErrorBar.defaults = Object.assign({}, chart_js.Rectangle.defaults, errorBarDefaults);
RectangleWithErrorBar.defaultRoutes = chart_js.Rectangle.defaultRoutes;
BarWithErrorBar.id = 'rectangleWithErrorBar';
BarWithErrorBar.defaults = Object.assign({}, chart_js.BarElement.defaults, errorBarDefaults);
BarWithErrorBar.defaultRoutes = chart_js.BarElement.defaultRoutes;
class PointWithErrorBar extends chart_js.Point {
class PointWithErrorBar extends chart_js.PointElement {
draw(ctx) {

@@ -220,6 +220,6 @@ super.draw(ctx);

PointWithErrorBar.id = 'pointWithErrorBar';
PointWithErrorBar.defaults = Object.assign({}, chart_js.Point.defaults, errorBarDefaults);
PointWithErrorBar.defaultRoutes = chart_js.Point.defaultRoutes;
PointWithErrorBar.defaults = Object.assign({}, chart_js.PointElement.defaults, errorBarDefaults);
PointWithErrorBar.defaultRoutes = chart_js.PointElement.defaultRoutes;
class ArcWithErrorBar extends chart_js.Arc {
class ArcWithErrorBar extends chart_js.ArcElement {
draw(ctx) {

@@ -231,4 +231,4 @@ super.draw(ctx);

ArcWithErrorBar.id = 'arcWithErrorBar';
ArcWithErrorBar.defaults = Object.assign({}, chart_js.Arc.defaults, errorBarDefaults);
ArcWithErrorBar.defaultRoutes = chart_js.Arc.defaultRoutes;
ArcWithErrorBar.defaults = Object.assign({}, chart_js.ArcElement.defaults, errorBarDefaults);
ArcWithErrorBar.defaultRoutes = chart_js.ArcElement.defaultRoutes;

@@ -410,3 +410,3 @@ function reverseOrder(v) {

dataElementOptions: chart_js.BarController.defaults.dataElementOptions.concat(styleKeys),
dataElementType: RectangleWithErrorBar.id,
dataElementType: BarWithErrorBar.id,
},

@@ -417,3 +417,3 @@ ]);

constructor(item, config) {
super(item, patchController('barWithErrorBars', config, BarWithErrorBarsController, RectangleWithErrorBar, [
super(item, patchController('barWithErrorBars', config, BarWithErrorBarsController, BarWithErrorBar, [
chart_js.LinearScale,

@@ -588,5 +588,6 @@ chart_js.CategoryScale,

chart_js.registry.addControllers(BarWithErrorBarsController, LineWithErrorBarsController, PolarAreaWithErrorBarsController, ScatterWithErrorBarsController);
chart_js.registry.addElements(RectangleWithErrorBar, ArcWithErrorBar, LineWithErrorBarsController, PointWithErrorBar);
chart_js.registry.addElements(BarWithErrorBar, ArcWithErrorBar, LineWithErrorBarsController, PointWithErrorBar);
exports.ArcWithErrorBar = ArcWithErrorBar;
exports.BarWithErrorBar = BarWithErrorBar;
exports.BarWithErrorBarsChart = BarWithErrorBarsChart;

@@ -599,3 +600,2 @@ exports.BarWithErrorBarsController = BarWithErrorBarsController;

exports.PolarAreaWithErrorBarsController = PolarAreaWithErrorBarsController;
exports.RectangleWithErrorBar = RectangleWithErrorBar;
exports.ScatterWithErrorBarsChart = ScatterWithErrorBarsChart;

@@ -602,0 +602,0 @@ exports.ScatterWithErrorBarsController = ScatterWithErrorBarsController;

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("chart.js"),require("chart.js/helpers")):"function"==typeof define&&define.amd?define(["exports","chart.js","chart.js/helpers"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).ChartErrorBars={},e.Chart,e.Chart.helpers)}(this,(function(e,r,t){"use strict";const a=["xMin","xMax","yMin","yMax"];function n(e){return e?a.slice(0,2):a.slice(2)}function s(e,r,t,a,n){const s=[a.axis+"Min",a.axis+"Max"],o=a.getBasePixel();for(const i of s){const s=r[i];Array.isArray(s)?e[i]=s.map(e=>n?o:a.getPixelForValue(e,t)):"number"==typeof s&&(e[i]=n?o:a.getPixelForValue(s,t))}}const o={errorBarLineWidth:{v:[1,3]},errorBarColor:{v:["#2c2c2c","#1f1f1f"]},errorBarWhiskerLineWidth:{v:[1,3]},errorBarWhiskerRatio:{v:[.2,.25]},errorBarWhiskerSize:{v:[20,24]},errorBarWhiskerColor:{v:["#2c2c2c","#1f1f1f"]}},i=Object.keys(o),l={};function c(e,r){const t=Array.isArray(e)?e:[e],a=Array.isArray(r)?r:[r];if(t.length===a.length)return t.map((e,r)=>[e,a[r]]);const n=Math.max(t.length,a.length);return Array(n).map((e,r)=>[t[r%t.length],a[r%a.length]])}function u(e,r){if("string"==typeof e||"number"==typeof e)return e;const t=Array.isArray(e)?e:e.v;return t[r%t.length]}function d(e,r,t){const a=u(r.errorBarWhiskerRatio,t);if(null!=e&&a>0)return e*a*.5;return.5*u(r.errorBarWhiskerSize,t)}function h(e,r){const t=e.getProps(["x","y","width","height","xMin","xMax","yMin","yMax"]);null==t.xMin&&null==t.xMax||function(e,r,t,a,n){n.save(),n.translate(0,e.y),null==r&&(r=e.x),null==t&&(t=e.x);const s=c(r,t);s.reverse().forEach(([r,t],o)=>{const i=s.length-o-1,l=d(e.height,a,i);n.lineWidth=u(a.errorBarLineWidth,i),n.strokeStyle=u(a.errorBarColor,i),n.beginPath(),n.moveTo(r,0),n.lineTo(t,0),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,i),n.strokeStyle=u(a.errorBarWhiskerColor,i),n.beginPath(),n.moveTo(r,-l),n.lineTo(r,l),n.moveTo(t,-l),n.lineTo(t,l),n.stroke()}),n.restore()}(t,t.xMin,t.xMax,e.options,r),null==t.yMin&&null==t.yMax||function(e,r,t,a,n){n.save(),n.translate(e.x,0);const s=c(null==r?e.y:r,null==t?e.y:t);s.reverse().forEach(([r,t],o)=>{const i=s.length-o-1,l=d(e.width,a,i);n.lineWidth=u(a.errorBarLineWidth,i),n.strokeStyle=u(a.errorBarColor,i),n.beginPath(),n.moveTo(0,r),n.lineTo(0,t),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,i),n.strokeStyle=u(a.errorBarWhiskerColor,i),n.beginPath(),n.moveTo(-l,r),n.lineTo(l,r),n.moveTo(-l,t),n.lineTo(l,t),n.stroke()}),n.restore()}(t,t.yMin,t.yMax,e.options,r)}function f(e,r){const t=e.getProps(["x","y","startAngle","endAngle","rMin","rMax","outerRadius"]);null==t.rMin&&null==t.rMax||function(e,r,t,a,n){n.save(),n.translate(e.x,e.y),null==r&&(r=e.outerRadius),null==t&&(t=e.outerRadius);const s=(e.startAngle+e.endAngle)/2,o=Math.cos(s),i=Math.sin(s),l={x:-i,y:o},h=Math.sqrt(l.x*l.x+l.y*l.y);l.x/=h,l.y/=h;const f=c(r,t);f.reverse().forEach(([e,r],t)=>{const s=f.length-t-1,c=e*o,h=e*i,p=r*o,y=r*i,x=d(null,a,s),m=l.x*x,g=l.y*x;n.lineWidth=u(a.errorBarLineWidth,s),n.strokeStyle=u(a.errorBarColor,s),n.beginPath(),n.moveTo(c,h),n.lineTo(p,y),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,s),n.strokeStyle=u(a.errorBarWhiskerColor,s),n.beginPath(),n.moveTo(c+m,h+g),n.lineTo(c-m,h-g),n.moveTo(p+m,y+g),n.lineTo(p-m,y-g),n.stroke()}),n.restore()}(t,t.rMin,t.rMax,e.options,r)}i.forEach(e=>l[e]=e);class p extends r.Rectangle{draw(e){super.draw(e),h(this,e)}}p.id="rectangleWithErrorBar",p.defaults=Object.assign({},r.Rectangle.defaults,o),p.defaultRoutes=r.Rectangle.defaultRoutes;class y extends r.Point{draw(e){super.draw(e),h(this,e)}}y.id="pointWithErrorBar",y.defaults=Object.assign({},r.Point.defaults,o),y.defaultRoutes=r.Point.defaultRoutes;class x extends r.Arc{draw(e){super.draw(e),f(this,e)}}function m(e){return Array.isArray(e)?e.slice().reverse():e}function g(e){const t=n(e.element.horizontal),a=r.Tooltip.defaults.callbacks.label.call(this,e),s=e.chart.data.datasets[e.datasetIndex].data[e.dataIndex];return null==s||t.every(e=>null==s[e])?a:`${a} (${m(s[t[0]])} .. ${s[t[1]]})`}x.id="arcWithErrorBar",x.defaults=Object.assign({},r.Arc.defaults,o),x.defaultRoutes=r.Arc.defaultRoutes;const M={color(e,r,a){const n=e||"transparent",s=r||"transparent";if(n===s)return r;const o=t.color(n),i=o.valid&&t.color(s);return i&&i.valid?i.mix(o,a).hexString():r},number:(e,r,t)=>e===r?r:e+(r-e)*t};function b(e,r,t,a,n){if(typeof e===a&&typeof r===a)return n(e,r,t);if(Array.isArray(e)&&Array.isArray(r))return e.map((e,a)=>n(e,r[a],t));const s=e=>e&&Array.isArray(e.v);return s(e)&&Array.isArray(e.v)&&s(r)?e.v.map((e,a)=>n(e,r.v[a],t)):r}const E={datasets:{animation:{numberArray:{fn:function(e,r,t){return b(e,r,t,"number",M.number)},properties:a.concat(i.filter(e=>!e.endsWith("Color")),["rMin","rMax"])},colorArray:{fn:function(e,r,t){return b(e,r,t,"string",M.color)},properties:a.concat(i.filter(e=>e.endsWith("Color")))}}}};function C(e,r,t){const a=e.axis;e.axis=a+"MinMin";const n=t(e,r).min;e.axis=a+"MaxMax";const s=t(e,r).max;return e.axis=a,{min:n,max:s}}function B(e,r,t){return Array.isArray(r)?t(...r):"number"==typeof r?r:e}function W(e,r,t,a,n){const s="string"==typeof r?r:r.axis,o=s+"Min",i=s+"Max",l=s+"MinMin",c=s+"MaxMax";for(let r=0;r<n;r++){const n=r+a,u=e[r];u[o]=t[n][o],u[i]=t[n][i],u[l]=B(u[s],u[o],Math.min),u[c]=B(u[s],u[i],Math.max)}}function A(e,r,t,a){const n=r.axis,s=r.getLabels();for(let o=0;o<a;o++){const a=o+t;e[o][n]=r.parse(s[a],a)}}function v(e,t,a,n=[],s=[]){r.registry.addControllers(a),Array.isArray(n)?r.registry.addElements(...n):r.registry.addElements(n),Array.isArray(s)?r.registry.addScales(...s):r.registry.addScales(s);const o=t;return o.type=e,o}class S extends r.BarController{getMinMax(e,r){return C(e,r,(e,r)=>super.getMinMax(e,r))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return W(n,e.vScale,r,t,a),A(n,e.iScale,t,a),n}updateElement(e,r,t,a){"number"==typeof r&&s(t,this.getParsed(r),r,this._cachedMeta.vScale,"reset"===a),super.updateElement(e,r,t,a)}}S.id="barWithErrorBars",S.defaults=t.merge({},[r.BarController.defaults,E,{tooltips:{callbacks:{label:g}},dataElementOptions:r.BarController.defaults.dataElementOptions.concat(i),dataElementType:p.id}]),S.defaultRoutes=r.BarController.defaultRoutes;class k extends r.Chart{constructor(e,t){super(e,v("barWithErrorBars",t,S,p,[r.LinearScale,r.CategoryScale]))}}k.id=S.id;class P extends r.LineController{getMinMax(e,r){return C(e,r,(e,r)=>super.getMinMax(e,r))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return W(n,e.vScale,r,t,a),A(n,e.iScale,t,a),n}updateElement(e,r,t,a){e instanceof y&&"number"==typeof r&&s(t,this.getParsed(r),r,this._cachedMeta.vScale,"reset"===a),super.updateElement(e,r,t,a)}}P.id="lineWithErrorBars",P.defaults=t.merge({},[r.LineController.defaults,E,{tooltips:{callbacks:{label:g}},dataElementType:y.id,dataElementOptions:Object.assign({},r.LineController.defaults.dataElementOptions,l)}]),P.defaultRoutes=r.LineController.defaultRoutes;class T extends r.Chart{constructor(e,t){super(e,v("lineWithErrorBars",t,P,y,[r.LinearScale,r.CategoryScale]))}}T.id=P.id;class R extends r.ScatterController{getMinMax(e,r){return C(e,r,(e,r)=>super.getMinMax(e,r))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return W(n,e.xScale,r,t,a),W(n,e.yScale,r,t,a),n}updateElement(e,r,t,a){e instanceof y&&"number"==typeof r&&(s(t,this.getParsed(r),r,this._cachedMeta.xScale,"reset"===a),s(t,this.getParsed(r),r,this._cachedMeta.yScale,"reset"===a)),super.updateElement(e,r,t,a)}}R.id="scatterWithErrorBars",R.defaults=t.merge({},[r.ScatterController.defaults,E,{tooltips:{callbacks:{label:function(e){const r=e.chart.data.datasets[e.datasetIndex].data[e.dataIndex],t=(e,t)=>{const a=n(t);return null==r||a.every(e=>null==r[e])?e:`${e} [${m(r[a[0]])} .. ${r[a[1]]}]`};return`(${t(e.label,!0)}, ${t(e.dataPoint.y,!1)})`}}},dataElementType:y.id,dataElementOptions:Object.assign({},r.LineController.defaults.dataElementOptions,l)}]),R.defaultRoutes=r.LineController.defaultRoutes;class O extends r.Chart{constructor(e,t){super(e,v("scatterWithErrorBars",t,R,y,[r.LinearScale]))}}O.id=R.id;class L extends r.PolarAreaController{getMinMax(e,r){return C(e,r,(e,r)=>super.getMinMax(e,r))}countVisibleElements(){const e=this._cachedMeta;return e.data.reduce((r,t,a)=>!Number.isNaN(e._parsed[a].r)&&this.chart.getDataVisibility(a)?r+1:r,0)}_computeAngle(e){const r=this._cachedMeta,a=r.count;if(Number.isNaN(r._parsed[e].r)||!this.chart.getDataVisibility(e))return 0;const n=this.getContext(e,!0);return t.resolve([this.chart.options.elements.arc.angle,2*Math.PI/a],n,e)}parseObjectData(e,r,t,a){const n=new Array(a),s=e.rScale;for(let e=0;e<a;++e){const a=e+t,o=r[a],i=s.parse(o[s.axis],a);n[e]={[s.axis]:i}}return W(n,e.rScale,r,t,a),n}updateElement(e,r,t,a){"number"==typeof r&&function(e,r,t,a,n){const s=n.animation,o=[t.axis+"Min",t.axis+"Max"],i=e=>{const r=t.getDistanceFromCenterForValue(e),n=s.animateScale?0:r;return a?n:r};for(const t of o){const a=r[t];Array.isArray(a)?e[t]=a.map(i):"number"==typeof a&&(e[t]=i(a))}}(t,this.getParsed(r),this._cachedMeta.rScale,"reset"===a,this.chart.options),super.updateElement(e,r,t,a)}updateElements(e,r,t,a){const n=this.chart.scales.r,s=n.getDistanceFromCenterForValue;n.getDistanceFromCenterForValue=function(e){return"number"==typeof e?s.call(this,e):s.call(this,e.r)},super.updateElements(e,r,t,a),n.getDistanceFromCenterForValue=s}}L.id="polarAreaWithErrorBars",L.defaults=t.merge({},[r.PolarAreaController.defaults,E,{tooltips:{callbacks:{label:function(e){const t=r.PolarAreaController.defaults.tooltips.callbacks.label.call(this,e),a=e.chart.data.datasets[e.datasetIndex].data[e.dataIndex],n=["rMin","rMax"];return null==a||n.every(e=>null==a[e])?t:`${t} [${m(a[n[0]])} .. ${a[n[1]]}]`}}},dataElementType:x.id,dataElementOptions:r.PolarAreaController.defaults.dataElementOptions.concat(i)}]),L.defaultRoutes=r.PolarAreaController.defaultRoutes;class j extends r.Chart{constructor(e,t){super(e,v("polarAreaWithErrorBars",t,L,x,[r.RadialLinearScale]))}}j.id=L.id,r.registry.addControllers(S,P,L,R),r.registry.addElements(p,x,P,y),e.ArcWithErrorBar=x,e.BarWithErrorBarsChart=k,e.BarWithErrorBarsController=S,e.LineWithErrorBarsChart=T,e.LineWithErrorBarsController=P,e.PointWithErrorBar=y,e.PolarAreaWithErrorBarsChart=j,e.PolarAreaWithErrorBarsController=L,e.RectangleWithErrorBar=p,e.ScatterWithErrorBarsChart=O,e.ScatterWithErrorBarsController=R,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("chart.js"),require("chart.js/helpers")):"function"==typeof define&&define.amd?define(["exports","chart.js","chart.js/helpers"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).ChartErrorBars={},e.Chart,e.Chart.helpers)}(this,(function(e,r,t){"use strict";const a=["xMin","xMax","yMin","yMax"];function n(e){return e?a.slice(0,2):a.slice(2)}function s(e,r,t,a,n){const s=[a.axis+"Min",a.axis+"Max"],o=a.getBasePixel();for(const l of s){const s=r[l];Array.isArray(s)?e[l]=s.map(e=>n?o:a.getPixelForValue(e,t)):"number"==typeof s&&(e[l]=n?o:a.getPixelForValue(s,t))}}const o={errorBarLineWidth:{v:[1,3]},errorBarColor:{v:["#2c2c2c","#1f1f1f"]},errorBarWhiskerLineWidth:{v:[1,3]},errorBarWhiskerRatio:{v:[.2,.25]},errorBarWhiskerSize:{v:[20,24]},errorBarWhiskerColor:{v:["#2c2c2c","#1f1f1f"]}},l=Object.keys(o),i={};function c(e,r){const t=Array.isArray(e)?e:[e],a=Array.isArray(r)?r:[r];if(t.length===a.length)return t.map((e,r)=>[e,a[r]]);const n=Math.max(t.length,a.length);return Array(n).map((e,r)=>[t[r%t.length],a[r%a.length]])}function u(e,r){if("string"==typeof e||"number"==typeof e)return e;const t=Array.isArray(e)?e:e.v;return t[r%t.length]}function d(e,r,t){const a=u(r.errorBarWhiskerRatio,t);if(null!=e&&a>0)return e*a*.5;return.5*u(r.errorBarWhiskerSize,t)}function h(e,r){const t=e.getProps(["x","y","width","height","xMin","xMax","yMin","yMax"]);null==t.xMin&&null==t.xMax||function(e,r,t,a,n){n.save(),n.translate(0,e.y),null==r&&(r=e.x),null==t&&(t=e.x);const s=c(r,t);s.reverse().forEach(([r,t],o)=>{const l=s.length-o-1,i=d(e.height,a,l);n.lineWidth=u(a.errorBarLineWidth,l),n.strokeStyle=u(a.errorBarColor,l),n.beginPath(),n.moveTo(r,0),n.lineTo(t,0),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,l),n.strokeStyle=u(a.errorBarWhiskerColor,l),n.beginPath(),n.moveTo(r,-i),n.lineTo(r,i),n.moveTo(t,-i),n.lineTo(t,i),n.stroke()}),n.restore()}(t,t.xMin,t.xMax,e.options,r),null==t.yMin&&null==t.yMax||function(e,r,t,a,n){n.save(),n.translate(e.x,0);const s=c(null==r?e.y:r,null==t?e.y:t);s.reverse().forEach(([r,t],o)=>{const l=s.length-o-1,i=d(e.width,a,l);n.lineWidth=u(a.errorBarLineWidth,l),n.strokeStyle=u(a.errorBarColor,l),n.beginPath(),n.moveTo(0,r),n.lineTo(0,t),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,l),n.strokeStyle=u(a.errorBarWhiskerColor,l),n.beginPath(),n.moveTo(-i,r),n.lineTo(i,r),n.moveTo(-i,t),n.lineTo(i,t),n.stroke()}),n.restore()}(t,t.yMin,t.yMax,e.options,r)}function f(e,r){const t=e.getProps(["x","y","startAngle","endAngle","rMin","rMax","outerRadius"]);null==t.rMin&&null==t.rMax||function(e,r,t,a,n){n.save(),n.translate(e.x,e.y),null==r&&(r=e.outerRadius),null==t&&(t=e.outerRadius);const s=(e.startAngle+e.endAngle)/2,o=Math.cos(s),l=Math.sin(s),i={x:-l,y:o},h=Math.sqrt(i.x*i.x+i.y*i.y);i.x/=h,i.y/=h;const f=c(r,t);f.reverse().forEach(([e,r],t)=>{const s=f.length-t-1,c=e*o,h=e*l,p=r*o,y=r*l,x=d(null,a,s),m=i.x*x,g=i.y*x;n.lineWidth=u(a.errorBarLineWidth,s),n.strokeStyle=u(a.errorBarColor,s),n.beginPath(),n.moveTo(c,h),n.lineTo(p,y),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,s),n.strokeStyle=u(a.errorBarWhiskerColor,s),n.beginPath(),n.moveTo(c+m,h+g),n.lineTo(c-m,h-g),n.moveTo(p+m,y+g),n.lineTo(p-m,y-g),n.stroke()}),n.restore()}(t,t.rMin,t.rMax,e.options,r)}l.forEach(e=>i[e]=e);class p extends r.BarElement{draw(e){super.draw(e),h(this,e)}}p.id="rectangleWithErrorBar",p.defaults=Object.assign({},r.BarElement.defaults,o),p.defaultRoutes=r.BarElement.defaultRoutes;class y extends r.PointElement{draw(e){super.draw(e),h(this,e)}}y.id="pointWithErrorBar",y.defaults=Object.assign({},r.PointElement.defaults,o),y.defaultRoutes=r.PointElement.defaultRoutes;class x extends r.ArcElement{draw(e){super.draw(e),f(this,e)}}function m(e){return Array.isArray(e)?e.slice().reverse():e}function g(e){const t=n(e.element.horizontal),a=r.Tooltip.defaults.callbacks.label.call(this,e),s=e.chart.data.datasets[e.datasetIndex].data[e.dataIndex];return null==s||t.every(e=>null==s[e])?a:`${a} (${m(s[t[0]])} .. ${s[t[1]]})`}x.id="arcWithErrorBar",x.defaults=Object.assign({},r.ArcElement.defaults,o),x.defaultRoutes=r.ArcElement.defaultRoutes;const M={color(e,r,a){const n=e||"transparent",s=r||"transparent";if(n===s)return r;const o=t.color(n),l=o.valid&&t.color(s);return l&&l.valid?l.mix(o,a).hexString():r},number:(e,r,t)=>e===r?r:e+(r-e)*t};function E(e,r,t,a,n){if(typeof e===a&&typeof r===a)return n(e,r,t);if(Array.isArray(e)&&Array.isArray(r))return e.map((e,a)=>n(e,r[a],t));const s=e=>e&&Array.isArray(e.v);return s(e)&&Array.isArray(e.v)&&s(r)?e.v.map((e,a)=>n(e,r.v[a],t)):r}const b={datasets:{animation:{numberArray:{fn:function(e,r,t){return E(e,r,t,"number",M.number)},properties:a.concat(l.filter(e=>!e.endsWith("Color")),["rMin","rMax"])},colorArray:{fn:function(e,r,t){return E(e,r,t,"string",M.color)},properties:a.concat(l.filter(e=>e.endsWith("Color")))}}}};function B(e,r,t){const a=e.axis;e.axis=a+"MinMin";const n=t(e,r).min;e.axis=a+"MaxMax";const s=t(e,r).max;return e.axis=a,{min:n,max:s}}function C(e,r,t){return Array.isArray(r)?t(...r):"number"==typeof r?r:e}function W(e,r,t,a,n){const s="string"==typeof r?r:r.axis,o=s+"Min",l=s+"Max",i=s+"MinMin",c=s+"MaxMax";for(let r=0;r<n;r++){const n=r+a,u=e[r];u[o]=t[n][o],u[l]=t[n][l],u[i]=C(u[s],u[o],Math.min),u[c]=C(u[s],u[l],Math.max)}}function A(e,r,t,a){const n=r.axis,s=r.getLabels();for(let o=0;o<a;o++){const a=o+t;e[o][n]=r.parse(s[a],a)}}function v(e,t,a,n=[],s=[]){r.registry.addControllers(a),Array.isArray(n)?r.registry.addElements(...n):r.registry.addElements(n),Array.isArray(s)?r.registry.addScales(...s):r.registry.addScales(s);const o=t;return o.type=e,o}class S extends r.BarController{getMinMax(e,r){return B(e,r,(e,r)=>super.getMinMax(e,r))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return W(n,e.vScale,r,t,a),A(n,e.iScale,t,a),n}updateElement(e,r,t,a){"number"==typeof r&&s(t,this.getParsed(r),r,this._cachedMeta.vScale,"reset"===a),super.updateElement(e,r,t,a)}}S.id="barWithErrorBars",S.defaults=t.merge({},[r.BarController.defaults,b,{tooltips:{callbacks:{label:g}},dataElementOptions:r.BarController.defaults.dataElementOptions.concat(l),dataElementType:p.id}]),S.defaultRoutes=r.BarController.defaultRoutes;class k extends r.Chart{constructor(e,t){super(e,v("barWithErrorBars",t,S,p,[r.LinearScale,r.CategoryScale]))}}k.id=S.id;class P extends r.LineController{getMinMax(e,r){return B(e,r,(e,r)=>super.getMinMax(e,r))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return W(n,e.vScale,r,t,a),A(n,e.iScale,t,a),n}updateElement(e,r,t,a){e instanceof y&&"number"==typeof r&&s(t,this.getParsed(r),r,this._cachedMeta.vScale,"reset"===a),super.updateElement(e,r,t,a)}}P.id="lineWithErrorBars",P.defaults=t.merge({},[r.LineController.defaults,b,{tooltips:{callbacks:{label:g}},dataElementType:y.id,dataElementOptions:Object.assign({},r.LineController.defaults.dataElementOptions,i)}]),P.defaultRoutes=r.LineController.defaultRoutes;class T extends r.Chart{constructor(e,t){super(e,v("lineWithErrorBars",t,P,y,[r.LinearScale,r.CategoryScale]))}}T.id=P.id;class O extends r.ScatterController{getMinMax(e,r){return B(e,r,(e,r)=>super.getMinMax(e,r))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return W(n,e.xScale,r,t,a),W(n,e.yScale,r,t,a),n}updateElement(e,r,t,a){e instanceof y&&"number"==typeof r&&(s(t,this.getParsed(r),r,this._cachedMeta.xScale,"reset"===a),s(t,this.getParsed(r),r,this._cachedMeta.yScale,"reset"===a)),super.updateElement(e,r,t,a)}}O.id="scatterWithErrorBars",O.defaults=t.merge({},[r.ScatterController.defaults,b,{tooltips:{callbacks:{label:function(e){const r=e.chart.data.datasets[e.datasetIndex].data[e.dataIndex],t=(e,t)=>{const a=n(t);return null==r||a.every(e=>null==r[e])?e:`${e} [${m(r[a[0]])} .. ${r[a[1]]}]`};return`(${t(e.label,!0)}, ${t(e.dataPoint.y,!1)})`}}},dataElementType:y.id,dataElementOptions:Object.assign({},r.LineController.defaults.dataElementOptions,i)}]),O.defaultRoutes=r.LineController.defaultRoutes;class L extends r.Chart{constructor(e,t){super(e,v("scatterWithErrorBars",t,O,y,[r.LinearScale]))}}L.id=O.id;class R extends r.PolarAreaController{getMinMax(e,r){return B(e,r,(e,r)=>super.getMinMax(e,r))}countVisibleElements(){const e=this._cachedMeta;return e.data.reduce((r,t,a)=>!Number.isNaN(e._parsed[a].r)&&this.chart.getDataVisibility(a)?r+1:r,0)}_computeAngle(e){const r=this._cachedMeta,a=r.count;if(Number.isNaN(r._parsed[e].r)||!this.chart.getDataVisibility(e))return 0;const n=this.getContext(e,!0);return t.resolve([this.chart.options.elements.arc.angle,2*Math.PI/a],n,e)}parseObjectData(e,r,t,a){const n=new Array(a),s=e.rScale;for(let e=0;e<a;++e){const a=e+t,o=r[a],l=s.parse(o[s.axis],a);n[e]={[s.axis]:l}}return W(n,e.rScale,r,t,a),n}updateElement(e,r,t,a){"number"==typeof r&&function(e,r,t,a,n){const s=n.animation,o=[t.axis+"Min",t.axis+"Max"],l=e=>{const r=t.getDistanceFromCenterForValue(e),n=s.animateScale?0:r;return a?n:r};for(const t of o){const a=r[t];Array.isArray(a)?e[t]=a.map(l):"number"==typeof a&&(e[t]=l(a))}}(t,this.getParsed(r),this._cachedMeta.rScale,"reset"===a,this.chart.options),super.updateElement(e,r,t,a)}updateElements(e,r,t,a){const n=this.chart.scales.r,s=n.getDistanceFromCenterForValue;n.getDistanceFromCenterForValue=function(e){return"number"==typeof e?s.call(this,e):s.call(this,e.r)},super.updateElements(e,r,t,a),n.getDistanceFromCenterForValue=s}}R.id="polarAreaWithErrorBars",R.defaults=t.merge({},[r.PolarAreaController.defaults,b,{tooltips:{callbacks:{label:function(e){const t=r.PolarAreaController.defaults.tooltips.callbacks.label.call(this,e),a=e.chart.data.datasets[e.datasetIndex].data[e.dataIndex],n=["rMin","rMax"];return null==a||n.every(e=>null==a[e])?t:`${t} [${m(a[n[0]])} .. ${a[n[1]]}]`}}},dataElementType:x.id,dataElementOptions:r.PolarAreaController.defaults.dataElementOptions.concat(l)}]),R.defaultRoutes=r.PolarAreaController.defaultRoutes;class j extends r.Chart{constructor(e,t){super(e,v("polarAreaWithErrorBars",t,R,x,[r.RadialLinearScale]))}}j.id=R.id,r.registry.addControllers(S,P,R,O),r.registry.addElements(p,x,P,y),e.ArcWithErrorBar=x,e.BarWithErrorBar=p,e.BarWithErrorBarsChart=k,e.BarWithErrorBarsController=S,e.LineWithErrorBarsChart=T,e.LineWithErrorBarsController=P,e.PointWithErrorBar=y,e.PolarAreaWithErrorBarsChart=j,e.PolarAreaWithErrorBarsController=R,e.ScatterWithErrorBarsChart=L,e.ScatterWithErrorBarsController=O,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "chartjs-chart-error-bars",
"description": "Chart.js module for charting error bars",
"version": "3.0.0-beta.4",
"version": "3.0.0-beta.5",
"author": {

@@ -43,36 +43,36 @@ "name": "Samuel Gratzl",

"devDependencies": {
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.3.3",
"@rollup/plugin-typescript": "^6.0.0",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-replace": "^2.3.4",
"@rollup/plugin-typescript": "^6.1.0",
"@types/jest": "^26.0.15",
"@types/jest-image-snapshot": "^4.1.2",
"@types/node": "^14.14.0",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"@types/jest-image-snapshot": "^4.1.3",
"@types/node": "^14.14.7",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"@yarnpkg/pnpify": "^2.3.3",
"canvas": "^2.6.1",
"chart.js": "^3.0.0-beta.4",
"eslint": "^7.11.0",
"eslint-config-prettier": "^6.13.0",
"eslint-config-react-app": "^5.2.1",
"chart.js": "^3.0.0-beta.6",
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.0",
"jest": "^26.6.3",
"jest-image-snapshot": "^4.2.0",
"prettier": "^2.1.2",
"release-it": "^14.2.0",
"release-it": "^14.2.1",
"rimraf": "^3.0.2",
"rollup": "^2.32.1",
"rollup": "^2.33.1",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-dts": "^1.4.13",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "^26.4.1",
"ts-jest": "^26.4.4",
"tslib": "^2.0.3",
"typedoc": "^0.19.2",
"typescript": "^4.0.3"
"typescript": "^4.0.5"
},

@@ -79,0 +79,0 @@ "scripts": {

/// <reference types="jest" />
/// <reference types="node" />
import { Chart, IChartConfiguration, defaults, IChartType, DefaultDataPoint } from 'chart.js';
import { Chart, ChartConfiguration, defaults, ChartType, DefaultDataPoint } from 'chart.js';
import { toMatchImageSnapshot, MatchImageSnapshotOptions } from 'jest-image-snapshot';

@@ -25,6 +25,6 @@

export default function createChart<
TYPE extends IChartType,
TYPE extends ChartType,
DATA extends unknown[] = DefaultDataPoint<TYPE>,
LABEL = string
>(config: IChartConfiguration<TYPE, DATA, LABEL>, width = 300, height = 300) {
>(config: ChartConfiguration<TYPE, DATA, LABEL>, width = 300, height = 300) {
const canvas = document.createElement('canvas');

@@ -31,0 +31,0 @@ canvas.width = width;

import createChart from '../__tests__/createChart';
import { registry, LinearScale, CategoryScale } from 'chart.js';
import { BarWithErrorBarsController } from './BarWithErrorBarsController';
import { RectangleWithErrorBar } from '../elements';
import { BarWithErrorBar } from '../elements';

@@ -9,3 +9,3 @@ describe('bar', () => {

registry.addControllers(BarWithErrorBarsController);
registry.addElements(RectangleWithErrorBar);
registry.addElements(BarWithErrorBar);
registry.addScales(LinearScale, CategoryScale);

@@ -12,0 +12,0 @@ });

@@ -7,11 +7,11 @@ import {

Scale,
IChartMeta,
Rectangle,
ChartMeta,
BarElement,
UpdateMode,
ScriptableAndArrayOptions,
IChartConfiguration,
ChartConfiguration,
ChartItem,
IBarControllerDatasetOptions,
ICartesianScaleTypeRegistry,
IBarControllerChartOptions,
BarControllerDatasetOptions,
CartesianScaleTypeRegistry,
BarControllerChartOptions,
} from 'chart.js';

@@ -21,3 +21,3 @@ import { merge } from 'chart.js/helpers';

import { styleKeys, IErrorBarOptions } from '../elements/render';
import { RectangleWithErrorBar } from '../elements';
import { BarWithErrorBar } from '../elements';
import { generateBarTooltip } from './tooltip';

@@ -33,3 +33,3 @@ import { animationHints } from '../animate';

parseObjectData(meta: IChartMeta, data: any[], start: number, count: number) {
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number) {
const parsed = super.parseObjectData(meta, data, start, count);

@@ -41,3 +41,3 @@ parseErrorNumberData(parsed, meta.vScale!, data, start, count);

updateElement(element: Rectangle, index: number | undefined, properties: any, mode: UpdateMode) {
updateElement(element: BarElement, index: number | undefined, properties: any, mode: UpdateMode) {
// inject the other error bar related properties

@@ -67,3 +67,3 @@ if (typeof index === 'number') {

dataElementOptions: BarController.defaults.dataElementOptions.concat(styleKeys),
dataElementType: RectangleWithErrorBar.id,
dataElementType: BarWithErrorBar.id,
},

@@ -74,17 +74,13 @@ ]);

export interface IBarWithErrorBarsControllerDatasetOptions
extends IBarControllerDatasetOptions,
export interface BarWithErrorBarsControllerDatasetOptions
extends BarControllerDatasetOptions,
ScriptableAndArrayOptions<IErrorBarOptions> {}
declare module 'chart.js' {
export enum ChartTypeEnum {
barWithErrorBars = 'barWithErrorBars',
}
export interface IChartTypeRegistry {
export interface ChartTypeRegistry {
barWithErrorBars: {
chartOptions: IBarControllerChartOptions;
datasetOptions: IBarWithErrorBarsControllerDatasetOptions;
chartOptions: BarControllerChartOptions;
datasetOptions: BarWithErrorBarsControllerDatasetOptions;
defaultDataPoint: IErrorBarXDataPoint[];
scales: keyof ICartesianScaleTypeRegistry;
scales: keyof CartesianScaleTypeRegistry;
};

@@ -101,6 +97,6 @@ }

constructor(item: ChartItem, config: Omit<IChartConfiguration<'barWithErrorBars', DATA, LABEL>, 'type'>) {
constructor(item: ChartItem, config: Omit<ChartConfiguration<'barWithErrorBars', DATA, LABEL>, 'type'>) {
super(
item,
patchController('barWithErrorBars', config, BarWithErrorBarsController, RectangleWithErrorBar, [
patchController('barWithErrorBars', config, BarWithErrorBarsController, BarWithErrorBar, [
LinearScale,

@@ -107,0 +103,0 @@ CategoryScale,

@@ -7,11 +7,11 @@ import {

ChartItem,
Point,
PointElement,
Scale,
IChartConfiguration,
IChartMeta,
ILineControllerDatasetOptions,
ChartConfiguration,
ChartMeta,
LineControllerDatasetOptions,
ScriptableAndArrayOptions,
UpdateMode,
ICartesianScaleTypeRegistry,
ILineControllerChartOptions,
CartesianScaleTypeRegistry,
LineControllerChartOptions,
} from 'chart.js';

@@ -32,3 +32,3 @@ import { merge } from 'chart.js/helpers';

parseObjectData(meta: IChartMeta, data: any[], start: number, count: number) {
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number) {
const parsed = super.parseObjectData(meta, data, start, count);

@@ -40,3 +40,3 @@ parseErrorNumberData(parsed, meta.vScale!, data, start, count);

updateElement(element: Point, index: number | undefined, properties: any, mode: UpdateMode) {
updateElement(element: PointElement, index: number | undefined, properties: any, mode: UpdateMode) {
// inject the other error bar related properties

@@ -73,17 +73,13 @@ if (element instanceof PointWithErrorBar && typeof index === 'number') {

export interface ILineWithErrorBarsControllerDatasetOptions
extends ILineControllerDatasetOptions,
export interface LineWithErrorBarsControllerDatasetOptions
extends LineControllerDatasetOptions,
ScriptableAndArrayOptions<IErrorBarOptions> {}
declare module 'chart.js' {
export enum ChartTypeEnum {
lineWithErrorBars = 'lineWithErrorBars',
}
export interface IChartTypeRegistry {
export interface ChartTypeRegistry {
lineWithErrorBars: {
chartOptions: ILineControllerChartOptions;
datasetOptions: ILineWithErrorBarsControllerDatasetOptions;
chartOptions: LineControllerChartOptions;
datasetOptions: LineWithErrorBarsControllerDatasetOptions;
defaultDataPoint: IErrorBarXDataPoint[];
scales: keyof ICartesianScaleTypeRegistry;
scales: keyof CartesianScaleTypeRegistry;
};

@@ -100,3 +96,3 @@ }

constructor(item: ChartItem, config: Omit<IChartConfiguration<'lineWithErrorBars', DATA, LABEL>, 'type'>) {
constructor(item: ChartItem, config: Omit<ChartConfiguration<'lineWithErrorBars', DATA, LABEL>, 'type'>) {
super(

@@ -103,0 +99,0 @@ item,

@@ -1,2 +0,2 @@

import { registry, IDatasetControllerChartComponent, IChartComponent } from 'chart.js';
import { registry, DatasetControllerChartComponent, ChartComponent } from 'chart.js';

@@ -6,5 +6,5 @@ export default function patchController<T, TYPE>(

config: T,
controller: IDatasetControllerChartComponent,
elements: IChartComponent | IChartComponent[] = [],
scales: IChartComponent | IChartComponent[] = []
controller: DatasetControllerChartComponent,
elements: ChartComponent | ChartComponent[] = [],
scales: ChartComponent | ChartComponent[] = []
): T & { type: TYPE } {

@@ -11,0 +11,0 @@ registry.addControllers(controller);

@@ -8,9 +8,9 @@ import {

Element,
IChartMeta,
ChartMeta,
ChartItem,
IChartConfiguration,
IPolarAreaControllerDatasetOptions,
ChartConfiguration,
PolarAreaControllerDatasetOptions,
ScriptableAndArrayOptions,
IPolarAreaControllerChartOptions,
ICartesianScaleTypeRegistry,
PolarAreaControllerChartOptions,
CartesianScaleTypeRegistry,
} from 'chart.js';

@@ -53,3 +53,3 @@ import { merge, resolve } from 'chart.js/helpers';

parseObjectData(meta: IChartMeta, data: any[], start: number, count: number) {
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number) {
const parsed = new Array(count);

@@ -112,17 +112,13 @@ const scale = meta.rScale!;

export interface IPolarAreaWithErrorBarsControllerDatasetOptions
extends IPolarAreaControllerDatasetOptions,
export interface PolarAreaWithErrorBarsControllerDatasetOptions
extends PolarAreaControllerDatasetOptions,
ScriptableAndArrayOptions<IErrorBarOptions> {}
declare module 'chart.js' {
export enum ChartTypeEnum {
polarAreaWithErrorBars = 'polarAreaWithErrorBars',
}
export interface IChartTypeRegistry {
export interface ChartTypeRegistry {
polarAreaWithErrorBars: {
chartOptions: IPolarAreaControllerChartOptions;
datasetOptions: IPolarAreaWithErrorBarsControllerDatasetOptions;
chartOptions: PolarAreaControllerChartOptions;
datasetOptions: PolarAreaWithErrorBarsControllerDatasetOptions;
defaultDataPoint: IErrorBarRDataPoint[];
scales: keyof ICartesianScaleTypeRegistry;
scales: keyof CartesianScaleTypeRegistry;
};

@@ -139,3 +135,3 @@ }

constructor(item: ChartItem, config: Omit<IChartConfiguration<'polarAreaWithErrorBars', DATA, LABEL>, 'type'>) {
constructor(item: ChartItem, config: Omit<ChartConfiguration<'polarAreaWithErrorBars', DATA, LABEL>, 'type'>) {
super(

@@ -142,0 +138,0 @@ item,

@@ -6,6 +6,6 @@ import {

ChartItem,
IChartConfiguration,
IChartMeta,
IScatterControllerDatasetOptions,
Point,
ChartConfiguration,
ChartMeta,
ScatterControllerDatasetOptions,
PointElement,
Scale,

@@ -15,4 +15,4 @@ ScriptableAndArrayOptions,

LineController,
IScatterControllerChartOptions,
ICartesianScaleTypeRegistry,
ScatterControllerChartOptions,
CartesianScaleTypeRegistry,
} from 'chart.js';

@@ -33,3 +33,3 @@ import { merge } from 'chart.js/helpers';

parseObjectData(meta: IChartMeta, data: any[], start: number, count: number) {
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number) {
const parsed = super.parseObjectData(meta, data, start, count);

@@ -41,3 +41,3 @@ parseErrorNumberData(parsed, meta.xScale!, data, start, count);

updateElement(element: Point, index: number | undefined, properties: any, mode: UpdateMode) {
updateElement(element: PointElement, index: number | undefined, properties: any, mode: UpdateMode) {
// inject the other error bar related properties

@@ -81,17 +81,13 @@ if (element instanceof PointWithErrorBar && typeof index === 'number') {

export interface IScatterWithErrorBarsControllerDatasetOptions
extends IScatterControllerDatasetOptions,
export interface ScatterWithErrorBarsControllerDatasetOptions
extends ScatterControllerDatasetOptions,
ScriptableAndArrayOptions<IErrorBarOptions> {}
declare module 'chart.js' {
export enum ChartTypeEnum {
scatterWithErrorBars = 'scatterWithErrorBars',
}
export interface IChartTypeRegistry {
export interface ChartTypeRegistry {
scatterWithErrorBars: {
chartOptions: IScatterControllerChartOptions;
datasetOptions: IScatterWithErrorBarsControllerDatasetOptions;
chartOptions: ScatterControllerChartOptions;
datasetOptions: ScatterWithErrorBarsControllerDatasetOptions;
defaultDataPoint: IErrorBarXYDataPoint[];
scales: keyof ICartesianScaleTypeRegistry;
scales: keyof CartesianScaleTypeRegistry;
};

@@ -108,3 +104,3 @@ }

constructor(item: ChartItem, config: Omit<IChartConfiguration<'scatterWithErrorBars', DATA, LABEL>, 'type'>) {
constructor(item: ChartItem, config: Omit<ChartConfiguration<'scatterWithErrorBars', DATA, LABEL>, 'type'>) {
super(

@@ -111,0 +107,0 @@ item,

import { modelKeys } from './utils';
import { Tooltip, PolarAreaController, ITooltipItem, TooltipModel } from 'chart.js';
import { Tooltip, PolarAreaController, TooltipItem, TooltipModel } from 'chart.js';
import { IErrorBarRDataPoint, IErrorBarXYDataPoint } from './base';

@@ -9,3 +9,3 @@

export function generateBarTooltip(this: TooltipModel, item: ITooltipItem) {
export function generateBarTooltip(this: TooltipModel, item: TooltipItem) {
const keys = modelKeys((item.element as any).horizontal);

@@ -20,3 +20,3 @@ const base = (Tooltip as any).defaults.callbacks.label.call(this, item);

export function generateTooltipScatter(item: ITooltipItem) {
export function generateTooltipScatter(item: TooltipItem) {
const v = (item.chart.data.datasets[item.datasetIndex].data[item.dataIndex] as unknown) as IErrorBarXYDataPoint;

@@ -35,3 +35,3 @@

export function generateTooltipPolar(this: TooltipModel, item: ITooltipItem) {
export function generateTooltipPolar(this: TooltipModel, item: TooltipItem) {
const base = PolarAreaController.defaults.tooltips.callbacks.label.call(this, item);

@@ -38,0 +38,0 @@ const v = (item.chart.data.datasets[item.datasetIndex].data[item.dataIndex] as unknown) as IErrorBarRDataPoint;

@@ -1,5 +0,5 @@

import { Arc } from 'chart.js';
import { ArcElement } from 'chart.js';
import { renderErrorBarArc, errorBarDefaults } from './render';
export class ArcWithErrorBar extends Arc {
export class ArcWithErrorBar extends ArcElement {
draw(ctx: CanvasRenderingContext2D) {

@@ -12,4 +12,4 @@ super.draw(ctx);

static readonly id = 'arcWithErrorBar';
static readonly defaults: any = /*#__PURE__*/ Object.assign({}, Arc.defaults, errorBarDefaults);
static readonly defaultRoutes = Arc.defaultRoutes;
static readonly defaults: any = /*#__PURE__*/ Object.assign({}, ArcElement.defaults, errorBarDefaults);
static readonly defaultRoutes = ArcElement.defaultRoutes;
}

@@ -1,3 +0,3 @@

export * from './RectangleWithErrorBar';
export * from './BarWithErrorBar';
export * from './PointWithErrorBar';
export * from './ArcWithErrorBar';

@@ -1,5 +0,5 @@

import { Point } from 'chart.js';
import { PointElement } from 'chart.js';
import { renderErrorBar, errorBarDefaults } from './render';
export class PointWithErrorBar extends Point {
export class PointWithErrorBar extends PointElement {
draw(ctx: CanvasRenderingContext2D) {

@@ -12,4 +12,4 @@ super.draw(ctx);

static readonly id = 'pointWithErrorBar';
static readonly defaults: any = /*#__PURE__*/ Object.assign({}, Point.defaults, errorBarDefaults);
static readonly defaultRoutes = Point.defaultRoutes;
static readonly defaults: any = /*#__PURE__*/ Object.assign({}, PointElement.defaults, errorBarDefaults);
static readonly defaultRoutes = PointElement.defaultRoutes;
}

@@ -1,2 +0,2 @@

import { Element, IArcProps } from 'chart.js';
import { Element, ArcProps } from 'chart.js';

@@ -195,3 +195,3 @@ export const errorBarDefaults = {

function drawErrorBarArc(
props: IArcProps,
props: ArcProps,
vMin: null | number | number[],

@@ -198,0 +198,0 @@ vMax: null | number | number[],

@@ -8,3 +8,3 @@ import {

import { registry } from 'chart.js';
import { RectangleWithErrorBar, ArcWithErrorBar, PointWithErrorBar } from './elements';
import { BarWithErrorBar, ArcWithErrorBar, PointWithErrorBar } from './elements';

@@ -19,2 +19,2 @@ export * from '.';

);
registry.addElements(RectangleWithErrorBar, ArcWithErrorBar, LineWithErrorBarsController, PointWithErrorBar);
registry.addElements(BarWithErrorBar, ArcWithErrorBar, LineWithErrorBarsController, PointWithErrorBar);

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc