chartjs-plugin-dragdata
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -5,3 +5,3 @@ (function (global, factory) { | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.index = factory(global.Chart)); | ||
}(this, (function (chart_js) { 'use strict'; | ||
})(this, (function (chart_js) { 'use strict'; | ||
@@ -153,6 +153,10 @@ var noop = {value: () => {}}; | ||
// Given something array like (or null), returns something that is strictly an | ||
// array. This is used to ensure that array-like objects passed to d3.selectAll | ||
// or selection.selectAll are converted into proper arrays when creating a | ||
// selection; we don’t ever want to create a selection backed by a live | ||
// HTMLCollection or NodeList. However, note that selection.selectAll will use a | ||
// static NodeList as a group, since it safely derived from querySelectorAll. | ||
function array(x) { | ||
return typeof x === "object" && "length" in x | ||
? x // Array, TypedArray, NodeList, array-like | ||
: Array.from(x); // Map, Set, iterable, string, or anything else | ||
return x == null ? [] : Array.isArray(x) ? x : Array.from(x); | ||
} | ||
@@ -172,4 +176,3 @@ | ||
return function() { | ||
var group = select.apply(this, arguments); | ||
return group == null ? [] : array(group); | ||
return array(select.apply(this, arguments)); | ||
}; | ||
@@ -226,3 +229,3 @@ } | ||
function children() { | ||
return this.children; | ||
return Array.from(this.children); | ||
} | ||
@@ -372,3 +375,3 @@ | ||
groupLength = group.length, | ||
data = array(value.call(parent, parent && parent.__data__, j, parents)), | ||
data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), | ||
dataLength = data.length, | ||
@@ -399,2 +402,14 @@ enterGroup = enter[j] = new Array(dataLength), | ||
// Given some data, this returns an array-like view of it: an object that | ||
// exposes a length property and allows numeric indexing. Note that unlike | ||
// selectAll, this isn’t worried about “live” collections because the resulting | ||
// array will only be used briefly while data is being bound. (It is possible to | ||
// cause the data to change while iterating by using a key function, but please | ||
// don’t; we’d rather avoid a gratuitous copy.) | ||
function arraylike(data) { | ||
return typeof data === "object" && "length" in data | ||
? data // Array, TypedArray, NodeList, array-like | ||
: Array.from(data); // Map, Set, iterable, string, or anything else | ||
} | ||
function selection_exit() { | ||
@@ -406,4 +421,12 @@ return new Selection(this._exit || this._groups.map(sparse), this._parents); | ||
var enter = this.enter(), update = this, exit = this.exit(); | ||
enter = typeof onenter === "function" ? onenter(enter) : enter.append(onenter + ""); | ||
if (onupdate != null) update = onupdate(update); | ||
if (typeof onenter === "function") { | ||
enter = onenter(enter); | ||
if (enter) enter = enter.selection(); | ||
} else { | ||
enter = enter.append(onenter + ""); | ||
} | ||
if (onupdate != null) { | ||
update = onupdate(update); | ||
if (update) update = update.selection(); | ||
} | ||
if (onexit == null) exit.remove(); else onexit(exit); | ||
@@ -413,4 +436,4 @@ return enter && update ? enter.merge(update).order() : update; | ||
function selection_merge(selection) { | ||
if (!(selection instanceof Selection)) throw new Error("invalid merge"); | ||
function selection_merge(context) { | ||
var selection = context.selection ? context.selection() : context; | ||
@@ -1020,2 +1043,7 @@ for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { | ||
// These are typically used in conjunction with noevent to ensure that we can | ||
// preventDefault on the event. | ||
const nonpassive = {passive: false}; | ||
const nonpassivecapture = {capture: true, passive: false}; | ||
function nopropagation(event) { | ||
@@ -1032,5 +1060,5 @@ event.stopImmediatePropagation(); | ||
var root = view.document.documentElement, | ||
selection = select(view).on("dragstart.drag", noevent, true); | ||
selection = select(view).on("dragstart.drag", noevent, nonpassivecapture); | ||
if ("onselectstart" in root) { | ||
selection.on("selectstart.drag", noevent, true); | ||
selection.on("selectstart.drag", noevent, nonpassivecapture); | ||
} else { | ||
@@ -1046,3 +1074,3 @@ root.__noselect = root.style.MozUserSelect; | ||
if (noclick) { | ||
selection.on("click.drag", noevent, true); | ||
selection.on("click.drag", noevent, nonpassivecapture); | ||
setTimeout(function() { selection.on("click.drag", null); }, 0); | ||
@@ -1125,3 +1153,3 @@ } | ||
.on("touchstart.drag", touchstarted) | ||
.on("touchmove.drag", touchmoved) | ||
.on("touchmove.drag", touchmoved, nonpassive) | ||
.on("touchend.drag touchcancel.drag", touchended) | ||
@@ -1136,3 +1164,5 @@ .style("touch-action", "none") | ||
if (!gesture) return; | ||
select(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true); | ||
select(event.view) | ||
.on("mousemove.drag", mousemoved, nonpassivecapture) | ||
.on("mouseup.drag", mouseupped, nonpassivecapture); | ||
nodrag(event.view); | ||
@@ -1226,3 +1256,3 @@ nopropagation(event); | ||
case "start": gestures[identifier] = gesture, n = active++; break; | ||
case "end": delete gestures[identifier], --active; // nobreak | ||
case "end": delete gestures[identifier], --active; // falls through | ||
case "drag": p = pointer(touch || event, container), n = active; break; | ||
@@ -1433,3 +1463,3 @@ } | ||
if (type === 'radar') { | ||
if (type === 'radar' || type === 'polarArea') { | ||
dataPoint = calcRadar(e, chartInstance); | ||
@@ -1518,2 +1548,2 @@ } else if (stacked) { | ||
}))); | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js"],n):(t="undefined"!=typeof globalThis?globalThis:t||self).index=n(t.Chart)}(this,(function(t){"use strict";var n={value:()=>{}};function e(){for(var t,n=0,e=arguments.length,i={};n<e;++n){if(!(t=arguments[n]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function i(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function o(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function a(t,e,r){for(var i=0,o=t.length;i<o;++i)if(t[i].name===e){t[i]=n,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:e,value:r}),t}r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r=this._,u=i(t+"",r),s=-1,c=u.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<c;)if(e=(t=u[s]).type)r[e]=a(r[e],t.name,n);else if(null==n)for(e in r)r[e]=a(r[e],t.name,null);return this}for(;++s<c;)if((e=(t=u[s]).type)&&(e=o(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new r(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var u="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function c(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),s.hasOwnProperty(n)?{space:s[n],local:t}:t}function l(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===u&&n.documentElement.namespaceURI===u?n.createElement(t):n.createElementNS(e,t)}}function f(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function h(t){var n=c(t);return(n.local?f:l)(n)}function p(){}function d(t){return null==t?p:function(){return this.querySelector(t)}}function g(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function v(){return[]}function y(t){return function(n){return n.matches(t)}}var m=Array.prototype.find;function _(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return this.children}function b(t){return new Array(t.length)}function A(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function E(t){return function(){return t}}function D(t,n,e,r,i,o){for(var a,u=0,s=n.length,c=o.length;u<c;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new A(t,o[u]);for(;u<s;++u)(a=n[u])&&(i[u]=a)}function C(t,n,e,r,i,o,a){var u,s,c,l=new Map,f=n.length,h=o.length,p=new Array(f);for(u=0;u<f;++u)(s=n[u])&&(p[u]=c=a.call(s,s.__data__,u,n)+"",l.has(c)?i[u]=s:l.set(c,s));for(u=0;u<h;++u)c=a.call(t,o[u],u,o)+"",(s=l.get(c))?(r[u]=s,s.__data__=o[u],l.delete(c)):e[u]=new A(t,o[u]);for(u=0;u<f;++u)(s=n[u])&&l.get(p[u])===s&&(i[u]=s)}function S(t){return t.__data__}function M(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function N(t){return function(){this.removeAttribute(t)}}function P(t){return function(){this.removeAttributeNS(t.space,t.local)}}function T(t,n){return function(){this.setAttribute(t,n)}}function B(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function k(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function R(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function j(t){return function(){this.style.removeProperty(t)}}function L(t,n,e){return function(){this.style.setProperty(t,n,e)}}function O(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function V(t,n){return t.style.getPropertyValue(n)||R(t).getComputedStyle(t,null).getPropertyValue(n)}function X(t){return function(){delete this[t]}}function q(t,n){return function(){this[t]=n}}function Y(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function U(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new z(t)}function z(t){this._node=t,this._names=U(t.getAttribute("class")||"")}function H(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function G(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function K(t){return function(){H(this,t)}}function J(t){return function(){G(this,t)}}function Q(t,n){return function(){(n.apply(this,arguments)?H:G)(this,t)}}function W(){this.textContent=""}function Z(t){return function(){this.textContent=t}}function $(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function tt(){this.innerHTML=""}function nt(t){return function(){this.innerHTML=t}}function et(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function rt(){this.nextSibling&&this.parentNode.appendChild(this)}function it(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ot(){return null}function at(){var t=this.parentNode;t&&t.removeChild(this)}function ut(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function st(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ct(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function lt(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function ft(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function ht(t,n,e){var r=R(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function pt(t,n){return function(){return ht(this,t,n)}}function dt(t,n){return function(){return ht(this,t,n.apply(this,arguments))}}A.prototype={constructor:A,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},z.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var gt=[null];function vt(t,n){this._groups=t,this._parents=n}function yt(t){return"string"==typeof t?new vt([[document.querySelector(t)]],[document.documentElement]):new vt([[t]],gt)}function mt(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}function _t(t){t.stopImmediatePropagation()}function wt(t){t.preventDefault(),t.stopImmediatePropagation()}vt.prototype={constructor:vt,select:function(t){"function"!=typeof t&&(t=d(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],s=u.length,c=r[i]=new Array(s),l=0;l<s;++l)(o=u[l])&&(a=t.call(o,o.__data__,l,u))&&("__data__"in o&&(a.__data__=o.__data__),c[l]=a);return new vt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);return null==n?[]:g(n)}}(t):function(t){return null==t?v:function(){return this.querySelectorAll(t)}}(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],s=u.length,c=0;c<s;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),i.push(a));return new vt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return m.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,s=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&s.push(o);return new vt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,S);var e=n?C:D,r=this._parents,i=this._groups;"function"!=typeof t&&(t=E(t));for(var o=i.length,a=new Array(o),u=new Array(o),s=new Array(o),c=0;c<o;++c){var l=r[c],f=i[c],h=f.length,p=g(t.call(l,l&&l.__data__,c,r)),d=p.length,v=u[c]=new Array(d),y=a[c]=new Array(d),m=s[c]=new Array(h);e(l,f,v,y,m,p,n);for(var _,w,x=0,b=0;x<d;++x)if(_=v[x]){for(x>=b&&(b=x+1);!(w=y[b])&&++b<d;);_._next=w||null}}return(a=new vt(a,r))._enter=u,a._exit=s,a},enter:function(){return new vt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new vt(this._exit||this._groups.map(b),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){if(!(t instanceof vt))throw new Error("invalid merge");for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var s,c=n[u],l=e[u],f=c.length,h=a[u]=new Array(f),p=0;p<f;++p)(s=c[p]||l[p])&&(h[p]=s);for(;u<r;++u)a[u]=n[u];return new vt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=M);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,c=i[o]=new Array(s),l=0;l<s;++l)(a=u[l])&&(c[l]=a);c.sort(n)}return new vt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=c(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?P:N:"function"==typeof n?e.local?I:k:e.local?B:T)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?j:"function"==typeof n?O:L)(t,n,null==e?"":e)):V(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?X:"function"==typeof n?Y:q)(t,n)):this.node()[t]},classed:function(t,n){var e=U(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?Q:n?K:J)(e,n))},text:function(t){return arguments.length?this.each(null==t?W:("function"==typeof t?$:Z)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?tt:("function"==typeof t?et:nt)(t)):this.node().innerHTML},raise:function(){return this.each(rt)},lower:function(){return this.each(it)},append:function(t){var n="function"==typeof t?t:h(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:h(t),r=null==n?ot:"function"==typeof n?n:d(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(at)},clone:function(t){return this.select(t?st:ut)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=ct(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?ft:lt,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var s,c=0,l=u.length;c<l;++c)for(r=0,s=u[c];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?dt:pt)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var xt=t=>()=>t;function bt(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:s,dy:c,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:l}})}function At(t){return!t.ctrlKey&&!t.button}function Et(){return this.parentNode}function Dt(t,n){return null==n?{x:t.x,y:t.y}:n}function Ct(){return navigator.maxTouchPoints||"ontouchstart"in this}function St(){var t,n,r,i,o=At,a=Et,u=Dt,s=Ct,c={},l=e("start","drag","end"),f=0,h=0;function p(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",y).on("touchmove.drag",m).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(e,u){if(!i&&o.call(this,e,u)){var s=w(this,a.call(this,e,u),e,u,"mouse");s&&(yt(e.view).on("mousemove.drag",g,!0).on("mouseup.drag",v,!0),function(t){var n=t.document.documentElement,e=yt(t).on("dragstart.drag",wt,!0);"onselectstart"in n?e.on("selectstart.drag",wt,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(e.view),_t(e),r=!1,t=e.clientX,n=e.clientY,s("start",e))}}function g(e){if(wt(e),!r){var i=e.clientX-t,o=e.clientY-n;r=i*i+o*o>h}c.mouse("drag",e)}function v(t){yt(t.view).on("mousemove.drag mouseup.drag",null),function(t,n){var e=t.document.documentElement,r=yt(t).on("dragstart.drag",null);n&&(r.on("click.drag",wt,!0),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,r),wt(t),c.mouse("end",t)}function y(t,n){if(o.call(this,t,n)){var e,r,i=t.changedTouches,u=a.call(this,t,n),s=i.length;for(e=0;e<s;++e)(r=w(this,u,t,n,i[e].identifier,i[e]))&&(_t(t),r("start",t,i[e]))}}function m(t){var n,e,r=t.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(wt(t),e("drag",t,r[n]))}function _(t){var n,e,r=t.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout((function(){i=null}),500),n=0;n<o;++n)(e=c[r[n].identifier])&&(_t(t),e("end",t,r[n]))}function w(t,n,e,r,i,o){var a,s,h,d=l.copy(),g=mt(o||e,n);if(null!=(h=u.call(t,new bt("beforestart",{sourceEvent:e,target:p,identifier:i,active:f,x:g[0],y:g[1],dx:0,dy:0,dispatch:d}),r)))return a=h.x-g[0]||0,s=h.y-g[1]||0,function e(o,u,l){var v,y=g;switch(o){case"start":c[i]=e,v=f++;break;case"end":delete c[i],--f;case"drag":g=mt(l||u,n),v=f}d.call(o,t,new bt(o,{sourceEvent:u,subject:h,target:p,identifier:i,active:v,x:g[0]+a,y:g[1]+s,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:d}),r)}}return p.filter=function(t){return arguments.length?(o="function"==typeof t?t:xt(!!t),p):o},p.container=function(t){return arguments.length?(a="function"==typeof t?t:xt(t),p):a},p.subject=function(t){return arguments.length?(u="function"==typeof t?t:xt(t),p):u},p.touchable=function(t){return arguments.length?(s="function"==typeof t?t:xt(!!t),p):s},p.on=function(){var t=l.on.apply(l,arguments);return t===l?p:t},p.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,p):Math.sqrt(h)},p}let Mt,Nt,Pt,Tt,Bt,kt,It,Rt,jt,Lt;bt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};let Ot=!1;function Vt(t,n){return isNaN(n)?t:Math.round(t*Math.pow(10,n))/Math.pow(10,n)}function Xt(t,n,e,r,i){let o,a;const u=n.data.datasets[e].data[r];if(t.touches?(o=n.scales[Pt].getValueForPixel(t.touches[0].clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Nt].getValueForPixel(t.touches[0].clientY-n.canvas.getBoundingClientRect().top)):(o=n.scales[Pt].getValueForPixel(t.clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Nt].getValueForPixel(t.clientY-n.canvas.getBoundingClientRect().top)),o=Vt(o,n.config.options.plugins.dragData.round),a=Vt(a,n.config.options.plugins.dragData.round),o=o>n.scales[Pt].max?n.scales[Pt].max:o,o=o<n.scales[Pt].min?n.scales[Pt].min:o,a=a>n.scales[Nt].max?n.scales[Nt].max:a,a=a<n.scales[Nt].min?n.scales[Nt].min:a,It){let t;t="y"===n.config.options.indexAxis?o:a;return Math.abs(t-u[0])<=Math.abs(t-u[1])?[t,u[1]]:[u[0],t]}return void 0!==u.x&&n.config.options.plugins.dragData.dragX&&(u.x=o),void 0!==u.y?(!1!==n.config.options.plugins.dragData.dragY&&(u.y=a),u):"y"===n.config.options.indexAxis?o:a}const qt=(t,n,e,r)=>{if(Mt){jt=Mt.datasetIndex,Lt=Mt.index,Ot=!0;let i=n.data.datasets[jt].data[Lt];if("radar"===Bt)i=function(t,n){let e,r,i;t.touches?(e=t.touches[0].clientX-n.canvas.getBoundingClientRect().left,r=t.touches[0].clientY-n.canvas.getBoundingClientRect().top):(e=t.clientX-n.canvas.getBoundingClientRect().left,r=t.clientY-n.canvas.getBoundingClientRect().top);let o=n.scales[Tt],a=Math.sqrt(Math.pow(e-o.xCenter,2)+Math.pow(r-o.yCenter,2)),u=o.drawingArea/(o.max-o.min);return i=o.options.ticks.reverse?o.max-a/u:o.min+a/u,i=Vt(i,n.config.options.plugins.dragData.round),i=i>n.scales[Tt].max?n.scales[Tt].max:i,i=i<n.scales[Tt].min?n.scales[Tt].min:i,i}(t,n);else if(kt){i=Vt(Xt(t,n,jt,Lt)-Rt,e.round)}else i=Xt(t,n,jt,Lt);(void 0===e.showTooltip||e.showTooltip)&&n.tooltip.setActiveElements([Mt],{x:Mt.element.x,y:Mt.element.y}),(!r||"function"==typeof r&&!1!==r(t,jt,Lt,i))&&(n.data.datasets[jt].data[Lt]=i,n.update("none"))}};const Yt={id:"dragdata",afterInit:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData){const n=t.config.options.plugins.dragData;yt(t.canvas).call(St().container(t.canvas).on("start",(e=>((t,n,e)=>{if(Mt=n.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1)[0],Bt=n.config.type,Mt){let r=Mt.datasetIndex,i=Mt.index;const o=n.data.datasets[r],a=n.getDatasetMeta(r);let u=o.data[i];if(Pt=a.xAxisID,Nt=a.yAxisID,Tt=a.rAxisID,!1===o.dragData||n.config.options.scales[Pt]&&!1===n.config.options.scales[Pt].dragData||n.config.options.scales[Nt]&&!1===n.config.options.scales[Nt].dragData||n.config.options.scales[Tt]&&!1===n.config.options.scales[Tt].rAxisID||!1===o.data[Mt.index].dragData)return void(Mt=null);if("bar"===Bt){kt=n.config.options.scales[Pt].stacked;const e=n.data.datasets[0].data[0];It=null!==e&&Array.isArray(e)&&2==e.length;let o=Xt(t,n,r,i);Rt=o-u}"function"==typeof e&&Mt&&!1===e(t,r,i,u)&&(Mt=null)}})(e.sourceEvent,t,n.onDragStart))).on("drag",(e=>qt(e.sourceEvent,t,n,n.onDrag))).on("end",(e=>((t,n,e)=>{if(Lt=void 0,Ot=!1,"function"==typeof e&&Mt){const r=Mt.datasetIndex,i=Mt.index;return e(t,r,i,function(t,n,e){const r=t.config.options.plugins.dragData;if(!r.magnet)return t.data.datasets[n].data[e];{const i=r.magnet;if(i.to&&"function"==typeof i.to){let r=t.data.datasets[n].data[e];return r=i.to(r),t.data.datasets[n].data[e]=r,t.update("none"),r}}}(n,r,i))}})(e.sourceEvent,t,n.onDragEnd))))}},beforeEvent:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData&&t.config.options.plugins.dragData.showTooltip&&Ot)return!1}};return t.Chart.register(Yt),Yt})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js"],n):(t="undefined"!=typeof globalThis?globalThis:t||self).index=n(t.Chart)}(this,(function(t){"use strict";var n={value:()=>{}};function e(){for(var t,n=0,e=arguments.length,i={};n<e;++n){if(!(t=arguments[n]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function i(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function o(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function a(t,e,r){for(var i=0,o=t.length;i<o;++i)if(t[i].name===e){t[i]=n,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:e,value:r}),t}r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r=this._,u=i(t+"",r),s=-1,c=u.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<c;)if(e=(t=u[s]).type)r[e]=a(r[e],t.name,n);else if(null==n)for(e in r)r[e]=a(r[e],t.name,null);return this}for(;++s<c;)if((e=(t=u[s]).type)&&(e=o(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new r(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var u="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function c(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),s.hasOwnProperty(n)?{space:s[n],local:t}:t}function l(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===u&&n.documentElement.namespaceURI===u?n.createElement(t):n.createElementNS(e,t)}}function f(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function h(t){var n=c(t);return(n.local?f:l)(n)}function p(){}function d(t){return null==t?p:function(){return this.querySelector(t)}}function g(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function v(){return[]}function y(t){return function(n){return n.matches(t)}}var m=Array.prototype.find;function _(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return Array.from(this.children)}function b(t){return new Array(t.length)}function A(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function E(t){return function(){return t}}function D(t,n,e,r,i,o){for(var a,u=0,s=n.length,c=o.length;u<c;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new A(t,o[u]);for(;u<s;++u)(a=n[u])&&(i[u]=a)}function C(t,n,e,r,i,o,a){var u,s,c,l=new Map,f=n.length,h=o.length,p=new Array(f);for(u=0;u<f;++u)(s=n[u])&&(p[u]=c=a.call(s,s.__data__,u,n)+"",l.has(c)?i[u]=s:l.set(c,s));for(u=0;u<h;++u)c=a.call(t,o[u],u,o)+"",(s=l.get(c))?(r[u]=s,s.__data__=o[u],l.delete(c)):e[u]=new A(t,o[u]);for(u=0;u<f;++u)(s=n[u])&&l.get(p[u])===s&&(i[u]=s)}function S(t){return t.__data__}function M(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function N(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function P(t){return function(){this.removeAttribute(t)}}function T(t){return function(){this.removeAttributeNS(t.space,t.local)}}function B(t,n){return function(){this.setAttribute(t,n)}}function k(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function R(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function j(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function L(t){return function(){this.style.removeProperty(t)}}function O(t,n,e){return function(){this.style.setProperty(t,n,e)}}function V(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function X(t,n){return t.style.getPropertyValue(n)||j(t).getComputedStyle(t,null).getPropertyValue(n)}function q(t){return function(){delete this[t]}}function Y(t,n){return function(){this[t]=n}}function U(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function F(t){return t.trim().split(/^|\s+/)}function z(t){return t.classList||new H(t)}function H(t){this._node=t,this._names=F(t.getAttribute("class")||"")}function G(t,n){for(var e=z(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function K(t,n){for(var e=z(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function J(t){return function(){G(this,t)}}function Q(t){return function(){K(this,t)}}function W(t,n){return function(){(n.apply(this,arguments)?G:K)(this,t)}}function Z(){this.textContent=""}function $(t){return function(){this.textContent=t}}function tt(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function nt(){this.innerHTML=""}function et(t){return function(){this.innerHTML=t}}function rt(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function it(){this.nextSibling&&this.parentNode.appendChild(this)}function ot(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function at(){return null}function ut(){var t=this.parentNode;t&&t.removeChild(this)}function st(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ct(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function lt(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function ft(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function ht(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function pt(t,n,e){var r=j(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function dt(t,n){return function(){return pt(this,t,n)}}function gt(t,n){return function(){return pt(this,t,n.apply(this,arguments))}}A.prototype={constructor:A,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},H.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var vt=[null];function yt(t,n){this._groups=t,this._parents=n}function mt(t){return"string"==typeof t?new yt([[document.querySelector(t)]],[document.documentElement]):new yt([[t]],vt)}function _t(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}yt.prototype={constructor:yt,select:function(t){"function"!=typeof t&&(t=d(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],s=u.length,c=r[i]=new Array(s),l=0;l<s;++l)(o=u[l])&&(a=t.call(o,o.__data__,l,u))&&("__data__"in o&&(a.__data__=o.__data__),c[l]=a);return new yt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return g(t.apply(this,arguments))}}(t):function(t){return null==t?v:function(){return this.querySelectorAll(t)}}(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],s=u.length,c=0;c<s;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),i.push(a));return new yt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return m.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,s=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&s.push(o);return new yt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,S);var e=n?C:D,r=this._parents,i=this._groups;"function"!=typeof t&&(t=E(t));for(var o=i.length,a=new Array(o),u=new Array(o),s=new Array(o),c=0;c<o;++c){var l=r[c],f=i[c],h=f.length,p=M(t.call(l,l&&l.__data__,c,r)),d=p.length,g=u[c]=new Array(d),v=a[c]=new Array(d),y=s[c]=new Array(h);e(l,f,g,v,y,p,n);for(var m,_,w=0,x=0;w<d;++w)if(m=g[w]){for(w>=x&&(x=w+1);!(_=v[x])&&++x<d;);m._next=_||null}}return(a=new yt(a,r))._enter=u,a._exit=s,a},enter:function(){return new yt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new yt(this._exit||this._groups.map(b),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),u=new Array(i),s=0;s<a;++s)for(var c,l=e[s],f=r[s],h=l.length,p=u[s]=new Array(h),d=0;d<h;++d)(c=l[d]||f[d])&&(p[d]=c);for(;s<i;++s)u[s]=e[s];return new yt(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=N);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,c=i[o]=new Array(s),l=0;l<s;++l)(a=u[l])&&(c[l]=a);c.sort(n)}return new yt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=c(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?T:P:"function"==typeof n?e.local?R:I:e.local?k:B)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?L:"function"==typeof n?V:O)(t,n,null==e?"":e)):X(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?q:"function"==typeof n?U:Y)(t,n)):this.node()[t]},classed:function(t,n){var e=F(t+"");if(arguments.length<2){for(var r=z(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?W:n?J:Q)(e,n))},text:function(t){return arguments.length?this.each(null==t?Z:("function"==typeof t?tt:$)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?nt:("function"==typeof t?rt:et)(t)):this.node().innerHTML},raise:function(){return this.each(it)},lower:function(){return this.each(ot)},append:function(t){var n="function"==typeof t?t:h(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:h(t),r=null==n?at:"function"==typeof n?n:d(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(ut)},clone:function(t){return this.select(t?ct:st)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=lt(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?ht:ft,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var s,c=0,l=u.length;c<l;++c)for(r=0,s=u[c];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?gt:dt)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};const wt={passive:!1},xt={capture:!0,passive:!1};function bt(t){t.stopImmediatePropagation()}function At(t){t.preventDefault(),t.stopImmediatePropagation()}var Et=t=>()=>t;function Dt(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:s,dy:c,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:l}})}function Ct(t){return!t.ctrlKey&&!t.button}function St(){return this.parentNode}function Mt(t,n){return null==n?{x:t.x,y:t.y}:n}function Nt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pt(){var t,n,r,i,o=Ct,a=St,u=Mt,s=Nt,c={},l=e("start","drag","end"),f=0,h=0;function p(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",y).on("touchmove.drag",m,wt).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(e,u){if(!i&&o.call(this,e,u)){var s=w(this,a.call(this,e,u),e,u,"mouse");s&&(mt(e.view).on("mousemove.drag",g,xt).on("mouseup.drag",v,xt),function(t){var n=t.document.documentElement,e=mt(t).on("dragstart.drag",At,xt);"onselectstart"in n?e.on("selectstart.drag",At,xt):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(e.view),bt(e),r=!1,t=e.clientX,n=e.clientY,s("start",e))}}function g(e){if(At(e),!r){var i=e.clientX-t,o=e.clientY-n;r=i*i+o*o>h}c.mouse("drag",e)}function v(t){mt(t.view).on("mousemove.drag mouseup.drag",null),function(t,n){var e=t.document.documentElement,r=mt(t).on("dragstart.drag",null);n&&(r.on("click.drag",At,xt),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,r),At(t),c.mouse("end",t)}function y(t,n){if(o.call(this,t,n)){var e,r,i=t.changedTouches,u=a.call(this,t,n),s=i.length;for(e=0;e<s;++e)(r=w(this,u,t,n,i[e].identifier,i[e]))&&(bt(t),r("start",t,i[e]))}}function m(t){var n,e,r=t.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(At(t),e("drag",t,r[n]))}function _(t){var n,e,r=t.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout((function(){i=null}),500),n=0;n<o;++n)(e=c[r[n].identifier])&&(bt(t),e("end",t,r[n]))}function w(t,n,e,r,i,o){var a,s,h,d=l.copy(),g=_t(o||e,n);if(null!=(h=u.call(t,new Dt("beforestart",{sourceEvent:e,target:p,identifier:i,active:f,x:g[0],y:g[1],dx:0,dy:0,dispatch:d}),r)))return a=h.x-g[0]||0,s=h.y-g[1]||0,function e(o,u,l){var v,y=g;switch(o){case"start":c[i]=e,v=f++;break;case"end":delete c[i],--f;case"drag":g=_t(l||u,n),v=f}d.call(o,t,new Dt(o,{sourceEvent:u,subject:h,target:p,identifier:i,active:v,x:g[0]+a,y:g[1]+s,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:d}),r)}}return p.filter=function(t){return arguments.length?(o="function"==typeof t?t:Et(!!t),p):o},p.container=function(t){return arguments.length?(a="function"==typeof t?t:Et(t),p):a},p.subject=function(t){return arguments.length?(u="function"==typeof t?t:Et(t),p):u},p.touchable=function(t){return arguments.length?(s="function"==typeof t?t:Et(!!t),p):s},p.on=function(){var t=l.on.apply(l,arguments);return t===l?p:t},p.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,p):Math.sqrt(h)},p}let Tt,Bt,kt,It,Rt,jt,Lt,Ot,Vt,Xt;Dt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};let qt=!1;function Yt(t,n){return isNaN(n)?t:Math.round(t*Math.pow(10,n))/Math.pow(10,n)}function Ut(t,n,e,r,i){let o,a;const u=n.data.datasets[e].data[r];if(t.touches?(o=n.scales[kt].getValueForPixel(t.touches[0].clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Bt].getValueForPixel(t.touches[0].clientY-n.canvas.getBoundingClientRect().top)):(o=n.scales[kt].getValueForPixel(t.clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Bt].getValueForPixel(t.clientY-n.canvas.getBoundingClientRect().top)),o=Yt(o,n.config.options.plugins.dragData.round),a=Yt(a,n.config.options.plugins.dragData.round),o=o>n.scales[kt].max?n.scales[kt].max:o,o=o<n.scales[kt].min?n.scales[kt].min:o,a=a>n.scales[Bt].max?n.scales[Bt].max:a,a=a<n.scales[Bt].min?n.scales[Bt].min:a,Lt){let t;t="y"===n.config.options.indexAxis?o:a;return Math.abs(t-u[0])<=Math.abs(t-u[1])?[t,u[1]]:[u[0],t]}return void 0!==u.x&&n.config.options.plugins.dragData.dragX&&(u.x=o),void 0!==u.y?(!1!==n.config.options.plugins.dragData.dragY&&(u.y=a),u):"y"===n.config.options.indexAxis?o:a}const Ft=(t,n,e,r)=>{if(Tt){Vt=Tt.datasetIndex,Xt=Tt.index,qt=!0;let i=n.data.datasets[Vt].data[Xt];if("radar"===Rt||"polarArea"===Rt)i=function(t,n){let e,r,i;t.touches?(e=t.touches[0].clientX-n.canvas.getBoundingClientRect().left,r=t.touches[0].clientY-n.canvas.getBoundingClientRect().top):(e=t.clientX-n.canvas.getBoundingClientRect().left,r=t.clientY-n.canvas.getBoundingClientRect().top);let o=n.scales[It],a=Math.sqrt(Math.pow(e-o.xCenter,2)+Math.pow(r-o.yCenter,2)),u=o.drawingArea/(o.max-o.min);return i=o.options.ticks.reverse?o.max-a/u:o.min+a/u,i=Yt(i,n.config.options.plugins.dragData.round),i=i>n.scales[It].max?n.scales[It].max:i,i=i<n.scales[It].min?n.scales[It].min:i,i}(t,n);else if(jt){i=Yt(Ut(t,n,Vt,Xt)-Ot,e.round)}else i=Ut(t,n,Vt,Xt);(void 0===e.showTooltip||e.showTooltip)&&n.tooltip.setActiveElements([Tt],{x:Tt.element.x,y:Tt.element.y}),(!r||"function"==typeof r&&!1!==r(t,Vt,Xt,i))&&(n.data.datasets[Vt].data[Xt]=i,n.update("none"))}};const zt={id:"dragdata",afterInit:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData){const n=t.config.options.plugins.dragData;mt(t.canvas).call(Pt().container(t.canvas).on("start",(e=>((t,n,e)=>{if(Tt=n.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1)[0],Rt=n.config.type,Tt){let r=Tt.datasetIndex,i=Tt.index;const o=n.data.datasets[r],a=n.getDatasetMeta(r);let u=o.data[i];if(kt=a.xAxisID,Bt=a.yAxisID,It=a.rAxisID,!1===o.dragData||n.config.options.scales[kt]&&!1===n.config.options.scales[kt].dragData||n.config.options.scales[Bt]&&!1===n.config.options.scales[Bt].dragData||n.config.options.scales[It]&&!1===n.config.options.scales[It].rAxisID||!1===o.data[Tt.index].dragData)return void(Tt=null);if("bar"===Rt){jt=n.config.options.scales[kt].stacked;const e=n.data.datasets[0].data[0];Lt=null!==e&&Array.isArray(e)&&2==e.length;let o=Ut(t,n,r,i);Ot=o-u}"function"==typeof e&&Tt&&!1===e(t,r,i,u)&&(Tt=null)}})(e.sourceEvent,t,n.onDragStart))).on("drag",(e=>Ft(e.sourceEvent,t,n,n.onDrag))).on("end",(e=>((t,n,e)=>{if(Xt=void 0,qt=!1,"function"==typeof e&&Tt){const r=Tt.datasetIndex,i=Tt.index;return e(t,r,i,function(t,n,e){const r=t.config.options.plugins.dragData;if(!r.magnet)return t.data.datasets[n].data[e];{const i=r.magnet;if(i.to&&"function"==typeof i.to){let r=t.data.datasets[n].data[e];return r=i.to(r),t.data.datasets[n].data[e]=r,t.update("none"),r}}}(n,r,i))}})(e.sourceEvent,t,n.onDragEnd))))}},beforeEvent:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData&&t.config.options.plugins.dragData.showTooltip&&qt)return!1}};return t.Chart.register(zt),zt})); |
@@ -1,1 +0,1 @@ | ||
import{Chart as t}from"chart.js";var n={value:()=>{}};function e(){for(var t,n=0,e=arguments.length,i={};n<e;++n){if(!(t=arguments[n]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function i(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function o(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function a(t,e,r){for(var i=0,o=t.length;i<o;++i)if(t[i].name===e){t[i]=n,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:e,value:r}),t}r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r=this._,u=i(t+"",r),s=-1,c=u.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<c;)if(e=(t=u[s]).type)r[e]=a(r[e],t.name,n);else if(null==n)for(e in r)r[e]=a(r[e],t.name,null);return this}for(;++s<c;)if((e=(t=u[s]).type)&&(e=o(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new r(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var u="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function c(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),s.hasOwnProperty(n)?{space:s[n],local:t}:t}function l(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===u&&n.documentElement.namespaceURI===u?n.createElement(t):n.createElementNS(e,t)}}function f(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function h(t){var n=c(t);return(n.local?f:l)(n)}function p(){}function d(t){return null==t?p:function(){return this.querySelector(t)}}function g(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function v(){return[]}function y(t){return function(n){return n.matches(t)}}var m=Array.prototype.find;function _(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return this.children}function b(t){return new Array(t.length)}function A(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function E(t){return function(){return t}}function D(t,n,e,r,i,o){for(var a,u=0,s=n.length,c=o.length;u<c;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new A(t,o[u]);for(;u<s;++u)(a=n[u])&&(i[u]=a)}function S(t,n,e,r,i,o,a){var u,s,c,l=new Map,f=n.length,h=o.length,p=new Array(f);for(u=0;u<f;++u)(s=n[u])&&(p[u]=c=a.call(s,s.__data__,u,n)+"",l.has(c)?i[u]=s:l.set(c,s));for(u=0;u<h;++u)c=a.call(t,o[u],u,o)+"",(s=l.get(c))?(r[u]=s,s.__data__=o[u],l.delete(c)):e[u]=new A(t,o[u]);for(u=0;u<f;++u)(s=n[u])&&l.get(p[u])===s&&(i[u]=s)}function C(t){return t.__data__}function M(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function N(t){return function(){this.removeAttribute(t)}}function P(t){return function(){this.removeAttributeNS(t.space,t.local)}}function B(t,n){return function(){this.setAttribute(t,n)}}function T(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function k(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function R(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function L(t){return function(){this.style.removeProperty(t)}}function O(t,n,e){return function(){this.style.setProperty(t,n,e)}}function V(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function X(t,n){return t.style.getPropertyValue(n)||R(t).getComputedStyle(t,null).getPropertyValue(n)}function j(t){return function(){delete this[t]}}function Y(t,n){return function(){this[t]=n}}function q(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function U(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new z(t)}function z(t){this._node=t,this._names=U(t.getAttribute("class")||"")}function H(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function G(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function K(t){return function(){H(this,t)}}function J(t){return function(){G(this,t)}}function Q(t,n){return function(){(n.apply(this,arguments)?H:G)(this,t)}}function W(){this.textContent=""}function Z(t){return function(){this.textContent=t}}function $(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function tt(){this.innerHTML=""}function nt(t){return function(){this.innerHTML=t}}function et(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function rt(){this.nextSibling&&this.parentNode.appendChild(this)}function it(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ot(){return null}function at(){var t=this.parentNode;t&&t.removeChild(this)}function ut(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function st(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ct(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function lt(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function ft(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function ht(t,n,e){var r=R(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function pt(t,n){return function(){return ht(this,t,n)}}function dt(t,n){return function(){return ht(this,t,n.apply(this,arguments))}}A.prototype={constructor:A,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},z.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var gt=[null];function vt(t,n){this._groups=t,this._parents=n}function yt(t){return"string"==typeof t?new vt([[document.querySelector(t)]],[document.documentElement]):new vt([[t]],gt)}function mt(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}function _t(t){t.stopImmediatePropagation()}function wt(t){t.preventDefault(),t.stopImmediatePropagation()}vt.prototype={constructor:vt,select:function(t){"function"!=typeof t&&(t=d(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],s=u.length,c=r[i]=new Array(s),l=0;l<s;++l)(o=u[l])&&(a=t.call(o,o.__data__,l,u))&&("__data__"in o&&(a.__data__=o.__data__),c[l]=a);return new vt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);return null==n?[]:g(n)}}(t):function(t){return null==t?v:function(){return this.querySelectorAll(t)}}(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],s=u.length,c=0;c<s;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),i.push(a));return new vt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return m.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,s=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&s.push(o);return new vt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,C);var e=n?S:D,r=this._parents,i=this._groups;"function"!=typeof t&&(t=E(t));for(var o=i.length,a=new Array(o),u=new Array(o),s=new Array(o),c=0;c<o;++c){var l=r[c],f=i[c],h=f.length,p=g(t.call(l,l&&l.__data__,c,r)),d=p.length,v=u[c]=new Array(d),y=a[c]=new Array(d),m=s[c]=new Array(h);e(l,f,v,y,m,p,n);for(var _,w,x=0,b=0;x<d;++x)if(_=v[x]){for(x>=b&&(b=x+1);!(w=y[b])&&++b<d;);_._next=w||null}}return(a=new vt(a,r))._enter=u,a._exit=s,a},enter:function(){return new vt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new vt(this._exit||this._groups.map(b),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){if(!(t instanceof vt))throw new Error("invalid merge");for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var s,c=n[u],l=e[u],f=c.length,h=a[u]=new Array(f),p=0;p<f;++p)(s=c[p]||l[p])&&(h[p]=s);for(;u<r;++u)a[u]=n[u];return new vt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=M);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,c=i[o]=new Array(s),l=0;l<s;++l)(a=u[l])&&(c[l]=a);c.sort(n)}return new vt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=c(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?P:N:"function"==typeof n?e.local?I:k:e.local?T:B)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?L:"function"==typeof n?V:O)(t,n,null==e?"":e)):X(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?j:"function"==typeof n?q:Y)(t,n)):this.node()[t]},classed:function(t,n){var e=U(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?Q:n?K:J)(e,n))},text:function(t){return arguments.length?this.each(null==t?W:("function"==typeof t?$:Z)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?tt:("function"==typeof t?et:nt)(t)):this.node().innerHTML},raise:function(){return this.each(rt)},lower:function(){return this.each(it)},append:function(t){var n="function"==typeof t?t:h(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:h(t),r=null==n?ot:"function"==typeof n?n:d(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(at)},clone:function(t){return this.select(t?st:ut)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=ct(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?ft:lt,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var s,c=0,l=u.length;c<l;++c)for(r=0,s=u[c];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?dt:pt)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var xt=t=>()=>t;function bt(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:s,dy:c,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:l}})}function At(t){return!t.ctrlKey&&!t.button}function Et(){return this.parentNode}function Dt(t,n){return null==n?{x:t.x,y:t.y}:n}function St(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ct(){var t,n,r,i,o=At,a=Et,u=Dt,s=St,c={},l=e("start","drag","end"),f=0,h=0;function p(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",y).on("touchmove.drag",m).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(e,u){if(!i&&o.call(this,e,u)){var s=w(this,a.call(this,e,u),e,u,"mouse");s&&(yt(e.view).on("mousemove.drag",g,!0).on("mouseup.drag",v,!0),function(t){var n=t.document.documentElement,e=yt(t).on("dragstart.drag",wt,!0);"onselectstart"in n?e.on("selectstart.drag",wt,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(e.view),_t(e),r=!1,t=e.clientX,n=e.clientY,s("start",e))}}function g(e){if(wt(e),!r){var i=e.clientX-t,o=e.clientY-n;r=i*i+o*o>h}c.mouse("drag",e)}function v(t){yt(t.view).on("mousemove.drag mouseup.drag",null),function(t,n){var e=t.document.documentElement,r=yt(t).on("dragstart.drag",null);n&&(r.on("click.drag",wt,!0),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,r),wt(t),c.mouse("end",t)}function y(t,n){if(o.call(this,t,n)){var e,r,i=t.changedTouches,u=a.call(this,t,n),s=i.length;for(e=0;e<s;++e)(r=w(this,u,t,n,i[e].identifier,i[e]))&&(_t(t),r("start",t,i[e]))}}function m(t){var n,e,r=t.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(wt(t),e("drag",t,r[n]))}function _(t){var n,e,r=t.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout((function(){i=null}),500),n=0;n<o;++n)(e=c[r[n].identifier])&&(_t(t),e("end",t,r[n]))}function w(t,n,e,r,i,o){var a,s,h,d=l.copy(),g=mt(o||e,n);if(null!=(h=u.call(t,new bt("beforestart",{sourceEvent:e,target:p,identifier:i,active:f,x:g[0],y:g[1],dx:0,dy:0,dispatch:d}),r)))return a=h.x-g[0]||0,s=h.y-g[1]||0,function e(o,u,l){var v,y=g;switch(o){case"start":c[i]=e,v=f++;break;case"end":delete c[i],--f;case"drag":g=mt(l||u,n),v=f}d.call(o,t,new bt(o,{sourceEvent:u,subject:h,target:p,identifier:i,active:v,x:g[0]+a,y:g[1]+s,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:d}),r)}}return p.filter=function(t){return arguments.length?(o="function"==typeof t?t:xt(!!t),p):o},p.container=function(t){return arguments.length?(a="function"==typeof t?t:xt(t),p):a},p.subject=function(t){return arguments.length?(u="function"==typeof t?t:xt(t),p):u},p.touchable=function(t){return arguments.length?(s="function"==typeof t?t:xt(!!t),p):s},p.on=function(){var t=l.on.apply(l,arguments);return t===l?p:t},p.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,p):Math.sqrt(h)},p}let Mt,Nt,Pt,Bt,Tt,kt,It,Rt,Lt,Ot;bt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};let Vt=!1;function Xt(t,n){return isNaN(n)?t:Math.round(t*Math.pow(10,n))/Math.pow(10,n)}function jt(t,n,e,r,i){let o,a;const u=n.data.datasets[e].data[r];if(t.touches?(o=n.scales[Pt].getValueForPixel(t.touches[0].clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Nt].getValueForPixel(t.touches[0].clientY-n.canvas.getBoundingClientRect().top)):(o=n.scales[Pt].getValueForPixel(t.clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Nt].getValueForPixel(t.clientY-n.canvas.getBoundingClientRect().top)),o=Xt(o,n.config.options.plugins.dragData.round),a=Xt(a,n.config.options.plugins.dragData.round),o=o>n.scales[Pt].max?n.scales[Pt].max:o,o=o<n.scales[Pt].min?n.scales[Pt].min:o,a=a>n.scales[Nt].max?n.scales[Nt].max:a,a=a<n.scales[Nt].min?n.scales[Nt].min:a,It){let t;t="y"===n.config.options.indexAxis?o:a;return Math.abs(t-u[0])<=Math.abs(t-u[1])?[t,u[1]]:[u[0],t]}return void 0!==u.x&&n.config.options.plugins.dragData.dragX&&(u.x=o),void 0!==u.y?(!1!==n.config.options.plugins.dragData.dragY&&(u.y=a),u):"y"===n.config.options.indexAxis?o:a}const Yt=(t,n,e,r)=>{if(Mt){Lt=Mt.datasetIndex,Ot=Mt.index,Vt=!0;let i=n.data.datasets[Lt].data[Ot];if("radar"===Tt)i=function(t,n){let e,r,i;t.touches?(e=t.touches[0].clientX-n.canvas.getBoundingClientRect().left,r=t.touches[0].clientY-n.canvas.getBoundingClientRect().top):(e=t.clientX-n.canvas.getBoundingClientRect().left,r=t.clientY-n.canvas.getBoundingClientRect().top);let o=n.scales[Bt],a=Math.sqrt(Math.pow(e-o.xCenter,2)+Math.pow(r-o.yCenter,2)),u=o.drawingArea/(o.max-o.min);return i=o.options.ticks.reverse?o.max-a/u:o.min+a/u,i=Xt(i,n.config.options.plugins.dragData.round),i=i>n.scales[Bt].max?n.scales[Bt].max:i,i=i<n.scales[Bt].min?n.scales[Bt].min:i,i}(t,n);else if(kt){i=Xt(jt(t,n,Lt,Ot)-Rt,e.round)}else i=jt(t,n,Lt,Ot);(void 0===e.showTooltip||e.showTooltip)&&n.tooltip.setActiveElements([Mt],{x:Mt.element.x,y:Mt.element.y}),(!r||"function"==typeof r&&!1!==r(t,Lt,Ot,i))&&(n.data.datasets[Lt].data[Ot]=i,n.update("none"))}};const qt={id:"dragdata",afterInit:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData){const n=t.config.options.plugins.dragData;yt(t.canvas).call(Ct().container(t.canvas).on("start",(e=>((t,n,e)=>{if(Mt=n.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1)[0],Tt=n.config.type,Mt){let r=Mt.datasetIndex,i=Mt.index;const o=n.data.datasets[r],a=n.getDatasetMeta(r);let u=o.data[i];if(Pt=a.xAxisID,Nt=a.yAxisID,Bt=a.rAxisID,!1===o.dragData||n.config.options.scales[Pt]&&!1===n.config.options.scales[Pt].dragData||n.config.options.scales[Nt]&&!1===n.config.options.scales[Nt].dragData||n.config.options.scales[Bt]&&!1===n.config.options.scales[Bt].rAxisID||!1===o.data[Mt.index].dragData)return void(Mt=null);if("bar"===Tt){kt=n.config.options.scales[Pt].stacked;const e=n.data.datasets[0].data[0];It=null!==e&&Array.isArray(e)&&2==e.length;let o=jt(t,n,r,i);Rt=o-u}"function"==typeof e&&Mt&&!1===e(t,r,i,u)&&(Mt=null)}})(e.sourceEvent,t,n.onDragStart))).on("drag",(e=>Yt(e.sourceEvent,t,n,n.onDrag))).on("end",(e=>((t,n,e)=>{if(Ot=void 0,Vt=!1,"function"==typeof e&&Mt){const r=Mt.datasetIndex,i=Mt.index;return e(t,r,i,function(t,n,e){const r=t.config.options.plugins.dragData;if(!r.magnet)return t.data.datasets[n].data[e];{const i=r.magnet;if(i.to&&"function"==typeof i.to){let r=t.data.datasets[n].data[e];return r=i.to(r),t.data.datasets[n].data[e]=r,t.update("none"),r}}}(n,r,i))}})(e.sourceEvent,t,n.onDragEnd))))}},beforeEvent:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData&&t.config.options.plugins.dragData.showTooltip&&Vt)return!1}};t.register(qt);export default qt; | ||
import{Chart as t}from"chart.js";var n={value:()=>{}};function e(){for(var t,n=0,e=arguments.length,i={};n<e;++n){if(!(t=arguments[n]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function i(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function o(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function a(t,e,r){for(var i=0,o=t.length;i<o;++i)if(t[i].name===e){t[i]=n,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:e,value:r}),t}r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r=this._,u=i(t+"",r),s=-1,c=u.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<c;)if(e=(t=u[s]).type)r[e]=a(r[e],t.name,n);else if(null==n)for(e in r)r[e]=a(r[e],t.name,null);return this}for(;++s<c;)if((e=(t=u[s]).type)&&(e=o(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new r(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var u="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function c(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),s.hasOwnProperty(n)?{space:s[n],local:t}:t}function l(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===u&&n.documentElement.namespaceURI===u?n.createElement(t):n.createElementNS(e,t)}}function f(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function h(t){var n=c(t);return(n.local?f:l)(n)}function p(){}function d(t){return null==t?p:function(){return this.querySelector(t)}}function g(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function v(){return[]}function y(t){return function(n){return n.matches(t)}}var m=Array.prototype.find;function _(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return Array.from(this.children)}function b(t){return new Array(t.length)}function A(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function E(t){return function(){return t}}function D(t,n,e,r,i,o){for(var a,u=0,s=n.length,c=o.length;u<c;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new A(t,o[u]);for(;u<s;++u)(a=n[u])&&(i[u]=a)}function S(t,n,e,r,i,o,a){var u,s,c,l=new Map,f=n.length,h=o.length,p=new Array(f);for(u=0;u<f;++u)(s=n[u])&&(p[u]=c=a.call(s,s.__data__,u,n)+"",l.has(c)?i[u]=s:l.set(c,s));for(u=0;u<h;++u)c=a.call(t,o[u],u,o)+"",(s=l.get(c))?(r[u]=s,s.__data__=o[u],l.delete(c)):e[u]=new A(t,o[u]);for(u=0;u<f;++u)(s=n[u])&&l.get(p[u])===s&&(i[u]=s)}function C(t){return t.__data__}function M(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function N(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function P(t){return function(){this.removeAttribute(t)}}function B(t){return function(){this.removeAttributeNS(t.space,t.local)}}function T(t,n){return function(){this.setAttribute(t,n)}}function k(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function R(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function L(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function O(t){return function(){this.style.removeProperty(t)}}function V(t,n,e){return function(){this.style.setProperty(t,n,e)}}function X(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function j(t,n){return t.style.getPropertyValue(n)||L(t).getComputedStyle(t,null).getPropertyValue(n)}function Y(t){return function(){delete this[t]}}function q(t,n){return function(){this[t]=n}}function U(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function F(t){return t.trim().split(/^|\s+/)}function z(t){return t.classList||new H(t)}function H(t){this._node=t,this._names=F(t.getAttribute("class")||"")}function G(t,n){for(var e=z(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function K(t,n){for(var e=z(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function J(t){return function(){G(this,t)}}function Q(t){return function(){K(this,t)}}function W(t,n){return function(){(n.apply(this,arguments)?G:K)(this,t)}}function Z(){this.textContent=""}function $(t){return function(){this.textContent=t}}function tt(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function nt(){this.innerHTML=""}function et(t){return function(){this.innerHTML=t}}function rt(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function it(){this.nextSibling&&this.parentNode.appendChild(this)}function ot(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function at(){return null}function ut(){var t=this.parentNode;t&&t.removeChild(this)}function st(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ct(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function lt(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function ft(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function ht(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function pt(t,n,e){var r=L(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function dt(t,n){return function(){return pt(this,t,n)}}function gt(t,n){return function(){return pt(this,t,n.apply(this,arguments))}}A.prototype={constructor:A,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},H.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var vt=[null];function yt(t,n){this._groups=t,this._parents=n}function mt(t){return"string"==typeof t?new yt([[document.querySelector(t)]],[document.documentElement]):new yt([[t]],vt)}function _t(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}yt.prototype={constructor:yt,select:function(t){"function"!=typeof t&&(t=d(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],s=u.length,c=r[i]=new Array(s),l=0;l<s;++l)(o=u[l])&&(a=t.call(o,o.__data__,l,u))&&("__data__"in o&&(a.__data__=o.__data__),c[l]=a);return new yt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return g(t.apply(this,arguments))}}(t):function(t){return null==t?v:function(){return this.querySelectorAll(t)}}(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],s=u.length,c=0;c<s;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),i.push(a));return new yt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return m.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,s=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&s.push(o);return new yt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,C);var e=n?S:D,r=this._parents,i=this._groups;"function"!=typeof t&&(t=E(t));for(var o=i.length,a=new Array(o),u=new Array(o),s=new Array(o),c=0;c<o;++c){var l=r[c],f=i[c],h=f.length,p=M(t.call(l,l&&l.__data__,c,r)),d=p.length,g=u[c]=new Array(d),v=a[c]=new Array(d),y=s[c]=new Array(h);e(l,f,g,v,y,p,n);for(var m,_,w=0,x=0;w<d;++w)if(m=g[w]){for(w>=x&&(x=w+1);!(_=v[x])&&++x<d;);m._next=_||null}}return(a=new yt(a,r))._enter=u,a._exit=s,a},enter:function(){return new yt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new yt(this._exit||this._groups.map(b),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),u=new Array(i),s=0;s<a;++s)for(var c,l=e[s],f=r[s],h=l.length,p=u[s]=new Array(h),d=0;d<h;++d)(c=l[d]||f[d])&&(p[d]=c);for(;s<i;++s)u[s]=e[s];return new yt(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=N);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,c=i[o]=new Array(s),l=0;l<s;++l)(a=u[l])&&(c[l]=a);c.sort(n)}return new yt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=c(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?B:P:"function"==typeof n?e.local?R:I:e.local?k:T)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?O:"function"==typeof n?X:V)(t,n,null==e?"":e)):j(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?Y:"function"==typeof n?U:q)(t,n)):this.node()[t]},classed:function(t,n){var e=F(t+"");if(arguments.length<2){for(var r=z(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?W:n?J:Q)(e,n))},text:function(t){return arguments.length?this.each(null==t?Z:("function"==typeof t?tt:$)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?nt:("function"==typeof t?rt:et)(t)):this.node().innerHTML},raise:function(){return this.each(it)},lower:function(){return this.each(ot)},append:function(t){var n="function"==typeof t?t:h(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:h(t),r=null==n?at:"function"==typeof n?n:d(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(ut)},clone:function(t){return this.select(t?ct:st)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=lt(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?ht:ft,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var s,c=0,l=u.length;c<l;++c)for(r=0,s=u[c];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?gt:dt)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};const wt={passive:!1},xt={capture:!0,passive:!1};function bt(t){t.stopImmediatePropagation()}function At(t){t.preventDefault(),t.stopImmediatePropagation()}var Et=t=>()=>t;function Dt(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:s,dy:c,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:l}})}function St(t){return!t.ctrlKey&&!t.button}function Ct(){return this.parentNode}function Mt(t,n){return null==n?{x:t.x,y:t.y}:n}function Nt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pt(){var t,n,r,i,o=St,a=Ct,u=Mt,s=Nt,c={},l=e("start","drag","end"),f=0,h=0;function p(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",y).on("touchmove.drag",m,wt).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(e,u){if(!i&&o.call(this,e,u)){var s=w(this,a.call(this,e,u),e,u,"mouse");s&&(mt(e.view).on("mousemove.drag",g,xt).on("mouseup.drag",v,xt),function(t){var n=t.document.documentElement,e=mt(t).on("dragstart.drag",At,xt);"onselectstart"in n?e.on("selectstart.drag",At,xt):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(e.view),bt(e),r=!1,t=e.clientX,n=e.clientY,s("start",e))}}function g(e){if(At(e),!r){var i=e.clientX-t,o=e.clientY-n;r=i*i+o*o>h}c.mouse("drag",e)}function v(t){mt(t.view).on("mousemove.drag mouseup.drag",null),function(t,n){var e=t.document.documentElement,r=mt(t).on("dragstart.drag",null);n&&(r.on("click.drag",At,xt),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,r),At(t),c.mouse("end",t)}function y(t,n){if(o.call(this,t,n)){var e,r,i=t.changedTouches,u=a.call(this,t,n),s=i.length;for(e=0;e<s;++e)(r=w(this,u,t,n,i[e].identifier,i[e]))&&(bt(t),r("start",t,i[e]))}}function m(t){var n,e,r=t.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(At(t),e("drag",t,r[n]))}function _(t){var n,e,r=t.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout((function(){i=null}),500),n=0;n<o;++n)(e=c[r[n].identifier])&&(bt(t),e("end",t,r[n]))}function w(t,n,e,r,i,o){var a,s,h,d=l.copy(),g=_t(o||e,n);if(null!=(h=u.call(t,new Dt("beforestart",{sourceEvent:e,target:p,identifier:i,active:f,x:g[0],y:g[1],dx:0,dy:0,dispatch:d}),r)))return a=h.x-g[0]||0,s=h.y-g[1]||0,function e(o,u,l){var v,y=g;switch(o){case"start":c[i]=e,v=f++;break;case"end":delete c[i],--f;case"drag":g=_t(l||u,n),v=f}d.call(o,t,new Dt(o,{sourceEvent:u,subject:h,target:p,identifier:i,active:v,x:g[0]+a,y:g[1]+s,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:d}),r)}}return p.filter=function(t){return arguments.length?(o="function"==typeof t?t:Et(!!t),p):o},p.container=function(t){return arguments.length?(a="function"==typeof t?t:Et(t),p):a},p.subject=function(t){return arguments.length?(u="function"==typeof t?t:Et(t),p):u},p.touchable=function(t){return arguments.length?(s="function"==typeof t?t:Et(!!t),p):s},p.on=function(){var t=l.on.apply(l,arguments);return t===l?p:t},p.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,p):Math.sqrt(h)},p}let Bt,Tt,kt,It,Rt,Lt,Ot,Vt,Xt,jt;Dt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};let Yt=!1;function qt(t,n){return isNaN(n)?t:Math.round(t*Math.pow(10,n))/Math.pow(10,n)}function Ut(t,n,e,r,i){let o,a;const u=n.data.datasets[e].data[r];if(t.touches?(o=n.scales[kt].getValueForPixel(t.touches[0].clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Tt].getValueForPixel(t.touches[0].clientY-n.canvas.getBoundingClientRect().top)):(o=n.scales[kt].getValueForPixel(t.clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Tt].getValueForPixel(t.clientY-n.canvas.getBoundingClientRect().top)),o=qt(o,n.config.options.plugins.dragData.round),a=qt(a,n.config.options.plugins.dragData.round),o=o>n.scales[kt].max?n.scales[kt].max:o,o=o<n.scales[kt].min?n.scales[kt].min:o,a=a>n.scales[Tt].max?n.scales[Tt].max:a,a=a<n.scales[Tt].min?n.scales[Tt].min:a,Ot){let t;t="y"===n.config.options.indexAxis?o:a;return Math.abs(t-u[0])<=Math.abs(t-u[1])?[t,u[1]]:[u[0],t]}return void 0!==u.x&&n.config.options.plugins.dragData.dragX&&(u.x=o),void 0!==u.y?(!1!==n.config.options.plugins.dragData.dragY&&(u.y=a),u):"y"===n.config.options.indexAxis?o:a}const Ft=(t,n,e,r)=>{if(Bt){Xt=Bt.datasetIndex,jt=Bt.index,Yt=!0;let i=n.data.datasets[Xt].data[jt];if("radar"===Rt||"polarArea"===Rt)i=function(t,n){let e,r,i;t.touches?(e=t.touches[0].clientX-n.canvas.getBoundingClientRect().left,r=t.touches[0].clientY-n.canvas.getBoundingClientRect().top):(e=t.clientX-n.canvas.getBoundingClientRect().left,r=t.clientY-n.canvas.getBoundingClientRect().top);let o=n.scales[It],a=Math.sqrt(Math.pow(e-o.xCenter,2)+Math.pow(r-o.yCenter,2)),u=o.drawingArea/(o.max-o.min);return i=o.options.ticks.reverse?o.max-a/u:o.min+a/u,i=qt(i,n.config.options.plugins.dragData.round),i=i>n.scales[It].max?n.scales[It].max:i,i=i<n.scales[It].min?n.scales[It].min:i,i}(t,n);else if(Lt){i=qt(Ut(t,n,Xt,jt)-Vt,e.round)}else i=Ut(t,n,Xt,jt);(void 0===e.showTooltip||e.showTooltip)&&n.tooltip.setActiveElements([Bt],{x:Bt.element.x,y:Bt.element.y}),(!r||"function"==typeof r&&!1!==r(t,Xt,jt,i))&&(n.data.datasets[Xt].data[jt]=i,n.update("none"))}};const zt={id:"dragdata",afterInit:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData){const n=t.config.options.plugins.dragData;mt(t.canvas).call(Pt().container(t.canvas).on("start",(e=>((t,n,e)=>{if(Bt=n.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1)[0],Rt=n.config.type,Bt){let r=Bt.datasetIndex,i=Bt.index;const o=n.data.datasets[r],a=n.getDatasetMeta(r);let u=o.data[i];if(kt=a.xAxisID,Tt=a.yAxisID,It=a.rAxisID,!1===o.dragData||n.config.options.scales[kt]&&!1===n.config.options.scales[kt].dragData||n.config.options.scales[Tt]&&!1===n.config.options.scales[Tt].dragData||n.config.options.scales[It]&&!1===n.config.options.scales[It].rAxisID||!1===o.data[Bt.index].dragData)return void(Bt=null);if("bar"===Rt){Lt=n.config.options.scales[kt].stacked;const e=n.data.datasets[0].data[0];Ot=null!==e&&Array.isArray(e)&&2==e.length;let o=Ut(t,n,r,i);Vt=o-u}"function"==typeof e&&Bt&&!1===e(t,r,i,u)&&(Bt=null)}})(e.sourceEvent,t,n.onDragStart))).on("drag",(e=>Ft(e.sourceEvent,t,n,n.onDrag))).on("end",(e=>((t,n,e)=>{if(jt=void 0,Yt=!1,"function"==typeof e&&Bt){const r=Bt.datasetIndex,i=Bt.index;return e(t,r,i,function(t,n,e){const r=t.config.options.plugins.dragData;if(!r.magnet)return t.data.datasets[n].data[e];{const i=r.magnet;if(i.to&&"function"==typeof i.to){let r=t.data.datasets[n].data[e];return r=i.to(r),t.data.datasets[n].data[e]=r,t.update("none"),r}}}(n,r,i))}})(e.sourceEvent,t,n.onDragEnd))))}},beforeEvent:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData&&t.config.options.plugins.dragData.showTooltip&&Yt)return!1}};t.register(zt);export{zt as default}; |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js"],n):(t="undefined"!=typeof globalThis?globalThis:t||self).index=n(t.Chart)}(this,(function(t){"use strict";var n={value:()=>{}};function e(){for(var t,n=0,e=arguments.length,i={};n<e;++n){if(!(t=arguments[n]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function i(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function o(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function a(t,e,r){for(var i=0,o=t.length;i<o;++i)if(t[i].name===e){t[i]=n,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:e,value:r}),t}r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r=this._,u=i(t+"",r),s=-1,c=u.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<c;)if(e=(t=u[s]).type)r[e]=a(r[e],t.name,n);else if(null==n)for(e in r)r[e]=a(r[e],t.name,null);return this}for(;++s<c;)if((e=(t=u[s]).type)&&(e=o(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new r(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var u="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function c(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),s.hasOwnProperty(n)?{space:s[n],local:t}:t}function l(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===u&&n.documentElement.namespaceURI===u?n.createElement(t):n.createElementNS(e,t)}}function f(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function h(t){var n=c(t);return(n.local?f:l)(n)}function p(){}function d(t){return null==t?p:function(){return this.querySelector(t)}}function g(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function v(){return[]}function y(t){return function(n){return n.matches(t)}}var m=Array.prototype.find;function _(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return this.children}function b(t){return new Array(t.length)}function A(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function E(t){return function(){return t}}function D(t,n,e,r,i,o){for(var a,u=0,s=n.length,c=o.length;u<c;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new A(t,o[u]);for(;u<s;++u)(a=n[u])&&(i[u]=a)}function C(t,n,e,r,i,o,a){var u,s,c,l=new Map,f=n.length,h=o.length,p=new Array(f);for(u=0;u<f;++u)(s=n[u])&&(p[u]=c=a.call(s,s.__data__,u,n)+"",l.has(c)?i[u]=s:l.set(c,s));for(u=0;u<h;++u)c=a.call(t,o[u],u,o)+"",(s=l.get(c))?(r[u]=s,s.__data__=o[u],l.delete(c)):e[u]=new A(t,o[u]);for(u=0;u<f;++u)(s=n[u])&&l.get(p[u])===s&&(i[u]=s)}function S(t){return t.__data__}function M(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function N(t){return function(){this.removeAttribute(t)}}function P(t){return function(){this.removeAttributeNS(t.space,t.local)}}function T(t,n){return function(){this.setAttribute(t,n)}}function B(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function k(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function R(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function j(t){return function(){this.style.removeProperty(t)}}function L(t,n,e){return function(){this.style.setProperty(t,n,e)}}function O(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function V(t,n){return t.style.getPropertyValue(n)||R(t).getComputedStyle(t,null).getPropertyValue(n)}function X(t){return function(){delete this[t]}}function q(t,n){return function(){this[t]=n}}function Y(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function U(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new z(t)}function z(t){this._node=t,this._names=U(t.getAttribute("class")||"")}function H(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function G(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function K(t){return function(){H(this,t)}}function J(t){return function(){G(this,t)}}function Q(t,n){return function(){(n.apply(this,arguments)?H:G)(this,t)}}function W(){this.textContent=""}function Z(t){return function(){this.textContent=t}}function $(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function tt(){this.innerHTML=""}function nt(t){return function(){this.innerHTML=t}}function et(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function rt(){this.nextSibling&&this.parentNode.appendChild(this)}function it(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ot(){return null}function at(){var t=this.parentNode;t&&t.removeChild(this)}function ut(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function st(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ct(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function lt(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function ft(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function ht(t,n,e){var r=R(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function pt(t,n){return function(){return ht(this,t,n)}}function dt(t,n){return function(){return ht(this,t,n.apply(this,arguments))}}A.prototype={constructor:A,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},z.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var gt=[null];function vt(t,n){this._groups=t,this._parents=n}function yt(t){return"string"==typeof t?new vt([[document.querySelector(t)]],[document.documentElement]):new vt([[t]],gt)}function mt(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}function _t(t){t.stopImmediatePropagation()}function wt(t){t.preventDefault(),t.stopImmediatePropagation()}vt.prototype={constructor:vt,select:function(t){"function"!=typeof t&&(t=d(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],s=u.length,c=r[i]=new Array(s),l=0;l<s;++l)(o=u[l])&&(a=t.call(o,o.__data__,l,u))&&("__data__"in o&&(a.__data__=o.__data__),c[l]=a);return new vt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var n=t.apply(this,arguments);return null==n?[]:g(n)}}(t):function(t){return null==t?v:function(){return this.querySelectorAll(t)}}(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],s=u.length,c=0;c<s;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),i.push(a));return new vt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return m.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,s=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&s.push(o);return new vt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,S);var e=n?C:D,r=this._parents,i=this._groups;"function"!=typeof t&&(t=E(t));for(var o=i.length,a=new Array(o),u=new Array(o),s=new Array(o),c=0;c<o;++c){var l=r[c],f=i[c],h=f.length,p=g(t.call(l,l&&l.__data__,c,r)),d=p.length,v=u[c]=new Array(d),y=a[c]=new Array(d),m=s[c]=new Array(h);e(l,f,v,y,m,p,n);for(var _,w,x=0,b=0;x<d;++x)if(_=v[x]){for(x>=b&&(b=x+1);!(w=y[b])&&++b<d;);_._next=w||null}}return(a=new vt(a,r))._enter=u,a._exit=s,a},enter:function(){return new vt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new vt(this._exit||this._groups.map(b),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=n&&(i=n(i)),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){if(!(t instanceof vt))throw new Error("invalid merge");for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var s,c=n[u],l=e[u],f=c.length,h=a[u]=new Array(f),p=0;p<f;++p)(s=c[p]||l[p])&&(h[p]=s);for(;u<r;++u)a[u]=n[u];return new vt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=M);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,c=i[o]=new Array(s),l=0;l<s;++l)(a=u[l])&&(c[l]=a);c.sort(n)}return new vt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=c(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?P:N:"function"==typeof n?e.local?I:k:e.local?B:T)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?j:"function"==typeof n?O:L)(t,n,null==e?"":e)):V(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?X:"function"==typeof n?Y:q)(t,n)):this.node()[t]},classed:function(t,n){var e=U(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?Q:n?K:J)(e,n))},text:function(t){return arguments.length?this.each(null==t?W:("function"==typeof t?$:Z)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?tt:("function"==typeof t?et:nt)(t)):this.node().innerHTML},raise:function(){return this.each(rt)},lower:function(){return this.each(it)},append:function(t){var n="function"==typeof t?t:h(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:h(t),r=null==n?ot:"function"==typeof n?n:d(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(at)},clone:function(t){return this.select(t?st:ut)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=ct(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?ft:lt,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var s,c=0,l=u.length;c<l;++c)for(r=0,s=u[c];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?dt:pt)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var xt=t=>()=>t;function bt(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:s,dy:c,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:l}})}function At(t){return!t.ctrlKey&&!t.button}function Et(){return this.parentNode}function Dt(t,n){return null==n?{x:t.x,y:t.y}:n}function Ct(){return navigator.maxTouchPoints||"ontouchstart"in this}function St(){var t,n,r,i,o=At,a=Et,u=Dt,s=Ct,c={},l=e("start","drag","end"),f=0,h=0;function p(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",y).on("touchmove.drag",m).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(e,u){if(!i&&o.call(this,e,u)){var s=w(this,a.call(this,e,u),e,u,"mouse");s&&(yt(e.view).on("mousemove.drag",g,!0).on("mouseup.drag",v,!0),function(t){var n=t.document.documentElement,e=yt(t).on("dragstart.drag",wt,!0);"onselectstart"in n?e.on("selectstart.drag",wt,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(e.view),_t(e),r=!1,t=e.clientX,n=e.clientY,s("start",e))}}function g(e){if(wt(e),!r){var i=e.clientX-t,o=e.clientY-n;r=i*i+o*o>h}c.mouse("drag",e)}function v(t){yt(t.view).on("mousemove.drag mouseup.drag",null),function(t,n){var e=t.document.documentElement,r=yt(t).on("dragstart.drag",null);n&&(r.on("click.drag",wt,!0),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,r),wt(t),c.mouse("end",t)}function y(t,n){if(o.call(this,t,n)){var e,r,i=t.changedTouches,u=a.call(this,t,n),s=i.length;for(e=0;e<s;++e)(r=w(this,u,t,n,i[e].identifier,i[e]))&&(_t(t),r("start",t,i[e]))}}function m(t){var n,e,r=t.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(wt(t),e("drag",t,r[n]))}function _(t){var n,e,r=t.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout((function(){i=null}),500),n=0;n<o;++n)(e=c[r[n].identifier])&&(_t(t),e("end",t,r[n]))}function w(t,n,e,r,i,o){var a,s,h,d=l.copy(),g=mt(o||e,n);if(null!=(h=u.call(t,new bt("beforestart",{sourceEvent:e,target:p,identifier:i,active:f,x:g[0],y:g[1],dx:0,dy:0,dispatch:d}),r)))return a=h.x-g[0]||0,s=h.y-g[1]||0,function e(o,u,l){var v,y=g;switch(o){case"start":c[i]=e,v=f++;break;case"end":delete c[i],--f;case"drag":g=mt(l||u,n),v=f}d.call(o,t,new bt(o,{sourceEvent:u,subject:h,target:p,identifier:i,active:v,x:g[0]+a,y:g[1]+s,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:d}),r)}}return p.filter=function(t){return arguments.length?(o="function"==typeof t?t:xt(!!t),p):o},p.container=function(t){return arguments.length?(a="function"==typeof t?t:xt(t),p):a},p.subject=function(t){return arguments.length?(u="function"==typeof t?t:xt(t),p):u},p.touchable=function(t){return arguments.length?(s="function"==typeof t?t:xt(!!t),p):s},p.on=function(){var t=l.on.apply(l,arguments);return t===l?p:t},p.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,p):Math.sqrt(h)},p}let Mt,Nt,Pt,Tt,Bt,kt,It,Rt,jt,Lt;bt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};let Ot=!1;function Vt(t,n){return isNaN(n)?t:Math.round(t*Math.pow(10,n))/Math.pow(10,n)}function Xt(t,n,e,r,i){let o,a;const u=n.data.datasets[e].data[r];if(t.touches?(o=n.scales[Pt].getValueForPixel(t.touches[0].clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Nt].getValueForPixel(t.touches[0].clientY-n.canvas.getBoundingClientRect().top)):(o=n.scales[Pt].getValueForPixel(t.clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Nt].getValueForPixel(t.clientY-n.canvas.getBoundingClientRect().top)),o=Vt(o,n.config.options.plugins.dragData.round),a=Vt(a,n.config.options.plugins.dragData.round),o=o>n.scales[Pt].max?n.scales[Pt].max:o,o=o<n.scales[Pt].min?n.scales[Pt].min:o,a=a>n.scales[Nt].max?n.scales[Nt].max:a,a=a<n.scales[Nt].min?n.scales[Nt].min:a,It){let t;t="y"===n.config.options.indexAxis?o:a;return Math.abs(t-u[0])<=Math.abs(t-u[1])?[t,u[1]]:[u[0],t]}return void 0!==u.x&&n.config.options.plugins.dragData.dragX&&(u.x=o),void 0!==u.y?(!1!==n.config.options.plugins.dragData.dragY&&(u.y=a),u):"y"===n.config.options.indexAxis?o:a}const qt=(t,n,e,r)=>{if(Mt){jt=Mt.datasetIndex,Lt=Mt.index,Ot=!0;let i=n.data.datasets[jt].data[Lt];if("radar"===Bt)i=function(t,n){let e,r,i;t.touches?(e=t.touches[0].clientX-n.canvas.getBoundingClientRect().left,r=t.touches[0].clientY-n.canvas.getBoundingClientRect().top):(e=t.clientX-n.canvas.getBoundingClientRect().left,r=t.clientY-n.canvas.getBoundingClientRect().top);let o=n.scales[Tt],a=Math.sqrt(Math.pow(e-o.xCenter,2)+Math.pow(r-o.yCenter,2)),u=o.drawingArea/(o.max-o.min);return i=o.options.ticks.reverse?o.max-a/u:o.min+a/u,i=Vt(i,n.config.options.plugins.dragData.round),i=i>n.scales[Tt].max?n.scales[Tt].max:i,i=i<n.scales[Tt].min?n.scales[Tt].min:i,i}(t,n);else if(kt){i=Vt(Xt(t,n,jt,Lt)-Rt,e.round)}else i=Xt(t,n,jt,Lt);(void 0===e.showTooltip||e.showTooltip)&&n.tooltip.setActiveElements([Mt],{x:Mt.element.x,y:Mt.element.y}),(!r||"function"==typeof r&&!1!==r(t,jt,Lt,i))&&(n.data.datasets[jt].data[Lt]=i,n.update("none"))}};const Yt={id:"dragdata",afterInit:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData){const n=t.config.options.plugins.dragData;yt(t.canvas).call(St().container(t.canvas).on("start",(e=>((t,n,e)=>{if(Mt=n.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1)[0],Bt=n.config.type,Mt){let r=Mt.datasetIndex,i=Mt.index;const o=n.data.datasets[r],a=n.getDatasetMeta(r);let u=o.data[i];if(Pt=a.xAxisID,Nt=a.yAxisID,Tt=a.rAxisID,!1===o.dragData||n.config.options.scales[Pt]&&!1===n.config.options.scales[Pt].dragData||n.config.options.scales[Nt]&&!1===n.config.options.scales[Nt].dragData||n.config.options.scales[Tt]&&!1===n.config.options.scales[Tt].rAxisID||!1===o.data[Mt.index].dragData)return void(Mt=null);if("bar"===Bt){kt=n.config.options.scales[Pt].stacked;const e=n.data.datasets[0].data[0];It=null!==e&&Array.isArray(e)&&2==e.length;let o=Xt(t,n,r,i);Rt=o-u}"function"==typeof e&&Mt&&!1===e(t,r,i,u)&&(Mt=null)}})(e.sourceEvent,t,n.onDragStart))).on("drag",(e=>qt(e.sourceEvent,t,n,n.onDrag))).on("end",(e=>((t,n,e)=>{if(Lt=void 0,Ot=!1,"function"==typeof e&&Mt){const r=Mt.datasetIndex,i=Mt.index;return e(t,r,i,function(t,n,e){const r=t.config.options.plugins.dragData;if(!r.magnet)return t.data.datasets[n].data[e];{const i=r.magnet;if(i.to&&"function"==typeof i.to){let r=t.data.datasets[n].data[e];return r=i.to(r),t.data.datasets[n].data[e]=r,t.update("none"),r}}}(n,r,i))}})(e.sourceEvent,t,n.onDragEnd))))}},beforeEvent:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData&&t.config.options.plugins.dragData.showTooltip&&Ot)return!1}};return t.Chart.register(Yt),Yt})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js"],n):(t="undefined"!=typeof globalThis?globalThis:t||self).index=n(t.Chart)}(this,(function(t){"use strict";var n={value:()=>{}};function e(){for(var t,n=0,e=arguments.length,i={};n<e;++n){if(!(t=arguments[n]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function i(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function o(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function a(t,e,r){for(var i=0,o=t.length;i<o;++i)if(t[i].name===e){t[i]=n,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:e,value:r}),t}r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r=this._,u=i(t+"",r),s=-1,c=u.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<c;)if(e=(t=u[s]).type)r[e]=a(r[e],t.name,n);else if(null==n)for(e in r)r[e]=a(r[e],t.name,null);return this}for(;++s<c;)if((e=(t=u[s]).type)&&(e=o(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new r(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var u="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function c(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),s.hasOwnProperty(n)?{space:s[n],local:t}:t}function l(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===u&&n.documentElement.namespaceURI===u?n.createElement(t):n.createElementNS(e,t)}}function f(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function h(t){var n=c(t);return(n.local?f:l)(n)}function p(){}function d(t){return null==t?p:function(){return this.querySelector(t)}}function g(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function v(){return[]}function y(t){return function(n){return n.matches(t)}}var m=Array.prototype.find;function _(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return Array.from(this.children)}function b(t){return new Array(t.length)}function A(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function E(t){return function(){return t}}function D(t,n,e,r,i,o){for(var a,u=0,s=n.length,c=o.length;u<c;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new A(t,o[u]);for(;u<s;++u)(a=n[u])&&(i[u]=a)}function C(t,n,e,r,i,o,a){var u,s,c,l=new Map,f=n.length,h=o.length,p=new Array(f);for(u=0;u<f;++u)(s=n[u])&&(p[u]=c=a.call(s,s.__data__,u,n)+"",l.has(c)?i[u]=s:l.set(c,s));for(u=0;u<h;++u)c=a.call(t,o[u],u,o)+"",(s=l.get(c))?(r[u]=s,s.__data__=o[u],l.delete(c)):e[u]=new A(t,o[u]);for(u=0;u<f;++u)(s=n[u])&&l.get(p[u])===s&&(i[u]=s)}function S(t){return t.__data__}function M(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function N(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function P(t){return function(){this.removeAttribute(t)}}function T(t){return function(){this.removeAttributeNS(t.space,t.local)}}function B(t,n){return function(){this.setAttribute(t,n)}}function k(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function R(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function j(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function L(t){return function(){this.style.removeProperty(t)}}function O(t,n,e){return function(){this.style.setProperty(t,n,e)}}function V(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function X(t,n){return t.style.getPropertyValue(n)||j(t).getComputedStyle(t,null).getPropertyValue(n)}function q(t){return function(){delete this[t]}}function Y(t,n){return function(){this[t]=n}}function U(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function F(t){return t.trim().split(/^|\s+/)}function z(t){return t.classList||new H(t)}function H(t){this._node=t,this._names=F(t.getAttribute("class")||"")}function G(t,n){for(var e=z(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function K(t,n){for(var e=z(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function J(t){return function(){G(this,t)}}function Q(t){return function(){K(this,t)}}function W(t,n){return function(){(n.apply(this,arguments)?G:K)(this,t)}}function Z(){this.textContent=""}function $(t){return function(){this.textContent=t}}function tt(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function nt(){this.innerHTML=""}function et(t){return function(){this.innerHTML=t}}function rt(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function it(){this.nextSibling&&this.parentNode.appendChild(this)}function ot(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function at(){return null}function ut(){var t=this.parentNode;t&&t.removeChild(this)}function st(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ct(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function lt(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function ft(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function ht(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function pt(t,n,e){var r=j(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function dt(t,n){return function(){return pt(this,t,n)}}function gt(t,n){return function(){return pt(this,t,n.apply(this,arguments))}}A.prototype={constructor:A,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},H.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var vt=[null];function yt(t,n){this._groups=t,this._parents=n}function mt(t){return"string"==typeof t?new yt([[document.querySelector(t)]],[document.documentElement]):new yt([[t]],vt)}function _t(t,n){if(t=function(t){let n;for(;n=t.sourceEvent;)t=n;return t}(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}yt.prototype={constructor:yt,select:function(t){"function"!=typeof t&&(t=d(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],s=u.length,c=r[i]=new Array(s),l=0;l<s;++l)(o=u[l])&&(a=t.call(o,o.__data__,l,u))&&("__data__"in o&&(a.__data__=o.__data__),c[l]=a);return new yt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return g(t.apply(this,arguments))}}(t):function(t){return null==t?v:function(){return this.querySelectorAll(t)}}(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],s=u.length,c=0;c<s;++c)(a=u[c])&&(r.push(t.call(a,a.__data__,c,u)),i.push(a));return new yt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return m.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,s=r[i]=[],c=0;c<u;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&s.push(o);return new yt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,S);var e=n?C:D,r=this._parents,i=this._groups;"function"!=typeof t&&(t=E(t));for(var o=i.length,a=new Array(o),u=new Array(o),s=new Array(o),c=0;c<o;++c){var l=r[c],f=i[c],h=f.length,p=M(t.call(l,l&&l.__data__,c,r)),d=p.length,g=u[c]=new Array(d),v=a[c]=new Array(d),y=s[c]=new Array(h);e(l,f,g,v,y,p,n);for(var m,_,w=0,x=0;w<d;++w)if(m=g[w]){for(w>=x&&(x=w+1);!(_=v[x])&&++x<d;);m._next=_||null}}return(a=new yt(a,r))._enter=u,a._exit=s,a},enter:function(){return new yt(this._enter||this._groups.map(b),this._parents)},exit:function(){return new yt(this._exit||this._groups.map(b),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),u=new Array(i),s=0;s<a;++s)for(var c,l=e[s],f=r[s],h=l.length,p=u[s]=new Array(h),d=0;d<h;++d)(c=l[d]||f[d])&&(p[d]=c);for(;s<i;++s)u[s]=e[s];return new yt(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=N);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,c=i[o]=new Array(s),l=0;l<s;++l)(a=u[l])&&(c[l]=a);c.sort(n)}return new yt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=c(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?T:P:"function"==typeof n?e.local?R:I:e.local?k:B)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?L:"function"==typeof n?V:O)(t,n,null==e?"":e)):X(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?q:"function"==typeof n?U:Y)(t,n)):this.node()[t]},classed:function(t,n){var e=F(t+"");if(arguments.length<2){for(var r=z(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?W:n?J:Q)(e,n))},text:function(t){return arguments.length?this.each(null==t?Z:("function"==typeof t?tt:$)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?nt:("function"==typeof t?rt:et)(t)):this.node().innerHTML},raise:function(){return this.each(it)},lower:function(){return this.each(ot)},append:function(t){var n="function"==typeof t?t:h(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:h(t),r=null==n?at:"function"==typeof n?n:d(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(ut)},clone:function(t){return this.select(t?ct:st)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=lt(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?ht:ft,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var s,c=0,l=u.length;c<l;++c)for(r=0,s=u[c];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?gt:dt)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};const wt={passive:!1},xt={capture:!0,passive:!1};function bt(t){t.stopImmediatePropagation()}function At(t){t.preventDefault(),t.stopImmediatePropagation()}var Et=t=>()=>t;function Dt(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:s,dy:c,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:l}})}function Ct(t){return!t.ctrlKey&&!t.button}function St(){return this.parentNode}function Mt(t,n){return null==n?{x:t.x,y:t.y}:n}function Nt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pt(){var t,n,r,i,o=Ct,a=St,u=Mt,s=Nt,c={},l=e("start","drag","end"),f=0,h=0;function p(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",y).on("touchmove.drag",m,wt).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(e,u){if(!i&&o.call(this,e,u)){var s=w(this,a.call(this,e,u),e,u,"mouse");s&&(mt(e.view).on("mousemove.drag",g,xt).on("mouseup.drag",v,xt),function(t){var n=t.document.documentElement,e=mt(t).on("dragstart.drag",At,xt);"onselectstart"in n?e.on("selectstart.drag",At,xt):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}(e.view),bt(e),r=!1,t=e.clientX,n=e.clientY,s("start",e))}}function g(e){if(At(e),!r){var i=e.clientX-t,o=e.clientY-n;r=i*i+o*o>h}c.mouse("drag",e)}function v(t){mt(t.view).on("mousemove.drag mouseup.drag",null),function(t,n){var e=t.document.documentElement,r=mt(t).on("dragstart.drag",null);n&&(r.on("click.drag",At,xt),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}(t.view,r),At(t),c.mouse("end",t)}function y(t,n){if(o.call(this,t,n)){var e,r,i=t.changedTouches,u=a.call(this,t,n),s=i.length;for(e=0;e<s;++e)(r=w(this,u,t,n,i[e].identifier,i[e]))&&(bt(t),r("start",t,i[e]))}}function m(t){var n,e,r=t.changedTouches,i=r.length;for(n=0;n<i;++n)(e=c[r[n].identifier])&&(At(t),e("drag",t,r[n]))}function _(t){var n,e,r=t.changedTouches,o=r.length;for(i&&clearTimeout(i),i=setTimeout((function(){i=null}),500),n=0;n<o;++n)(e=c[r[n].identifier])&&(bt(t),e("end",t,r[n]))}function w(t,n,e,r,i,o){var a,s,h,d=l.copy(),g=_t(o||e,n);if(null!=(h=u.call(t,new Dt("beforestart",{sourceEvent:e,target:p,identifier:i,active:f,x:g[0],y:g[1],dx:0,dy:0,dispatch:d}),r)))return a=h.x-g[0]||0,s=h.y-g[1]||0,function e(o,u,l){var v,y=g;switch(o){case"start":c[i]=e,v=f++;break;case"end":delete c[i],--f;case"drag":g=_t(l||u,n),v=f}d.call(o,t,new Dt(o,{sourceEvent:u,subject:h,target:p,identifier:i,active:v,x:g[0]+a,y:g[1]+s,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:d}),r)}}return p.filter=function(t){return arguments.length?(o="function"==typeof t?t:Et(!!t),p):o},p.container=function(t){return arguments.length?(a="function"==typeof t?t:Et(t),p):a},p.subject=function(t){return arguments.length?(u="function"==typeof t?t:Et(t),p):u},p.touchable=function(t){return arguments.length?(s="function"==typeof t?t:Et(!!t),p):s},p.on=function(){var t=l.on.apply(l,arguments);return t===l?p:t},p.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,p):Math.sqrt(h)},p}let Tt,Bt,kt,It,Rt,jt,Lt,Ot,Vt,Xt;Dt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};let qt=!1;function Yt(t,n){return isNaN(n)?t:Math.round(t*Math.pow(10,n))/Math.pow(10,n)}function Ut(t,n,e,r,i){let o,a;const u=n.data.datasets[e].data[r];if(t.touches?(o=n.scales[kt].getValueForPixel(t.touches[0].clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Bt].getValueForPixel(t.touches[0].clientY-n.canvas.getBoundingClientRect().top)):(o=n.scales[kt].getValueForPixel(t.clientX-n.canvas.getBoundingClientRect().left),a=n.scales[Bt].getValueForPixel(t.clientY-n.canvas.getBoundingClientRect().top)),o=Yt(o,n.config.options.plugins.dragData.round),a=Yt(a,n.config.options.plugins.dragData.round),o=o>n.scales[kt].max?n.scales[kt].max:o,o=o<n.scales[kt].min?n.scales[kt].min:o,a=a>n.scales[Bt].max?n.scales[Bt].max:a,a=a<n.scales[Bt].min?n.scales[Bt].min:a,Lt){let t;t="y"===n.config.options.indexAxis?o:a;return Math.abs(t-u[0])<=Math.abs(t-u[1])?[t,u[1]]:[u[0],t]}return void 0!==u.x&&n.config.options.plugins.dragData.dragX&&(u.x=o),void 0!==u.y?(!1!==n.config.options.plugins.dragData.dragY&&(u.y=a),u):"y"===n.config.options.indexAxis?o:a}const Ft=(t,n,e,r)=>{if(Tt){Vt=Tt.datasetIndex,Xt=Tt.index,qt=!0;let i=n.data.datasets[Vt].data[Xt];if("radar"===Rt||"polarArea"===Rt)i=function(t,n){let e,r,i;t.touches?(e=t.touches[0].clientX-n.canvas.getBoundingClientRect().left,r=t.touches[0].clientY-n.canvas.getBoundingClientRect().top):(e=t.clientX-n.canvas.getBoundingClientRect().left,r=t.clientY-n.canvas.getBoundingClientRect().top);let o=n.scales[It],a=Math.sqrt(Math.pow(e-o.xCenter,2)+Math.pow(r-o.yCenter,2)),u=o.drawingArea/(o.max-o.min);return i=o.options.ticks.reverse?o.max-a/u:o.min+a/u,i=Yt(i,n.config.options.plugins.dragData.round),i=i>n.scales[It].max?n.scales[It].max:i,i=i<n.scales[It].min?n.scales[It].min:i,i}(t,n);else if(jt){i=Yt(Ut(t,n,Vt,Xt)-Ot,e.round)}else i=Ut(t,n,Vt,Xt);(void 0===e.showTooltip||e.showTooltip)&&n.tooltip.setActiveElements([Tt],{x:Tt.element.x,y:Tt.element.y}),(!r||"function"==typeof r&&!1!==r(t,Vt,Xt,i))&&(n.data.datasets[Vt].data[Xt]=i,n.update("none"))}};const zt={id:"dragdata",afterInit:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData){const n=t.config.options.plugins.dragData;mt(t.canvas).call(Pt().container(t.canvas).on("start",(e=>((t,n,e)=>{if(Tt=n.getElementsAtEventForMode(t,"nearest",{intersect:!0},!1)[0],Rt=n.config.type,Tt){let r=Tt.datasetIndex,i=Tt.index;const o=n.data.datasets[r],a=n.getDatasetMeta(r);let u=o.data[i];if(kt=a.xAxisID,Bt=a.yAxisID,It=a.rAxisID,!1===o.dragData||n.config.options.scales[kt]&&!1===n.config.options.scales[kt].dragData||n.config.options.scales[Bt]&&!1===n.config.options.scales[Bt].dragData||n.config.options.scales[It]&&!1===n.config.options.scales[It].rAxisID||!1===o.data[Tt.index].dragData)return void(Tt=null);if("bar"===Rt){jt=n.config.options.scales[kt].stacked;const e=n.data.datasets[0].data[0];Lt=null!==e&&Array.isArray(e)&&2==e.length;let o=Ut(t,n,r,i);Ot=o-u}"function"==typeof e&&Tt&&!1===e(t,r,i,u)&&(Tt=null)}})(e.sourceEvent,t,n.onDragStart))).on("drag",(e=>Ft(e.sourceEvent,t,n,n.onDrag))).on("end",(e=>((t,n,e)=>{if(Xt=void 0,qt=!1,"function"==typeof e&&Tt){const r=Tt.datasetIndex,i=Tt.index;return e(t,r,i,function(t,n,e){const r=t.config.options.plugins.dragData;if(!r.magnet)return t.data.datasets[n].data[e];{const i=r.magnet;if(i.to&&"function"==typeof i.to){let r=t.data.datasets[n].data[e];return r=i.to(r),t.data.datasets[n].data[e]=r,t.update("none"),r}}}(n,r,i))}})(e.sourceEvent,t,n.onDragEnd))))}},beforeEvent:function(t){if(t.config.options.plugins&&t.config.options.plugins.dragData&&t.config.options.plugins.dragData.showTooltip&&qt)return!1}};return t.Chart.register(zt),zt})); |
{ | ||
"name": "chartjs-plugin-dragdata", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Draggable data points for Chart.js", | ||
@@ -28,17 +28,17 @@ "main": "dist/chartjs-plugin-dragdata.js", | ||
"dependencies": { | ||
"chart.js": "^3.0.1", | ||
"d3-drag": "^2.0.0", | ||
"d3-selection": "^2.0.0" | ||
"chart.js": "^3.6.0", | ||
"d3-drag": "^3.0.0", | ||
"d3-selection": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^18.0.0", | ||
"@rollup/plugin-node-resolve": "^11.2.1", | ||
"eslint": "^7.23.0", | ||
"eslint-config-standard": "^16.0.2", | ||
"eslint-plugin-import": "^2.22.1", | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@rollup/plugin-node-resolve": "^13.0.6", | ||
"eslint": "^7.12.1", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^4.3.1", | ||
"rollup": "^2.44.0", | ||
"eslint-plugin-promise": "^5.1.1", | ||
"rollup": "^2.60.1", | ||
"rollup-plugin-terser": "^7.0.2" | ||
} | ||
} |
@@ -12,22 +12,23 @@ # chartjs-plugin-dragdata.js | ||
### Online demos | ||
| Chart Type | Demo | Source | | ||
|:-------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------| | ||
| Bar - Simple Bar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/bar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/bar.html) | | ||
| Bubble - Simple Bubble | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/bubble.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/bubble.html) | | ||
| Floating bar - simple floating bars | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/floatingBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/floatingBar.html) | | ||
| Floating bar - simple floating bars, horizontal | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/horizontalFloatingBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/horizontalFloatingBar.html) | | ||
| Horizontal Bar - Simple Horizontal Bar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/horizontalBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/horizontalBar.html) | | ||
| Line - Single Y-Axis | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/index.html) | | ||
| Line - Dual Y-Axis | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/dualAxis.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/dualAxis.html) | | ||
| Line - Drag multiple points | [demo](https://jsfiddle.net/45nurh9L/3/) | [source](https://jsfiddle.net/45nurh9L/3/) | | ||
| Line - Small | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/smallChart.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/smallChart.html) | | ||
| Line - React Fiddle | [demo](https://jsfiddle.net/16kvxd4u/3/) | [source](https://jsfiddle.net/16kvxd4u/3/) | | ||
| Line - Drag x-, and y-axis (scatter chart) | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/scatter.html) | [source](https://chrispahm.github.io/chartjs-plugin-dragdata/scatter.html) | | ||
| Line - Drag dates (x and y axis) | [demo](https://jsfiddle.net/f72kz348/9/) | [source](https://jsfiddle.net/f72kz348/9/) | | ||
| Line - Zoom, Pan, and drag data points (combination with [chartjs-plugin-zoom](https://github.com/chartjs/chartjs-plugin-zoom) | [demo](https://jsfiddle.net/s6xn3q9f/1/) | [source](https://jsfiddle.net/s6xn3q9f/1/) | | ||
| Mixed - Bar, Bubble, and line Chart | [demo](https://jsfiddle.net/rqbcs6ep/3/) | [source](https://jsfiddle.net/rqbcs6ep/3/) | | ||
| Radar - Simple Radar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/radar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/radar.html) | | ||
| Polar - Simple Polar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/polar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/polar.html) | | ||
| Stacked Bar - Simple Stacked Bar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/stackedBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/stackedBar.html) | | ||
| Stacked Horizontal Bar - Simple Stacked Horizontal Bar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/stackedHorizontalBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/stackedHorizontalBar.html) | | ||
| Chart Type | Demo | Source | | ||
|:-------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------| | ||
| Bar - Simple Bar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/bar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/bar.html) | | ||
| Bubble - Simple Bubble | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/bubble.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/bubble.html) | | ||
| Floating bar - simple floating bars | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/floatingBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/floatingBar.html) | | ||
| Floating bar - simple floating bars, horizontal | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/horizontalFloatingBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/horizontalFloatingBar.html) | | ||
| Horizontal Bar - Simple Horizontal Bar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/horizontalBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/horizontalBar.html) | | ||
| Line - Single Y-Axis | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/index.html) | | ||
| Line - Dual Y-Axis | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/dualAxis.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/dualAxis.html) | | ||
| Line - Drag multiple points | [demo](https://jsfiddle.net/45nurh9L/3/) | [source](https://jsfiddle.net/45nurh9L/3/) | | ||
| Line - Small | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/smallChart.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/smallChart.html) | | ||
| Line - React Fiddle | [demo](https://jsfiddle.net/16kvxd4u/3/) | [source](https://jsfiddle.net/16kvxd4u/3/) | | ||
| Line - Drag x-, and y-axis (scatter chart) | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/scatter.html) | [source](https://chrispahm.github.io/chartjs-plugin-dragdata/scatter.html) | | ||
| Line - Drag dates (x and y axis) | [demo](https://jsfiddle.net/f72kz348/9/) | [source](https://jsfiddle.net/f72kz348/9/) | | ||
| Line - Zoom, Pan, and drag data points (combination with [chartjs-plugin-zoom](https://github.com/chartjs/chartjs-plugin-zoom) | [demo](https://jsfiddle.net/s6xn3q9f/1/) | [source](https://jsfiddle.net/s6xn3q9f/1/) | | ||
| Mixed - Bar, Bubble, and line Chart | [demo](https://jsfiddle.net/rqbcs6ep/3/) | [source](https://jsfiddle.net/rqbcs6ep/3/) | | ||
| Radar - Simple Radar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/radar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/radar.html) | | ||
| Polar - Simple Polar Area Chart | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/polar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/polar.html) | | ||
| Stacked Bar - Simple Stacked Bar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/stackedBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/stackedBar.html) | | ||
| Stacked Bar - GANTT Chart | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/ganttChart.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/ganttChart.html) | | ||
| Stacked Horizontal Bar - Simple Stacked Horizontal Bar | [demo](https://chrispahm.github.io/chartjs-plugin-dragdata/stackedHorizontalBar.html) | [source](https://raw.githubusercontent.com/chrispahm/chartjs-plugin-dragdata/master/docs/stackedHorizontalBar.html) | | ||
@@ -173,3 +174,3 @@ Click here to learn [how to use this plugin in an Observable notebook](https://observablehq.com/@chrispahm/draggable-data-charts). | ||
<script> | ||
import Chart from 'chart.js' | ||
import { Chart, registerables } from 'chart.js' | ||
// load the options file externally for better readability of the component. | ||
@@ -187,2 +188,3 @@ // In the chartOptions object, make sure to add "dragData: true" etc. | ||
mounted() { | ||
Chart.register(...registerables) | ||
this.createChart('chart', this.chartOptions) | ||
@@ -189,0 +191,0 @@ }, |
@@ -162,3 +162,3 @@ import {Chart} from 'chart.js' | ||
if (type === 'radar') { | ||
if (type === 'radar' || type === 'polarArea') { | ||
dataPoint = calcRadar(e, chartInstance) | ||
@@ -165,0 +165,0 @@ } else if (stacked) { |
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
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
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
175068
27
1802
213
+ Addedd3-dispatch@3.0.1(transitive)
+ Addedd3-drag@3.0.0(transitive)
+ Addedd3-selection@3.0.0(transitive)
- Removedd3-dispatch@2.0.0(transitive)
- Removedd3-drag@2.0.0(transitive)
- Removedd3-selection@2.0.0(transitive)
Updatedchart.js@^3.6.0
Updatedd3-drag@^3.0.0
Updatedd3-selection@^3.0.0