chartjs-chart-error-bars
Advanced tools
Comparing version 3.9.1 to 3.9.2
@@ -108,3 +108,5 @@ /** | ||
}; | ||
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
protected parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
protected parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
private parseErrorData; | ||
updateElement(element: Element, index: number | undefined, properties: Record<string, unknown>, mode: UpdateMode): void; | ||
@@ -142,3 +144,5 @@ static readonly id = "barWithErrorBars"; | ||
}; | ||
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
protected parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
protected parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
private parseErrorData; | ||
updateElement(element: Element, index: number | undefined, properties: Record<string, unknown>, mode: UpdateMode): void; | ||
@@ -178,3 +182,5 @@ protected updateElementScale(index: number, properties: Record<string, unknown>, mode: UpdateMode): void; | ||
}; | ||
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
protected parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
protected parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
private parseErrorData; | ||
updateElement(element: Element, index: number | undefined, properties: Record<string, unknown>, mode: UpdateMode): void; | ||
@@ -219,3 +225,5 @@ protected updateElementScale(index: number, properties: Record<string, unknown>, mode: UpdateMode): void; | ||
countVisibleElements(): number; | ||
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
protected parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
protected parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[]; | ||
private parseErrorData; | ||
updateElement(element: Element, index: number | undefined, properties: Record<string, unknown>, mode: UpdateMode): void; | ||
@@ -222,0 +230,0 @@ updateElements(arcs: Element[], start: number, count: number, mode: UpdateMode): void; |
@@ -201,2 +201,5 @@ /** | ||
} | ||
else { | ||
properties[key] = null; | ||
} | ||
} | ||
@@ -220,2 +223,5 @@ } | ||
} | ||
else { | ||
properties[key] = null; | ||
} | ||
} | ||
@@ -318,6 +324,6 @@ } | ||
if (Array.isArray(vm)) { | ||
return op(...vm); | ||
return op(v, ...vm); | ||
} | ||
if (typeof vm === 'number') { | ||
return vm; | ||
return op(v, vm); | ||
} | ||
@@ -335,4 +341,4 @@ return v; | ||
const p = parsed[i]; | ||
p[vMin] = data[index][vMin]; | ||
p[vMax] = data[index][vMax]; | ||
p[vMin] = typeof data[index] === 'object' ? data[index][vMin] : null; | ||
p[vMax] = typeof data[index] === 'object' ? data[index][vMax] : null; | ||
p[vMinMin] = computeExtrema(p[axis], p[vMin], Math.min); | ||
@@ -375,7 +381,15 @@ p[vMaxMax] = computeExtrema(p[axis], p[vMax], Math.max); | ||
} | ||
parsePrimitiveData(meta, data, start, count) { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseObjectData(meta, data, start, count) { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseErrorData(parsed, meta, data, start, count) { | ||
parseErrorNumberData(parsed, meta.vScale, data, start, count); | ||
parseErrorLabelData(parsed, meta.iScale, start, count); | ||
return parsed; | ||
} | ||
@@ -424,4 +438,13 @@ updateElement(element, index, properties, mode) { | ||
} | ||
parsePrimitiveData(meta, data, start, count) { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseObjectData(meta, data, start, count) { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseErrorData(parsed, meta, data, start, count) { | ||
parseErrorNumberData(parsed, meta.vScale, data, start, count); | ||
@@ -436,3 +459,2 @@ const iScale = meta.iScale; | ||
} | ||
return parsed; | ||
} | ||
@@ -504,7 +526,15 @@ updateElement(element, index, properties, mode) { | ||
} | ||
parsePrimitiveData(meta, data, start, count) { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseObjectData(meta, data, start, count) { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseErrorData(parsed, meta, data, start, count) { | ||
parseErrorNumberData(parsed, meta.xScale, data, start, count); | ||
parseErrorNumberData(parsed, meta.yScale, data, start, count); | ||
return parsed; | ||
} | ||
@@ -598,4 +628,13 @@ updateElement(element, index, properties, mode) { | ||
} | ||
parsePrimitiveData(meta, data, start, count) { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseObjectData(meta, data, start, count) { | ||
const parsed = new Array(count); | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseErrorData(parsed, meta, data, start, count) { | ||
const scale = meta.rScale; | ||
@@ -611,3 +650,2 @@ for (let i = 0; i < count; i += 1) { | ||
parseErrorNumberData(parsed, scale, data, start, count); | ||
return parsed; | ||
} | ||
@@ -614,0 +652,0 @@ updateElement(element, index, properties, mode) { |
@@ -29,2 +29,5 @@ /** | ||
} | ||
else { | ||
properties[key] = null; | ||
} | ||
} | ||
@@ -48,2 +51,5 @@ } | ||
} | ||
else { | ||
properties[key] = null; | ||
} | ||
} | ||
@@ -321,6 +327,6 @@ } | ||
if (Array.isArray(vm)) { | ||
return op(...vm); | ||
return op(v, ...vm); | ||
} | ||
if (typeof vm === 'number') { | ||
return vm; | ||
return op(v, vm); | ||
} | ||
@@ -338,4 +344,4 @@ return v; | ||
const p = parsed[i]; | ||
p[vMin] = data[index][vMin]; | ||
p[vMax] = data[index][vMax]; | ||
p[vMin] = typeof data[index] === 'object' ? data[index][vMin] : null; | ||
p[vMax] = typeof data[index] === 'object' ? data[index][vMax] : null; | ||
p[vMinMin] = computeExtrema(p[axis], p[vMin], Math.min); | ||
@@ -378,7 +384,15 @@ p[vMaxMax] = computeExtrema(p[axis], p[vMax], Math.max); | ||
} | ||
parsePrimitiveData(meta, data, start, count) { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseObjectData(meta, data, start, count) { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseErrorData(parsed, meta, data, start, count) { | ||
parseErrorNumberData(parsed, meta.vScale, data, start, count); | ||
parseErrorLabelData(parsed, meta.iScale, start, count); | ||
return parsed; | ||
} | ||
@@ -427,4 +441,13 @@ updateElement(element, index, properties, mode) { | ||
} | ||
parsePrimitiveData(meta, data, start, count) { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseObjectData(meta, data, start, count) { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseErrorData(parsed, meta, data, start, count) { | ||
parseErrorNumberData(parsed, meta.vScale, data, start, count); | ||
@@ -439,3 +462,2 @@ const iScale = meta.iScale; | ||
} | ||
return parsed; | ||
} | ||
@@ -507,7 +529,15 @@ updateElement(element, index, properties, mode) { | ||
} | ||
parsePrimitiveData(meta, data, start, count) { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseObjectData(meta, data, start, count) { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseErrorData(parsed, meta, data, start, count) { | ||
parseErrorNumberData(parsed, meta.xScale, data, start, count); | ||
parseErrorNumberData(parsed, meta.yScale, data, start, count); | ||
return parsed; | ||
} | ||
@@ -601,4 +631,13 @@ updateElement(element, index, properties, mode) { | ||
} | ||
parsePrimitiveData(meta, data, start, count) { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseObjectData(meta, data, start, count) { | ||
const parsed = new Array(count); | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
parseErrorData(parsed, meta, data, start, count) { | ||
const scale = meta.rScale; | ||
@@ -614,3 +653,2 @@ for (let i = 0; i < count; i += 1) { | ||
parseErrorNumberData(parsed, scale, data, start, count); | ||
return parsed; | ||
} | ||
@@ -617,0 +655,0 @@ updateElement(element, index, properties, mode) { |
@@ -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={_scriptable:!0,_indexable:e=>"v"!==e},l=Object.keys(o);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){var t,a,n,s;const o=e.getProps(["x","y","width","height","xMin","xMax","yMin","yMax"]);null==o.xMin&&null==o.xMax||function(e,r,t,a,n){n.save(),n.translate(0,e.y);const s=c(null==r?e.x:r,null==t?e.x: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()}(o,null!==(t=o.xMin)&&void 0!==t?t:null,null!==(a=o.xMax)&&void 0!==a?a:null,e.options,r),null==o.yMin&&null==o.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()}(o,null!==(n=o.yMin)&&void 0!==n?n:null,null!==(s=o.yMax)&&void 0!==s?s:null,e.options,r)}function p(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);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 p=c(null!=r?r:e.outerRadius,null!=t?t:e.outerRadius);p.reverse().forEach((([e,r],t)=>{const s=p.length-t-1,c=e*o,h=e*i,f=r*o,m=r*i,y=d(null,a,s),x=l.x*y,g=l.y*y;n.lineWidth=u(a.errorBarLineWidth,s),n.strokeStyle=u(a.errorBarColor,s),n.beginPath(),n.moveTo(c,h),n.lineTo(f,m),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,s),n.strokeStyle=u(a.errorBarWhiskerColor,s),n.beginPath(),n.moveTo(c+x,h+g),n.lineTo(c-x,h-g),n.moveTo(f+x,m+g),n.lineTo(f-x,m-g),n.stroke()})),n.restore()}(t,t.rMin,t.rMax,e.options,r)}class f extends r.BarElement{draw(e){super.draw(e),h(this,e)}}f.id="barWithErrorBar",f.defaults={...r.BarElement.defaults,...o},f.defaultRoutes=r.BarElement.defaultRoutes,f.descriptors=i;class m extends r.PointElement{draw(e,r){super.draw.call(this,e,r),h(this,e)}}m.id="pointWithErrorBar",m.defaults={...r.PointElement.defaults,...o},m.defaultRoutes=r.PointElement.defaultRoutes,m.descriptors=i;class y extends r.ArcElement{draw(e){super.draw(e),p(this,e)}}function x(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} (${x(s[t[0]])} .. ${s[t[1]]})`}y.id="arcWithErrorBar",y.defaults={...r.ArcElement.defaults,...o},y.defaultRoutes=r.ArcElement.defaultRoutes,y.descriptors=i;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 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)&&s(r)?{v:e.v.map(((e,a)=>n(e,r.v[a],t)))}:r}const b={animations:{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:l.filter((e=>e.endsWith("Color")))}}};function B(e,r){const{axis:t}=e;e.axis=`${t}MinMin`;const{min:a}=r(e);e.axis=`${t}MaxMax`;const{max:n}=r(e);return e.axis=t,{min:a,max:n}}function v(e,r,t){return Array.isArray(r)?t(...r):"number"==typeof r?r:e}function C(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+=1){const n=r+a,u=e[r];u[o]=t[n][o],u[i]=t[n][i],u[l]=v(u[s],u[o],Math.min),u[c]=v(u[s],u[i],Math.max)}}function W(e,r,t,a){const{axis:n}=r,s=r.getLabels();for(let o=0;o<a;o+=1){const a=o+t;e[o][n]=r.parse(s[a],a)}}function A(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,(e=>super.getMinMax(e,r)))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return C(n,e.vScale,r,t,a),W(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,{dataElementType:f.id}]),S.overrides=t.merge({},[r.BarController.overrides,{plugins:{tooltip:{callbacks:{label:g}}}}]),S.defaultRoutes=r.BarController.defaultRoutes;class k extends r.Chart{constructor(e,t){super(e,A("barWithErrorBars",t,S,f,[r.LinearScale,r.CategoryScale]))}}k.id=S.id;class P extends r.LineController{getMinMax(e,r){return B(e,(e=>super.getMinMax(e,r)))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);C(n,e.vScale,r,t,a);const s=e.iScale;return"linear"===s.type||"logarithmic"===s.type?C(n,e.iScale,r,t,a):W(n,e.iScale,t,a),n}updateElement(e,r,t,a){e instanceof m&&"number"==typeof r&&this.updateElementScale(r,t,a),super.updateElement(e,r,t,a)}updateElementScale(e,r,t){s(r,this.getParsed(e),e,this._cachedMeta.vScale,"reset"===t);const a=this._cachedMeta.iScale;("linear"===a.type||"logarithmic"===a.type)&&s(r,this.getParsed(e),e,this._cachedMeta.iScale,"reset"===t)}updateElements(e,r,t,a){const n="reset"===a,s=this.chart._animationsDisabled||n||"none"===a;if(super.updateElements(e,r,t,a),s)for(let n=r;n<r+t;++n){const r=e[n];r instanceof m&&this.updateElementScale(n,r,a)}}}P.id="lineWithErrorBars",P.defaults=t.merge({},[r.LineController.defaults,b,{dataElementType:m.id}]),P.overrides=t.merge({},[r.LineController.overrides,{plugins:{tooltip:{callbacks:{label:g}}}}]),P.defaultRoutes=r.LineController.defaultRoutes;class T extends r.Chart{constructor(e,t){super(e,A("lineWithErrorBars",t,P,m,[r.LinearScale,r.CategoryScale]))}}T.id=P.id;class $ extends r.ScatterController{getMinMax(e,r){return B(e,(e=>super.getMinMax(e,r)))}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return C(n,e.xScale,r,t,a),C(n,e.yScale,r,t,a),n}updateElement(e,r,t,a){e instanceof m&&"number"==typeof r&&this.updateElementScale(r,t,a),super.updateElement(e,r,t,a)}updateElementScale(e,r,t){s(r,this.getParsed(e),e,this._cachedMeta.xScale,"reset"===t),s(r,this.getParsed(e),e,this._cachedMeta.yScale,"reset"===t)}updateElements(e,r,t,a){const n="reset"===a,s=this.chart._animationsDisabled||n||"none"===a;if(super.updateElements(e,r,t,a),s)for(let n=r;n<r+t;++n){const r=e[n];r instanceof m&&this.updateElementScale(n,r,a)}}}$.id="scatterWithErrorBars",$.defaults=t.merge({},[r.ScatterController.defaults,b,{dataElementType:m.id}]),$.overrides=t.merge({},[r.ScatterController.overrides,{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} [${x(r[a[0]])} .. ${r[a[1]]}]`};return`(${t(e.label,!0)}, ${t(e.parsed.y,!1)})`}}}}}]),$.defaultRoutes=r.LineController.defaultRoutes;class L extends r.Chart{constructor(e,t){super(e,A("scatterWithErrorBars",t,$,m,[r.LinearScale]))}}L.id=$.id;class R extends r.PolarAreaController{getMinMaxImpl(e){const r=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return r.data.forEach(((r,a)=>{const n=this.getParsed(a)[e.axis];!Number.isNaN(n)&&this.chart.getDataVisibility(a)&&(n<t.min&&(t.min=n),n>t.max&&(t.max=n))})),t}getMinMax(e){return B(e,(e=>this.getMinMaxImpl(e)))}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)}parseObjectData(e,r,t,a){const n=new Array(a),s=e.rScale;for(let e=0;e<a;e+=1){const a=e+t,o=r[a],i=s.parse(o[s.axis],a);n[e]={[s.axis]:i}}return C(n,s,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}}R.id="polarAreaWithErrorBars",R.defaults=t.merge({},[r.PolarAreaController.defaults,b,{dataElementType:y.id}]),R.overrides=t.merge({},[r.PolarAreaController.overrides,{plugins:{tooltip:{callbacks:{label:function(e){const t=r.PolarAreaController.overrides.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} [${x(a[n[0]])} .. ${a[n[1]]}]`}}}}}]),R.defaultRoutes=r.PolarAreaController.defaultRoutes;class _ extends r.Chart{constructor(e,t){super(e,A("polarAreaWithErrorBars",t,R,y,[r.RadialLinearScale]))}}_.id=R.id,r.registry.addControllers(S,P,R,$),r.registry.addElements(f,y,m),e.ArcWithErrorBar=y,e.BarWithErrorBar=f,e.BarWithErrorBarsChart=k,e.BarWithErrorBarsController=S,e.LineWithErrorBarsChart=T,e.LineWithErrorBarsController=P,e.PointWithErrorBar=m,e.PolarAreaWithErrorBarsChart=_,e.PolarAreaWithErrorBarsController=R,e.ScatterWithErrorBarsChart=L,e.ScatterWithErrorBarsController=$,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))):e[i]="number"==typeof s?n?o:a.getPixelForValue(s,t):null}}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={_scriptable:!0,_indexable:e=>"v"!==e},l=Object.keys(o);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){var t,a,n,s;const o=e.getProps(["x","y","width","height","xMin","xMax","yMin","yMax"]);null==o.xMin&&null==o.xMax||function(e,r,t,a,n){n.save(),n.translate(0,e.y);const s=c(null==r?e.x:r,null==t?e.x: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()}(o,null!==(t=o.xMin)&&void 0!==t?t:null,null!==(a=o.xMax)&&void 0!==a?a:null,e.options,r),null==o.yMin&&null==o.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()}(o,null!==(n=o.yMin)&&void 0!==n?n:null,null!==(s=o.yMax)&&void 0!==s?s:null,e.options,r)}function p(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);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 p=c(null!=r?r:e.outerRadius,null!=t?t:e.outerRadius);p.reverse().forEach((([e,r],t)=>{const s=p.length-t-1,c=e*o,h=e*i,f=r*o,m=r*i,y=d(null,a,s),x=l.x*y,g=l.y*y;n.lineWidth=u(a.errorBarLineWidth,s),n.strokeStyle=u(a.errorBarColor,s),n.beginPath(),n.moveTo(c,h),n.lineTo(f,m),n.stroke(),n.lineWidth=u(a.errorBarWhiskerLineWidth,s),n.strokeStyle=u(a.errorBarWhiskerColor,s),n.beginPath(),n.moveTo(c+x,h+g),n.lineTo(c-x,h-g),n.moveTo(f+x,m+g),n.lineTo(f-x,m-g),n.stroke()})),n.restore()}(t,t.rMin,t.rMax,e.options,r)}class f extends r.BarElement{draw(e){super.draw(e),h(this,e)}}f.id="barWithErrorBar",f.defaults={...r.BarElement.defaults,...o},f.defaultRoutes=r.BarElement.defaultRoutes,f.descriptors=i;class m extends r.PointElement{draw(e,r){super.draw.call(this,e,r),h(this,e)}}m.id="pointWithErrorBar",m.defaults={...r.PointElement.defaults,...o},m.defaultRoutes=r.PointElement.defaultRoutes,m.descriptors=i;class y extends r.ArcElement{draw(e){super.draw(e),p(this,e)}}function x(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} (${x(s[t[0]])} .. ${s[t[1]]})`}y.id="arcWithErrorBar",y.defaults={...r.ArcElement.defaults,...o},y.defaultRoutes=r.ArcElement.defaultRoutes,y.descriptors=i;const E={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 M(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)&&s(r)?{v:e.v.map(((e,a)=>n(e,r.v[a],t)))}:r}const b={animations:{numberArray:{fn:function(e,r,t){return M(e,r,t,"number",E.number)},properties:a.concat(l.filter((e=>!e.endsWith("Color"))),["rMin","rMax"])},colorArray:{fn:function(e,r,t){return M(e,r,t,"string",E.color)},properties:l.filter((e=>e.endsWith("Color")))}}};function v(e,r){const{axis:t}=e;e.axis=`${t}MinMin`;const{min:a}=r(e);e.axis=`${t}MaxMax`;const{max:n}=r(e);return e.axis=t,{min:a,max:n}}function B(e,r,t){return Array.isArray(r)?t(e,...r):"number"==typeof r?t(e,r):e}function C(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+=1){const n=r+a,u=e[r];u[o]="object"==typeof t[n]?t[n][o]:null,u[i]="object"==typeof t[n]?t[n][i]:null,u[l]=B(u[s],u[o],Math.min),u[c]=B(u[s],u[i],Math.max)}}function W(e,r,t,a){const{axis:n}=r,s=r.getLabels();for(let o=0;o<a;o+=1){const a=o+t;e[o][n]=r.parse(s[a],a)}}function S(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 A extends r.BarController{getMinMax(e,r){return v(e,(e=>super.getMinMax(e,r)))}parsePrimitiveData(e,r,t,a){const n=super.parsePrimitiveData(e,r,t,a);return this.parseErrorData(n,e,r,t,a),n}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return this.parseErrorData(n,e,r,t,a),n}parseErrorData(e,r,t,a,n){C(e,r.vScale,t,a,n),W(e,r.iScale,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)}}A.id="barWithErrorBars",A.defaults=t.merge({},[r.BarController.defaults,b,{dataElementType:f.id}]),A.overrides=t.merge({},[r.BarController.overrides,{plugins:{tooltip:{callbacks:{label:g}}}}]),A.defaultRoutes=r.BarController.defaultRoutes;class P extends r.Chart{constructor(e,t){super(e,S("barWithErrorBars",t,A,f,[r.LinearScale,r.CategoryScale]))}}P.id=A.id;class D extends r.LineController{getMinMax(e,r){return v(e,(e=>super.getMinMax(e,r)))}parsePrimitiveData(e,r,t,a){const n=super.parsePrimitiveData(e,r,t,a);return this.parseErrorData(n,e,r,t,a),n}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return this.parseErrorData(n,e,r,t,a),n}parseErrorData(e,r,t,a,n){C(e,r.vScale,t,a,n);const s=r.iScale;"linear"===s.type||"logarithmic"===s.type?C(e,r.iScale,t,a,n):W(e,r.iScale,a,n)}updateElement(e,r,t,a){e instanceof m&&"number"==typeof r&&this.updateElementScale(r,t,a),super.updateElement(e,r,t,a)}updateElementScale(e,r,t){s(r,this.getParsed(e),e,this._cachedMeta.vScale,"reset"===t);const a=this._cachedMeta.iScale;("linear"===a.type||"logarithmic"===a.type)&&s(r,this.getParsed(e),e,this._cachedMeta.iScale,"reset"===t)}updateElements(e,r,t,a){const n="reset"===a,s=this.chart._animationsDisabled||n||"none"===a;if(super.updateElements(e,r,t,a),s)for(let n=r;n<r+t;++n){const r=e[n];r instanceof m&&this.updateElementScale(n,r,a)}}}D.id="lineWithErrorBars",D.defaults=t.merge({},[r.LineController.defaults,b,{dataElementType:m.id}]),D.overrides=t.merge({},[r.LineController.overrides,{plugins:{tooltip:{callbacks:{label:g}}}}]),D.defaultRoutes=r.LineController.defaultRoutes;class k extends r.Chart{constructor(e,t){super(e,S("lineWithErrorBars",t,D,m,[r.LinearScale,r.CategoryScale]))}}k.id=D.id;class T extends r.ScatterController{getMinMax(e,r){return v(e,(e=>super.getMinMax(e,r)))}parsePrimitiveData(e,r,t,a){const n=super.parsePrimitiveData(e,r,t,a);return this.parseErrorData(n,e,r,t,a),n}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return this.parseErrorData(n,e,r,t,a),n}parseErrorData(e,r,t,a,n){C(e,r.xScale,t,a,n),C(e,r.yScale,t,a,n)}updateElement(e,r,t,a){e instanceof m&&"number"==typeof r&&this.updateElementScale(r,t,a),super.updateElement(e,r,t,a)}updateElementScale(e,r,t){s(r,this.getParsed(e),e,this._cachedMeta.xScale,"reset"===t),s(r,this.getParsed(e),e,this._cachedMeta.yScale,"reset"===t)}updateElements(e,r,t,a){const n="reset"===a,s=this.chart._animationsDisabled||n||"none"===a;if(super.updateElements(e,r,t,a),s)for(let n=r;n<r+t;++n){const r=e[n];r instanceof m&&this.updateElementScale(n,r,a)}}}T.id="scatterWithErrorBars",T.defaults=t.merge({},[r.ScatterController.defaults,b,{dataElementType:m.id}]),T.overrides=t.merge({},[r.ScatterController.overrides,{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} [${x(r[a[0]])} .. ${r[a[1]]}]`};return`(${t(e.label,!0)}, ${t(e.parsed.y,!1)})`}}}}}]),T.defaultRoutes=r.LineController.defaultRoutes;class $ extends r.Chart{constructor(e,t){super(e,S("scatterWithErrorBars",t,T,m,[r.LinearScale]))}}$.id=T.id;class L extends r.PolarAreaController{getMinMaxImpl(e){const r=this._cachedMeta,t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return r.data.forEach(((r,a)=>{const n=this.getParsed(a)[e.axis];!Number.isNaN(n)&&this.chart.getDataVisibility(a)&&(n<t.min&&(t.min=n),n>t.max&&(t.max=n))})),t}getMinMax(e){return v(e,(e=>this.getMinMaxImpl(e)))}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)}parsePrimitiveData(e,r,t,a){const n=super.parsePrimitiveData(e,r,t,a);return this.parseErrorData(n,e,r,t,a),n}parseObjectData(e,r,t,a){const n=super.parseObjectData(e,r,t,a);return this.parseErrorData(n,e,r,t,a),n}parseErrorData(e,r,t,a,n){const s=r.rScale;for(let r=0;r<n;r+=1){const n=r+a,o=t[n],i=s.parse(o[s.axis],n);e[r]={[s.axis]:i}}C(e,s,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):e[t]="number"==typeof a?i(a):null}}(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,b,{dataElementType:y.id}]),L.overrides=t.merge({},[r.PolarAreaController.overrides,{plugins:{tooltip:{callbacks:{label:function(e){const t=r.PolarAreaController.overrides.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} [${x(a[n[0]])} .. ${a[n[1]]}]`}}}}}]),L.defaultRoutes=r.PolarAreaController.defaultRoutes;class R extends r.Chart{constructor(e,t){super(e,S("polarAreaWithErrorBars",t,L,y,[r.RadialLinearScale]))}}R.id=L.id,r.registry.addControllers(A,D,L,T),r.registry.addElements(f,y,m),e.ArcWithErrorBar=y,e.BarWithErrorBar=f,e.BarWithErrorBarsChart=P,e.BarWithErrorBarsController=A,e.LineWithErrorBarsChart=k,e.LineWithErrorBarsController=D,e.PointWithErrorBar=m,e.PolarAreaWithErrorBarsChart=R,e.PolarAreaWithErrorBarsController=L,e.ScatterWithErrorBarsChart=$,e.ScatterWithErrorBarsController=T,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.9.1", | ||
"version": "3.9.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Samuel Gratzl", |
@@ -36,4 +36,21 @@ import { | ||
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
protected parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
protected parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
private parseErrorData( | ||
parsed: Record<string, unknown>[], | ||
meta: ChartMeta, | ||
data: any[], | ||
start: number, | ||
count: number | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
@@ -43,3 +60,2 @@ parseErrorNumberData(parsed, meta.vScale!, data, start, count); | ||
parseErrorLabelData(parsed, meta.iScale!, start, count); | ||
return parsed; | ||
} | ||
@@ -46,0 +62,0 @@ |
@@ -68,6 +68,6 @@ import type { Scale } from 'chart.js'; | ||
if (Array.isArray(vm)) { | ||
return op(...vm); | ||
return op(v, ...vm); | ||
} | ||
if (typeof vm === 'number') { | ||
return vm; | ||
return op(v, vm); | ||
} | ||
@@ -86,4 +86,4 @@ return v; | ||
const p = parsed[i]; | ||
p[vMin] = data[index][vMin]; | ||
p[vMax] = data[index][vMax]; | ||
p[vMin] = typeof data[index] === 'object' ? data[index][vMin] : null; | ||
p[vMax] = typeof data[index] === 'object' ? data[index][vMax] : null; | ||
p[vMinMin] = computeExtrema(p[axis], p[vMin], Math.min); | ||
@@ -90,0 +90,0 @@ p[vMaxMax] = computeExtrema(p[axis], p[vMax], Math.max); |
@@ -36,4 +36,21 @@ import { | ||
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
protected parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
protected parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
private parseErrorData( | ||
parsed: Record<string, unknown>[], | ||
meta: ChartMeta, | ||
data: any[], | ||
start: number, | ||
count: number | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
@@ -49,3 +66,2 @@ parseErrorNumberData(parsed, meta.vScale!, data, start, count); | ||
} | ||
return parsed; | ||
} | ||
@@ -52,0 +68,0 @@ |
@@ -79,5 +79,21 @@ import { | ||
// eslint-disable-next-line class-methods-use-this | ||
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = new Array(count); | ||
protected parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
protected parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
private parseErrorData( | ||
parsed: Record<string, unknown>[], | ||
meta: ChartMeta, | ||
data: any[], | ||
start: number, | ||
count: number | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
@@ -94,3 +110,2 @@ const scale = meta.rScale!; | ||
parseErrorNumberData(parsed, scale, data, start, count); | ||
return parsed; | ||
} | ||
@@ -97,0 +112,0 @@ |
@@ -30,4 +30,21 @@ import { | ||
parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
protected parsePrimitiveData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = super.parsePrimitiveData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
protected parseObjectData(meta: ChartMeta, data: any[], start: number, count: number): Record<string, unknown>[] { | ||
const parsed = super.parseObjectData(meta, data, start, count); | ||
this.parseErrorData(parsed, meta, data, start, count); | ||
return parsed; | ||
} | ||
private parseErrorData( | ||
parsed: Record<string, unknown>[], | ||
meta: ChartMeta, | ||
data: any[], | ||
start: number, | ||
count: number | ||
) { | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
@@ -37,3 +54,2 @@ parseErrorNumberData(parsed, meta.xScale!, data, start, count); | ||
parseErrorNumberData(parsed, meta.yScale!, data, start, count); | ||
return parsed; | ||
} | ||
@@ -40,0 +56,0 @@ |
@@ -29,2 +29,4 @@ import type { LinearScale, RadialLinearScale } from 'chart.js'; | ||
properties[key] = reset ? base : scale.getPixelForValue(v, index); | ||
} else { | ||
properties[key] = null; // reset | ||
} | ||
@@ -60,4 +62,6 @@ } | ||
properties[key] = toAngle(v); | ||
} else { | ||
properties[key] = null; // reset | ||
} | ||
} | ||
} |
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
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
278718
3850