Huge News!Announcing our $40M Series B led by Abstract Ventures.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.3 to 3.0.0-beta.4

2

build/index.esm.js

@@ -518,3 +518,3 @@ /**

}
const context = this._getContext(index, true);
const context = this.getContext(index, true);
return resolve([this.chart.options.elements.arc.angle, (2 * Math.PI) / count], context, index);

@@ -521,0 +521,0 @@ }

@@ -522,3 +522,3 @@ /**

}
const context = this._getContext(index, true);
const context = this.getContext(index, true);
return helpers.resolve([this.chart.options.elements.arc.angle, (2 * Math.PI) / count], context, index);

@@ -525,0 +525,0 @@ }

@@ -521,3 +521,3 @@ /**

}
const context = this._getContext(index, true);
const context = this.getContext(index, true);
return helpers.resolve([this.chart.options.elements.arc.angle, (2 * Math.PI) / count], context, index);

@@ -524,0 +524,0 @@ }

@@ -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 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})}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "chartjs-chart-error-bars",
"description": "Chart.js module for charting error bars",
"version": "3.0.0-beta.3",
"version": "3.0.0-beta.4",
"author": {

@@ -47,12 +47,12 @@ "name": "Samuel Gratzl",

"@rollup/plugin-typescript": "^6.0.0",
"@types/jest": "^26.0.14",
"@types/jest-image-snapshot": "^4.1.0",
"@types/node": "^14.11.2",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"@yarnpkg/pnpify": "^2.2.1",
"@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",
"@yarnpkg/pnpify": "^2.3.3",
"canvas": "^2.6.1",
"chart.js": "^3.0.0-beta.3",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"chart.js": "^3.0.0-beta.4",
"eslint": "^7.11.0",
"eslint-config-prettier": "^6.13.0",
"eslint-config-react-app": "^5.2.1",

@@ -63,10 +63,10 @@ "eslint-plugin-flowtype": "^5.2.0",

"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.21.2",
"eslint-plugin-react-hooks": "^4.1.2",
"jest": "^26.4.2",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.0",
"jest-image-snapshot": "^4.2.0",
"prettier": "^2.1.2",
"release-it": "^14.0.3",
"release-it": "^14.2.0",
"rimraf": "^3.0.2",
"rollup": "^2.28.2",
"rollup": "^2.32.1",
"rollup-plugin-cleanup": "^3.2.1",

@@ -76,3 +76,3 @@ "rollup-plugin-dts": "^1.4.13",

"ts-jest": "^26.4.1",
"tslib": "^2.0.1",
"tslib": "^2.0.3",
"typedoc": "^0.19.2",

@@ -79,0 +79,0 @@ "typescript": "^4.0.3"

@@ -48,3 +48,3 @@ import {

}
const context = (this as any)._getContext(index, true);
const context = (this as any).getContext(index, true);
return resolve([(this.chart.options as any).elements.arc.angle, (2 * Math.PI) / count], context, index);

@@ -51,0 +51,0 @@ }

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