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.5 to 3.0.0-beta.6

34

build/index.esm.js

@@ -252,3 +252,3 @@ /**

function generateTooltipPolar(item) {
const base = PolarAreaController.defaults.tooltips.callbacks.label.call(this, item);
const base = PolarAreaController.defaults.plugins.tooltip.callbacks.label.call(this, item);
const v = item.chart.data.datasets[item.datasetIndex].data[item.dataIndex];

@@ -398,5 +398,7 @@ const keys = ['rMin', 'rMax'];

{
tooltips: {
callbacks: {
label: generateBarTooltip,
plugins: {
tooltip: {
callbacks: {
label: generateBarTooltip,
},
},

@@ -441,5 +443,7 @@ },

{
tooltips: {
callbacks: {
label: generateBarTooltip,
plugins: {
tooltip: {
callbacks: {
label: generateBarTooltip,
},
},

@@ -485,5 +489,7 @@ },

{
tooltips: {
callbacks: {
label: generateTooltipScatter,
plugins: {
tooltip: {
callbacks: {
label: generateTooltipScatter,
},
},

@@ -563,5 +569,7 @@ },

{
tooltips: {
callbacks: {
label: generateTooltipPolar,
plugins: {
tooltip: {
callbacks: {
label: generateTooltipPolar,
},
},

@@ -568,0 +576,0 @@ },

@@ -256,3 +256,3 @@ /**

function generateTooltipPolar(item) {
const base = chart_js.PolarAreaController.defaults.tooltips.callbacks.label.call(this, item);
const base = chart_js.PolarAreaController.defaults.plugins.tooltip.callbacks.label.call(this, item);
const v = item.chart.data.datasets[item.datasetIndex].data[item.dataIndex];

@@ -402,5 +402,7 @@ const keys = ['rMin', 'rMax'];

{
tooltips: {
callbacks: {
label: generateBarTooltip,
plugins: {
tooltip: {
callbacks: {
label: generateBarTooltip,
},
},

@@ -445,5 +447,7 @@ },

{
tooltips: {
callbacks: {
label: generateBarTooltip,
plugins: {
tooltip: {
callbacks: {
label: generateBarTooltip,
},
},

@@ -489,5 +493,7 @@ },

{
tooltips: {
callbacks: {
label: generateTooltipScatter,
plugins: {
tooltip: {
callbacks: {
label: generateTooltipScatter,
},
},

@@ -567,5 +573,7 @@ },

{
tooltips: {
callbacks: {
label: generateTooltipPolar,
plugins: {
tooltip: {
callbacks: {
label: generateTooltipPolar,
},
},

@@ -572,0 +580,0 @@ },

@@ -255,3 +255,3 @@ /**

function generateTooltipPolar(item) {
const base = chart_js.PolarAreaController.defaults.tooltips.callbacks.label.call(this, item);
const base = chart_js.PolarAreaController.defaults.plugins.tooltip.callbacks.label.call(this, item);
const v = item.chart.data.datasets[item.datasetIndex].data[item.dataIndex];

@@ -401,5 +401,7 @@ const keys = ['rMin', 'rMax'];

{
tooltips: {
callbacks: {
label: generateBarTooltip,
plugins: {
tooltip: {
callbacks: {
label: generateBarTooltip,
},
},

@@ -444,5 +446,7 @@ },

{
tooltips: {
callbacks: {
label: generateBarTooltip,
plugins: {
tooltip: {
callbacks: {
label: generateBarTooltip,
},
},

@@ -488,5 +492,7 @@ },

{
tooltips: {
callbacks: {
label: generateTooltipScatter,
plugins: {
tooltip: {
callbacks: {
label: generateTooltipScatter,
},
},

@@ -566,5 +572,7 @@ },

{
tooltips: {
callbacks: {
label: generateTooltipPolar,
plugins: {
tooltip: {
callbacks: {
label: generateTooltipPolar,
},
},

@@ -571,0 +579,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 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})}));
!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,{plugins:{tooltip:{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,{plugins:{tooltip:{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,{plugins:{tooltip:{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,{plugins:{tooltip:{callbacks:{label:function(e){const t=r.PolarAreaController.defaults.plugins.tooltip.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.5",
"version": "3.0.0-beta.6",
"author": {

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

"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-replace": "^2.3.4",
"@rollup/plugin-typescript": "^6.1.0",
"@types/jest": "^26.0.15",
"@rollup/plugin-typescript": "^8.0.0",
"@types/jest": "^26.0.18",
"@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",
"@types/node": "^14.14.11",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"@typescript-eslint/parser": "^4.9.1",
"@yarnpkg/pnpify": "^2.4.0",
"canvas": "^2.6.1",
"chart.js": "^3.0.0-beta.6",
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"chart.js": "^3.0.0-beta.7",
"eslint": "^7.15.0",
"eslint-config-prettier": "^7.0.0",
"eslint-config-react-app": "^6.0.0",

@@ -62,3 +62,3 @@ "eslint-plugin-flowtype": "^5.2.0",

"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-prettier": "^3.2.0",
"eslint-plugin-react": "^7.21.5",

@@ -68,8 +68,8 @@ "eslint-plugin-react-hooks": "^4.2.0",

"jest-image-snapshot": "^4.2.0",
"prettier": "^2.1.2",
"release-it": "^14.2.1",
"prettier": "^2.2.1",
"release-it": "^14.2.2",
"rimraf": "^3.0.2",
"rollup": "^2.33.1",
"rollup": "^2.34.2",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-dts": "^1.4.13",
"rollup-plugin-dts": "^2.0.0",
"rollup-plugin-terser": "^7.0.2",

@@ -79,3 +79,3 @@ "ts-jest": "^26.4.4",

"typedoc": "^0.19.2",
"typescript": "^4.0.5"
"typescript": "^4.1.2"
},

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

@@ -38,8 +38,10 @@ /// <reference types="jest" />

animation: false,
legend: {
display: false,
plugins: {
legend: {
display: false,
},
title: {
display: false,
},
},
title: {
display: false,
},
},

@@ -46,0 +48,0 @@ config.options || {}

@@ -57,5 +57,7 @@ import {

{
tooltips: {
callbacks: {
label: generateBarTooltip,
plugins: {
tooltip: {
callbacks: {
label: generateBarTooltip,
},
},

@@ -62,0 +64,0 @@ },

@@ -58,5 +58,7 @@ import {

{
tooltips: {
callbacks: {
label: generateBarTooltip,
plugins: {
tooltip: {
callbacks: {
label: generateBarTooltip,
},
},

@@ -63,0 +65,0 @@ },

@@ -98,5 +98,7 @@ import {

{
tooltips: {
callbacks: {
label: generateTooltipPolar,
plugins: {
tooltip: {
callbacks: {
label: generateTooltipPolar,
},
},

@@ -103,0 +105,0 @@ },

@@ -65,5 +65,7 @@ import {

{
tooltips: {
callbacks: {
label: generateTooltipScatter,
plugins: {
tooltip: {
callbacks: {
label: generateTooltipScatter,
},
},

@@ -70,0 +72,0 @@ },

@@ -34,3 +34,3 @@ import { modelKeys } from './utils';

export function generateTooltipPolar(this: TooltipModel, item: TooltipItem) {
const base = PolarAreaController.defaults.tooltips.callbacks.label.call(this, item);
const base = PolarAreaController.defaults.plugins.tooltip.callbacks.label.call(this, item);
const v = (item.chart.data.datasets[item.datasetIndex].data[item.dataIndex] as unknown) as IErrorBarRDataPoint;

@@ -37,0 +37,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