chartjs-chart-error-bars
Advanced tools
Comparing version 3.7.0 to 3.7.1
@@ -589,3 +589,3 @@ /** | ||
chart_js.registry.addControllers(BarWithErrorBarsController, LineWithErrorBarsController, PolarAreaWithErrorBarsController, ScatterWithErrorBarsController); | ||
chart_js.registry.addElements(BarWithErrorBar, ArcWithErrorBar, LineWithErrorBarsController, PointWithErrorBar); | ||
chart_js.registry.addElements(BarWithErrorBar, ArcWithErrorBar, PointWithErrorBar); | ||
@@ -592,0 +592,0 @@ exports.ArcWithErrorBar = ArcWithErrorBar; |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("chart.js"),require("chart.js/helpers")):"function"==typeof define&&define.amd?define(["exports","chart.js","chart.js/helpers"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).ChartErrorBars={},r.Chart,r.Chart.helpers)}(this,(function(r,e,t){"use strict";const a=["xMin","xMax","yMin","yMax"];function n(r){return r?a.slice(0,2):a.slice(2)}function o(r,e,t,a,n){const o=[`${a.axis}Min`,`${a.axis}Max`],s=a.getBasePixel();for(const l of o){const o=e[l];Array.isArray(o)?r[l]=o.map((r=>n?s:a.getPixelForValue(r,t))):"number"==typeof o&&(r[l]=n?s:a.getPixelForValue(o,t))}}const s={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={_scriptable:!0,_indexable:r=>"v"!==r},i=Object.keys(s);function c(r,e){const t=Array.isArray(r)?r:[r],a=Array.isArray(e)?e:[e];if(t.length===a.length)return t.map(((r,e)=>[r,a[e]]));const n=Math.max(t.length,a.length);return Array(n).map(((r,e)=>[t[e%t.length],a[e%a.length]]))}function u(r,e){if("string"==typeof r||"number"==typeof r)return r;const t=Array.isArray(r)?r:r.v;return t[e%t.length]}function d(r,e,t){const a=u(e.errorBarWhiskerRatio,t);if(null!=r&&a>0)return r*a*.5;return.5*u(e.errorBarWhiskerSize,t)}function h(r,e){var t,a,n,o;const s=r.getProps(["x","y","width","height","xMin","xMax","yMin","yMax"]);null==s.xMin&&null==s.xMax||function(r,e,t,a,n){n.save(),n.translate(0,r.y);const o=c(null==e?r.x:e,null==t?r.x:t);o.reverse().forEach((([e,t],s)=>{const l=o.length-s-1,i=d(r.height,a,l);n.lineWidth=u(a.errorBarLineWidth,l),n.strokeStyle=u(a.errorBarColor,l),n.beginPath(),n.moveTo(e,0),n.lineTo(t,0),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,l),n.strokeStyle=u(a.errorBarWhiskerColor,l),n.beginPath(),n.moveTo(e,-i),n.lineTo(e,i),n.moveTo(t,-i),n.lineTo(t,i),n.stroke()})),n.restore()}(s,null!==(t=s.xMin)&&void 0!==t?t:null,null!==(a=s.xMax)&&void 0!==a?a:null,r.options,e),null==s.yMin&&null==s.yMax||function(r,e,t,a,n){n.save(),n.translate(r.x,0);const o=c(null==e?r.y:e,null==t?r.y:t);o.reverse().forEach((([e,t],s)=>{const l=o.length-s-1,i=d(r.width,a,l);n.lineWidth=u(a.errorBarLineWidth,l),n.strokeStyle=u(a.errorBarColor,l),n.beginPath(),n.moveTo(0,e),n.lineTo(0,t),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,l),n.strokeStyle=u(a.errorBarWhiskerColor,l),n.beginPath(),n.moveTo(-i,e),n.lineTo(i,e),n.moveTo(-i,t),n.lineTo(i,t),n.stroke()})),n.restore()}(s,null!==(n=s.yMin)&&void 0!==n?n:null,null!==(o=s.yMax)&&void 0!==o?o:null,r.options,e)}function f(r,e){const t=r.getProps(["x","y","startAngle","endAngle","rMin","rMax","outerRadius"]);null==t.rMin&&null==t.rMax||function(r,e,t,a,n){n.save(),n.translate(r.x,r.y);const o=(r.startAngle+r.endAngle)/2,s=Math.cos(o),l=Math.sin(o),i={x:-l,y:s},h=Math.sqrt(i.x*i.x+i.y*i.y);i.x/=h,i.y/=h;const f=c(null!=e?e:r.outerRadius,null!=t?t:r.outerRadius);f.reverse().forEach((([r,e],t)=>{const o=f.length-t-1,c=r*s,h=r*l,p=e*s,y=e*l,x=d(null,a,o),m=i.x*x,g=i.y*x;n.lineWidth=u(a.errorBarLineWidth,o),n.strokeStyle=u(a.errorBarColor,o),n.beginPath(),n.moveTo(c,h),n.lineTo(p,y),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,o),n.strokeStyle=u(a.errorBarWhiskerColor,o),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,r.options,e)}class p extends e.BarElement{draw(r){super.draw(r),h(this,r)}}p.id="barWithErrorBar",p.defaults={...e.BarElement.defaults,...s},p.defaultRoutes=e.BarElement.defaultRoutes,p.descriptors=l;class y extends e.PointElement{draw(r,e){super.draw.call(this,r,e),h(this,r)}}y.id="pointWithErrorBar",y.defaults={...e.PointElement.defaults,...s},y.defaultRoutes=e.PointElement.defaultRoutes,y.descriptors=l;class x extends e.ArcElement{draw(r){super.draw(r),f(this,r)}}function m(r){return Array.isArray(r)?r.slice().reverse():r}function g(r){const t=n(r.element.horizontal),a=e.Tooltip.defaults.callbacks.label.call(this,r),o=r.chart.data.datasets[r.datasetIndex].data[r.dataIndex];return null==o||t.every((r=>null==o[r]))?a:`${a} (${m(o[t[0]])} .. ${o[t[1]]})`}x.id="arcWithErrorBar",x.defaults={...e.ArcElement.defaults,...s},x.defaultRoutes=e.ArcElement.defaultRoutes,x.descriptors=l;const M={color(r,e,a){const n=r||"transparent",o=e||"transparent";if(n===o)return e;const s=t.color(n),l=s.valid&&t.color(o);return l&&l.valid?l.mix(s,a).hexString():e},number:(r,e,t)=>r===e?e:r+(e-r)*t};function B(r,e,t,a,n){if(typeof r===a&&typeof e===a)return n(r,e,t);if(Array.isArray(r)&&Array.isArray(e))return r.map(((r,a)=>n(r,e[a],t)));const o=r=>r&&Array.isArray(r.v);return o(r)&&o(e)?{v:r.v.map(((r,a)=>n(r,e.v[a],t)))}:e}const b={animations:{numberArray:{fn:function(r,e,t){return B(r,e,t,"number",M.number)},properties:a.concat(i.filter((r=>!r.endsWith("Color"))),["rMin","rMax"])},colorArray:{fn:function(r,e,t){return B(r,e,t,"string",M.color)},properties:i.filter((r=>r.endsWith("Color")))}}};function E(r,e){const{axis:t}=r;r.axis=`${t}MinMin`;const{min:a}=e(r);r.axis=`${t}MaxMax`;const{max:n}=e(r);return r.axis=t,{min:a,max:n}}function v(r,e,t){return Array.isArray(e)?t(...e):"number"==typeof e?e:r}function C(r,e,t,a,n){const o="string"==typeof e?e:e.axis,s=`${o}Min`,l=`${o}Max`,i=`${o}MinMin`,c=`${o}MaxMax`;for(let e=0;e<n;e+=1){const n=e+a,u=r[e];u[s]=t[n][s],u[l]=t[n][l],u[i]=v(u[o],u[s],Math.min),u[c]=v(u[o],u[l],Math.max)}}function W(r,e,t,a){const{axis:n}=e,o=e.getLabels();for(let s=0;s<a;s+=1){const a=s+t;r[s][n]=e.parse(o[a],a)}}function A(r,t,a,n=[],o=[]){e.registry.addControllers(a),Array.isArray(n)?e.registry.addElements(...n):e.registry.addElements(n),Array.isArray(o)?e.registry.addScales(...o):e.registry.addScales(o);const s=t;return s.type=r,s}class S extends e.BarController{getMinMax(r,e){return E(r,(r=>super.getMinMax(r,e)))}parseObjectData(r,e,t,a){const n=super.parseObjectData(r,e,t,a);return C(n,r.vScale,e,t,a),W(n,r.iScale,t,a),n}updateElement(r,e,t,a){"number"==typeof e&&o(t,this.getParsed(e),e,this._cachedMeta.vScale,"reset"===a),super.updateElement(r,e,t,a)}}S.id="barWithErrorBars",S.defaults=t.merge({},[e.BarController.defaults,b,{dataElementType:p.id}]),S.overrides=t.merge({},[e.BarController.overrides,{plugins:{tooltip:{callbacks:{label:g}}}}]),S.defaultRoutes=e.BarController.defaultRoutes;class k extends e.Chart{constructor(r,t){super(r,A("barWithErrorBars",t,S,p,[e.LinearScale,e.CategoryScale]))}}k.id=S.id;class P extends e.LineController{getMinMax(r,e){return E(r,(r=>super.getMinMax(r,e)))}parseObjectData(r,e,t,a){const n=super.parseObjectData(r,e,t,a);return C(n,r.vScale,e,t,a),W(n,r.iScale,t,a),n}updateElement(r,e,t,a){r instanceof y&&"number"==typeof e&&o(t,this.getParsed(e),e,this._cachedMeta.vScale,"reset"===a),super.updateElement(r,e,t,a)}}P.id="lineWithErrorBars",P.defaults=t.merge({},[e.LineController.defaults,b,{dataElementType:y.id}]),P.overrides=t.merge({},[e.LineController.overrides,{plugins:{tooltip:{callbacks:{label:g}}}}]),P.defaultRoutes=e.LineController.defaultRoutes;class T extends e.Chart{constructor(r,t){super(r,A("lineWithErrorBars",t,P,y,[e.LinearScale,e.CategoryScale]))}}T.id=P.id;class $ extends e.ScatterController{getMinMax(r,e){return E(r,(r=>super.getMinMax(r,e)))}parseObjectData(r,e,t,a){const n=super.parseObjectData(r,e,t,a);return C(n,r.xScale,e,t,a),C(n,r.yScale,e,t,a),n}updateElement(r,e,t,a){r instanceof y&&"number"==typeof e&&(o(t,this.getParsed(e),e,this._cachedMeta.xScale,"reset"===a),o(t,this.getParsed(e),e,this._cachedMeta.yScale,"reset"===a)),super.updateElement(r,e,t,a)}}$.id="scatterWithErrorBars",$.defaults=t.merge({},[e.ScatterController.defaults,b,{dataElementType:y.id}]),$.overrides=t.merge({},[e.ScatterController.overrides,{plugins:{tooltip:{callbacks:{label:function(r){const e=r.chart.data.datasets[r.datasetIndex].data[r.dataIndex],t=(r,t)=>{const a=n(t);return null==e||a.every((r=>null==e[r]))?r:`${r} [${m(e[a[0]])} .. ${e[a[1]]}]`};return`(${t(r.label,!0)}, ${t(r.parsed.y,!1)})`}}}}}]),$.defaultRoutes=e.LineController.defaultRoutes;class L extends e.Chart{constructor(r,t){super(r,A("scatterWithErrorBars",t,$,y,[e.LinearScale]))}}L.id=$.id;class R extends e.PolarAreaController{getMinMax(r,e){return E(r,(r=>super.getMinMax(r,e)))}countVisibleElements(){const r=this._cachedMeta;return r.data.reduce(((e,t,a)=>!Number.isNaN(r._parsed[a].r)&&this.chart.getDataVisibility(a)?e+1:e),0)}parseObjectData(r,e,t,a){const n=new Array(a),o=r.rScale;for(let r=0;r<a;r+=1){const a=r+t,s=e[a],l=o.parse(s[o.axis],a);n[r]={[o.axis]:l}}return C(n,o,e,t,a),n}updateElement(r,e,t,a){"number"==typeof e&&function(r,e,t,a,n){const o=n.animation,s=[`${t.axis}Min`,`${t.axis}Max`],l=r=>{const e=t.getDistanceFromCenterForValue(r),n=o.animateScale?0:e;return a?n:e};for(const t of s){const a=e[t];Array.isArray(a)?r[t]=a.map(l):"number"==typeof a&&(r[t]=l(a))}}(t,this.getParsed(e),this._cachedMeta.rScale,"reset"===a,this.chart.options),super.updateElement(r,e,t,a)}updateElements(r,e,t,a){const n=this.chart.scales.r,o=n.getDistanceFromCenterForValue;n.getDistanceFromCenterForValue=function(r){return"number"==typeof r?o.call(this,r):o.call(this,r.r)},super.updateElements(r,e,t,a),n.getDistanceFromCenterForValue=o}}R.id="polarAreaWithErrorBars",R.defaults=t.merge({},[e.PolarAreaController.defaults,b,{dataElementType:x.id}]),R.overrides=t.merge({},[e.PolarAreaController.overrides,{plugins:{tooltip:{callbacks:{label:function(r){const t=e.PolarAreaController.overrides.plugins.tooltip.callbacks.label.call(this,r),a=r.chart.data.datasets[r.datasetIndex].data[r.dataIndex],n=["rMin","rMax"];return null==a||n.every((r=>null==a[r]))?t:`${t} [${m(a[n[0]])} .. ${a[n[1]]}]`}}}}}]),R.defaultRoutes=e.PolarAreaController.defaultRoutes;class j extends e.Chart{constructor(r,t){super(r,A("polarAreaWithErrorBars",t,R,x,[e.RadialLinearScale]))}}j.id=R.id,e.registry.addControllers(S,P,R,$),e.registry.addElements(p,x,P,y),r.ArcWithErrorBar=x,r.BarWithErrorBar=p,r.BarWithErrorBarsChart=k,r.BarWithErrorBarsController=S,r.LineWithErrorBarsChart=T,r.LineWithErrorBarsController=P,r.PointWithErrorBar=y,r.PolarAreaWithErrorBarsChart=j,r.PolarAreaWithErrorBarsController=R,r.ScatterWithErrorBarsChart=L,r.ScatterWithErrorBarsController=$,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("chart.js"),require("chart.js/helpers")):"function"==typeof define&&define.amd?define(["exports","chart.js","chart.js/helpers"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).ChartErrorBars={},r.Chart,r.Chart.helpers)}(this,(function(r,e,t){"use strict";const a=["xMin","xMax","yMin","yMax"];function n(r){return r?a.slice(0,2):a.slice(2)}function o(r,e,t,a,n){const o=[`${a.axis}Min`,`${a.axis}Max`],s=a.getBasePixel();for(const l of o){const o=e[l];Array.isArray(o)?r[l]=o.map((r=>n?s:a.getPixelForValue(r,t))):"number"==typeof o&&(r[l]=n?s:a.getPixelForValue(o,t))}}const s={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={_scriptable:!0,_indexable:r=>"v"!==r},i=Object.keys(s);function c(r,e){const t=Array.isArray(r)?r:[r],a=Array.isArray(e)?e:[e];if(t.length===a.length)return t.map(((r,e)=>[r,a[e]]));const n=Math.max(t.length,a.length);return Array(n).map(((r,e)=>[t[e%t.length],a[e%a.length]]))}function u(r,e){if("string"==typeof r||"number"==typeof r)return r;const t=Array.isArray(r)?r:r.v;return t[e%t.length]}function d(r,e,t){const a=u(e.errorBarWhiskerRatio,t);if(null!=r&&a>0)return r*a*.5;return.5*u(e.errorBarWhiskerSize,t)}function h(r,e){var t,a,n,o;const s=r.getProps(["x","y","width","height","xMin","xMax","yMin","yMax"]);null==s.xMin&&null==s.xMax||function(r,e,t,a,n){n.save(),n.translate(0,r.y);const o=c(null==e?r.x:e,null==t?r.x:t);o.reverse().forEach((([e,t],s)=>{const l=o.length-s-1,i=d(r.height,a,l);n.lineWidth=u(a.errorBarLineWidth,l),n.strokeStyle=u(a.errorBarColor,l),n.beginPath(),n.moveTo(e,0),n.lineTo(t,0),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,l),n.strokeStyle=u(a.errorBarWhiskerColor,l),n.beginPath(),n.moveTo(e,-i),n.lineTo(e,i),n.moveTo(t,-i),n.lineTo(t,i),n.stroke()})),n.restore()}(s,null!==(t=s.xMin)&&void 0!==t?t:null,null!==(a=s.xMax)&&void 0!==a?a:null,r.options,e),null==s.yMin&&null==s.yMax||function(r,e,t,a,n){n.save(),n.translate(r.x,0);const o=c(null==e?r.y:e,null==t?r.y:t);o.reverse().forEach((([e,t],s)=>{const l=o.length-s-1,i=d(r.width,a,l);n.lineWidth=u(a.errorBarLineWidth,l),n.strokeStyle=u(a.errorBarColor,l),n.beginPath(),n.moveTo(0,e),n.lineTo(0,t),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,l),n.strokeStyle=u(a.errorBarWhiskerColor,l),n.beginPath(),n.moveTo(-i,e),n.lineTo(i,e),n.moveTo(-i,t),n.lineTo(i,t),n.stroke()})),n.restore()}(s,null!==(n=s.yMin)&&void 0!==n?n:null,null!==(o=s.yMax)&&void 0!==o?o:null,r.options,e)}function f(r,e){const t=r.getProps(["x","y","startAngle","endAngle","rMin","rMax","outerRadius"]);null==t.rMin&&null==t.rMax||function(r,e,t,a,n){n.save(),n.translate(r.x,r.y);const o=(r.startAngle+r.endAngle)/2,s=Math.cos(o),l=Math.sin(o),i={x:-l,y:s},h=Math.sqrt(i.x*i.x+i.y*i.y);i.x/=h,i.y/=h;const f=c(null!=e?e:r.outerRadius,null!=t?t:r.outerRadius);f.reverse().forEach((([r,e],t)=>{const o=f.length-t-1,c=r*s,h=r*l,p=e*s,y=e*l,x=d(null,a,o),m=i.x*x,g=i.y*x;n.lineWidth=u(a.errorBarLineWidth,o),n.strokeStyle=u(a.errorBarColor,o),n.beginPath(),n.moveTo(c,h),n.lineTo(p,y),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,o),n.strokeStyle=u(a.errorBarWhiskerColor,o),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,r.options,e)}class p extends e.BarElement{draw(r){super.draw(r),h(this,r)}}p.id="barWithErrorBar",p.defaults={...e.BarElement.defaults,...s},p.defaultRoutes=e.BarElement.defaultRoutes,p.descriptors=l;class y extends e.PointElement{draw(r,e){super.draw.call(this,r,e),h(this,r)}}y.id="pointWithErrorBar",y.defaults={...e.PointElement.defaults,...s},y.defaultRoutes=e.PointElement.defaultRoutes,y.descriptors=l;class x extends e.ArcElement{draw(r){super.draw(r),f(this,r)}}function m(r){return Array.isArray(r)?r.slice().reverse():r}function g(r){const t=n(r.element.horizontal),a=e.Tooltip.defaults.callbacks.label.call(this,r),o=r.chart.data.datasets[r.datasetIndex].data[r.dataIndex];return null==o||t.every((r=>null==o[r]))?a:`${a} (${m(o[t[0]])} .. ${o[t[1]]})`}x.id="arcWithErrorBar",x.defaults={...e.ArcElement.defaults,...s},x.defaultRoutes=e.ArcElement.defaultRoutes,x.descriptors=l;const M={color(r,e,a){const n=r||"transparent",o=e||"transparent";if(n===o)return e;const s=t.color(n),l=s.valid&&t.color(o);return l&&l.valid?l.mix(s,a).hexString():e},number:(r,e,t)=>r===e?e:r+(e-r)*t};function B(r,e,t,a,n){if(typeof r===a&&typeof e===a)return n(r,e,t);if(Array.isArray(r)&&Array.isArray(e))return r.map(((r,a)=>n(r,e[a],t)));const o=r=>r&&Array.isArray(r.v);return o(r)&&o(e)?{v:r.v.map(((r,a)=>n(r,e.v[a],t)))}:e}const b={animations:{numberArray:{fn:function(r,e,t){return B(r,e,t,"number",M.number)},properties:a.concat(i.filter((r=>!r.endsWith("Color"))),["rMin","rMax"])},colorArray:{fn:function(r,e,t){return B(r,e,t,"string",M.color)},properties:i.filter((r=>r.endsWith("Color")))}}};function E(r,e){const{axis:t}=r;r.axis=`${t}MinMin`;const{min:a}=e(r);r.axis=`${t}MaxMax`;const{max:n}=e(r);return r.axis=t,{min:a,max:n}}function v(r,e,t){return Array.isArray(e)?t(...e):"number"==typeof e?e:r}function C(r,e,t,a,n){const o="string"==typeof e?e:e.axis,s=`${o}Min`,l=`${o}Max`,i=`${o}MinMin`,c=`${o}MaxMax`;for(let e=0;e<n;e+=1){const n=e+a,u=r[e];u[s]=t[n][s],u[l]=t[n][l],u[i]=v(u[o],u[s],Math.min),u[c]=v(u[o],u[l],Math.max)}}function W(r,e,t,a){const{axis:n}=e,o=e.getLabels();for(let s=0;s<a;s+=1){const a=s+t;r[s][n]=e.parse(o[a],a)}}function A(r,t,a,n=[],o=[]){e.registry.addControllers(a),Array.isArray(n)?e.registry.addElements(...n):e.registry.addElements(n),Array.isArray(o)?e.registry.addScales(...o):e.registry.addScales(o);const s=t;return s.type=r,s}class S extends e.BarController{getMinMax(r,e){return E(r,(r=>super.getMinMax(r,e)))}parseObjectData(r,e,t,a){const n=super.parseObjectData(r,e,t,a);return C(n,r.vScale,e,t,a),W(n,r.iScale,t,a),n}updateElement(r,e,t,a){"number"==typeof e&&o(t,this.getParsed(e),e,this._cachedMeta.vScale,"reset"===a),super.updateElement(r,e,t,a)}}S.id="barWithErrorBars",S.defaults=t.merge({},[e.BarController.defaults,b,{dataElementType:p.id}]),S.overrides=t.merge({},[e.BarController.overrides,{plugins:{tooltip:{callbacks:{label:g}}}}]),S.defaultRoutes=e.BarController.defaultRoutes;class k extends e.Chart{constructor(r,t){super(r,A("barWithErrorBars",t,S,p,[e.LinearScale,e.CategoryScale]))}}k.id=S.id;class P extends e.LineController{getMinMax(r,e){return E(r,(r=>super.getMinMax(r,e)))}parseObjectData(r,e,t,a){const n=super.parseObjectData(r,e,t,a);return C(n,r.vScale,e,t,a),W(n,r.iScale,t,a),n}updateElement(r,e,t,a){r instanceof y&&"number"==typeof e&&o(t,this.getParsed(e),e,this._cachedMeta.vScale,"reset"===a),super.updateElement(r,e,t,a)}}P.id="lineWithErrorBars",P.defaults=t.merge({},[e.LineController.defaults,b,{dataElementType:y.id}]),P.overrides=t.merge({},[e.LineController.overrides,{plugins:{tooltip:{callbacks:{label:g}}}}]),P.defaultRoutes=e.LineController.defaultRoutes;class T extends e.Chart{constructor(r,t){super(r,A("lineWithErrorBars",t,P,y,[e.LinearScale,e.CategoryScale]))}}T.id=P.id;class $ extends e.ScatterController{getMinMax(r,e){return E(r,(r=>super.getMinMax(r,e)))}parseObjectData(r,e,t,a){const n=super.parseObjectData(r,e,t,a);return C(n,r.xScale,e,t,a),C(n,r.yScale,e,t,a),n}updateElement(r,e,t,a){r instanceof y&&"number"==typeof e&&(o(t,this.getParsed(e),e,this._cachedMeta.xScale,"reset"===a),o(t,this.getParsed(e),e,this._cachedMeta.yScale,"reset"===a)),super.updateElement(r,e,t,a)}}$.id="scatterWithErrorBars",$.defaults=t.merge({},[e.ScatterController.defaults,b,{dataElementType:y.id}]),$.overrides=t.merge({},[e.ScatterController.overrides,{plugins:{tooltip:{callbacks:{label:function(r){const e=r.chart.data.datasets[r.datasetIndex].data[r.dataIndex],t=(r,t)=>{const a=n(t);return null==e||a.every((r=>null==e[r]))?r:`${r} [${m(e[a[0]])} .. ${e[a[1]]}]`};return`(${t(r.label,!0)}, ${t(r.parsed.y,!1)})`}}}}}]),$.defaultRoutes=e.LineController.defaultRoutes;class L extends e.Chart{constructor(r,t){super(r,A("scatterWithErrorBars",t,$,y,[e.LinearScale]))}}L.id=$.id;class R extends e.PolarAreaController{getMinMax(r,e){return E(r,(r=>super.getMinMax(r,e)))}countVisibleElements(){const r=this._cachedMeta;return r.data.reduce(((e,t,a)=>!Number.isNaN(r._parsed[a].r)&&this.chart.getDataVisibility(a)?e+1:e),0)}parseObjectData(r,e,t,a){const n=new Array(a),o=r.rScale;for(let r=0;r<a;r+=1){const a=r+t,s=e[a],l=o.parse(s[o.axis],a);n[r]={[o.axis]:l}}return C(n,o,e,t,a),n}updateElement(r,e,t,a){"number"==typeof e&&function(r,e,t,a,n){const o=n.animation,s=[`${t.axis}Min`,`${t.axis}Max`],l=r=>{const e=t.getDistanceFromCenterForValue(r),n=o.animateScale?0:e;return a?n:e};for(const t of s){const a=e[t];Array.isArray(a)?r[t]=a.map(l):"number"==typeof a&&(r[t]=l(a))}}(t,this.getParsed(e),this._cachedMeta.rScale,"reset"===a,this.chart.options),super.updateElement(r,e,t,a)}updateElements(r,e,t,a){const n=this.chart.scales.r,o=n.getDistanceFromCenterForValue;n.getDistanceFromCenterForValue=function(r){return"number"==typeof r?o.call(this,r):o.call(this,r.r)},super.updateElements(r,e,t,a),n.getDistanceFromCenterForValue=o}}R.id="polarAreaWithErrorBars",R.defaults=t.merge({},[e.PolarAreaController.defaults,b,{dataElementType:x.id}]),R.overrides=t.merge({},[e.PolarAreaController.overrides,{plugins:{tooltip:{callbacks:{label:function(r){const t=e.PolarAreaController.overrides.plugins.tooltip.callbacks.label.call(this,r),a=r.chart.data.datasets[r.datasetIndex].data[r.dataIndex],n=["rMin","rMax"];return null==a||n.every((r=>null==a[r]))?t:`${t} [${m(a[n[0]])} .. ${a[n[1]]}]`}}}}}]),R.defaultRoutes=e.PolarAreaController.defaultRoutes;class j extends e.Chart{constructor(r,t){super(r,A("polarAreaWithErrorBars",t,R,x,[e.RadialLinearScale]))}}j.id=R.id,e.registry.addControllers(S,P,R,$),e.registry.addElements(p,x,y),r.ArcWithErrorBar=x,r.BarWithErrorBar=p,r.BarWithErrorBarsChart=k,r.BarWithErrorBarsController=S,r.LineWithErrorBarsChart=T,r.LineWithErrorBarsController=P,r.PointWithErrorBar=y,r.PolarAreaWithErrorBarsChart=j,r.PolarAreaWithErrorBarsController=R,r.ScatterWithErrorBarsChart=L,r.ScatterWithErrorBarsController=$,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.umd.min.js.map |
{ | ||
"name": "chartjs-chart-error-bars", | ||
"description": "Chart.js module for charting error bars", | ||
"version": "3.7.0", | ||
"version": "3.7.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Samuel Gratzl", |
@@ -18,2 +18,2 @@ import { registry } from 'chart.js'; | ||
); | ||
registry.addElements(BarWithErrorBar, ArcWithErrorBar, LineWithErrorBarsController, PointWithErrorBar); | ||
registry.addElements(BarWithErrorBar, ArcWithErrorBar, PointWithErrorBar); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
231683