chartjs-chart-matrix
Advanced tools
Comparing version 1.0.0-beta.2 to 1.0.0-rc
/*! | ||
* chartjs-chart-matrix v1.0.0-beta.2 | ||
* chartjs-chart-matrix v1.0.0-rc | ||
* https://github.com/kurkle/chartjs-chart-matrix#readme | ||
@@ -63,23 +63,14 @@ * (c) 2021 Jukka Kurkela | ||
dataElementType: 'matrix', | ||
dataElementOptions: [ | ||
'backgroundColor', | ||
'borderColor', | ||
'borderWidth', | ||
'anchorX', | ||
'anchorY', | ||
'width', | ||
'height' | ||
], | ||
datasets: { | ||
animation: { | ||
numbers: { | ||
type: 'number', | ||
properties: ['x', 'y', 'width', 'height'] | ||
} | ||
}, | ||
anchorX: 'center', | ||
anchorY: 'center' | ||
animations: { | ||
numbers: { | ||
type: 'number', | ||
properties: ['x', 'y', 'width', 'height'] | ||
} | ||
}, | ||
anchorX: 'center', | ||
anchorY: 'center' | ||
}; | ||
MatrixController.overrides = { | ||
interaction: { | ||
@@ -238,2 +229,7 @@ mode: 'nearest', | ||
MatrixElement.defaults = { | ||
backgroundColor: undefined, | ||
borderColor: undefined, | ||
borderWidth: undefined, | ||
anchorX: undefined, | ||
anchorY: undefined, | ||
width: 20, | ||
@@ -240,0 +236,0 @@ height: 20 |
/*! | ||
* chartjs-chart-matrix v1.0.0-beta.2 | ||
* chartjs-chart-matrix v1.0.0-rc | ||
* https://github.com/kurkle/chartjs-chart-matrix#readme | ||
@@ -70,23 +70,14 @@ * (c) 2021 Jukka Kurkela | ||
dataElementType: 'matrix', | ||
dataElementOptions: [ | ||
'backgroundColor', | ||
'borderColor', | ||
'borderWidth', | ||
'anchorX', | ||
'anchorY', | ||
'width', | ||
'height' | ||
], | ||
datasets: { | ||
animation: { | ||
numbers: { | ||
type: 'number', | ||
properties: ['x', 'y', 'width', 'height'] | ||
} | ||
}, | ||
anchorX: 'center', | ||
anchorY: 'center' | ||
animations: { | ||
numbers: { | ||
type: 'number', | ||
properties: ['x', 'y', 'width', 'height'] | ||
} | ||
}, | ||
anchorX: 'center', | ||
anchorY: 'center' | ||
}; | ||
MatrixController.overrides = { | ||
interaction: { | ||
@@ -245,2 +236,7 @@ mode: 'nearest', | ||
MatrixElement.defaults = { | ||
backgroundColor: undefined, | ||
borderColor: undefined, | ||
borderWidth: undefined, | ||
anchorX: undefined, | ||
anchorY: undefined, | ||
width: 20, | ||
@@ -247,0 +243,0 @@ height: 20 |
/*! | ||
* chartjs-chart-matrix v1.0.0-beta.2 | ||
* chartjs-chart-matrix v1.0.0-rc | ||
* https://github.com/kurkle/chartjs-chart-matrix#readme | ||
@@ -7,3 +7,3 @@ * (c) 2021 Jukka Kurkela | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("chart.js"),require("chart.js/helpers")):"function"==typeof define&&define.amd?define(["chart.js","chart.js/helpers"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Chart,t.Chart.helpers)}(this,(function(t,e){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=i(t);class r extends t.DatasetController{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const r=this,o="reset"===n,{xScale:h,yScale:a}=r._cachedMeta,s=r.resolveDataElementOptions(e,n),l=r.getSharedOptions(n,t[e],s);for(let s=e;s<e+i;s++){const e=!o&&r.getParsed(s),i=o?h.getBasePixel():h.getPixelForValue(e.x),l=o?a.getBasePixel():a.getPixelForValue(e.y),d=r.resolveDataElementOptions(s,n),{width:c,height:u,anchorX:g,anchorY:p}=d,f={x:"left"===g?i:i-c/("right"===g?1:2),y:"top"===p?l:l-u/("bottom"===p?1:2),width:c,height:u,options:d};r.updateElement(t[s],s,f,n)}r.updateSharedOptions(l,n)}draw(){const t=this,e=t.getMeta().data||[];let i,n;for(i=0,n=e.length;i<n;++i)e[i].draw(t._ctx)}}function o(t,e){const{x:i,y:n,width:r,height:o}=t.getProps(["x","y","width","height"],e);return{left:i,top:n,right:i+r,bottom:n+o}}function h(t,e,i){return Math.max(Math.min(t,i),e)}function a(t){const i=o(t),n=i.right-i.left,r=i.bottom-i.top,a=function(t,i,n){const r=t.options.borderWidth;let o,a,s,l;return e.isObject(r)?(o=+r.top||0,a=+r.right||0,s=+r.bottom||0,l=+r.left||0):o=a=s=l=+r||0,{t:h(o,0,n),r:h(a,0,i),b:h(s,0,n),l:h(l,0,i)}}(t,n/2,r/2);return{outer:{x:i.left,y:i.top,w:n,h:r},inner:{x:i.left+a.l,y:i.top+a.t,w:n-a.l-a.r,h:r-a.t-a.b}}}function s(t,e,i,n){const r=null===e,h=null===i,a=!(!t||r&&h)&&o(t,n);return a&&(r||e>=a.left&&e<=a.right)&&(h||i>=a.top&&i<=a.bottom)}r.id="matrix",r.defaults={dataElementType:"matrix",dataElementOptions:["backgroundColor","borderColor","borderWidth","anchorX","anchorY","width","height"],datasets:{animation:{numbers:{type:"number",properties:["x","y","width","height"]}},anchorX:"center",anchorY:"center"},interaction:{mode:"nearest",intersect:!0},scales:{x:{type:"linear",offset:!0},y:{type:"linear",reverse:!0}}};class l extends t.Element{constructor(t){super(),this.options=void 0,this.width=void 0,this.height=void 0,t&&Object.assign(this,t)}draw(t){const e=this.options,{inner:i,outer:n}=a(this);t.save(),n.w!==i.w||n.h!==i.h?(t.beginPath(),t.rect(n.x,n.y,n.w,n.h),t.clip(),t.rect(i.x,i.y,i.w,i.h),t.fillStyle=e.backgroundColor,t.fill(),t.fillStyle=e.borderColor,t.fill("evenodd")):(t.fillStyle=e.backgroundColor,t.fillRect(i.x,i.y,i.w,i.h)),t.restore()}inRange(t,e,i){return s(this,t,e,i)}inXRange(t,e){return s(this,t,null,e)}inYRange(t,e){return s(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,width:n,height:r}=this.getProps(["x","y","width","height"],t);return{x:e+n/2,y:i+r/2}}tooltipPosition(){return this.getCenterPoint()}getRange(t){return"x"===t?this.width/2:this.height/2}}l.id="matrix",l.defaults={width:20,height:20},n.default.register(r,l)})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("chart.js"),require("chart.js/helpers")):"function"==typeof define&&define.amd?define(["chart.js","chart.js/helpers"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Chart,t.Chart.helpers)}(this,(function(t,e){"use strict";function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=i(t);class n extends t.DatasetController{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,r){const n=this,o="reset"===r,{xScale:h,yScale:s}=n._cachedMeta,a=n.resolveDataElementOptions(e,r),l=n.getSharedOptions(r,t[e],a);for(let a=e;a<e+i;a++){const e=!o&&n.getParsed(a),i=o?h.getBasePixel():h.getPixelForValue(e.x),l=o?s.getBasePixel():s.getPixelForValue(e.y),d=n.resolveDataElementOptions(a,r),{width:c,height:u,anchorX:f,anchorY:g}=d,p={x:"left"===f?i:i-c/("right"===f?1:2),y:"top"===g?l:l-u/("bottom"===g?1:2),width:c,height:u,options:d};n.updateElement(t[a],a,p,r)}n.updateSharedOptions(l,r)}draw(){const t=this,e=t.getMeta().data||[];let i,r;for(i=0,r=e.length;i<r;++i)e[i].draw(t._ctx)}}function o(t,e){const{x:i,y:r,width:n,height:o}=t.getProps(["x","y","width","height"],e);return{left:i,top:r,right:i+n,bottom:r+o}}function h(t,e,i){return Math.max(Math.min(t,i),e)}function s(t){const i=o(t),r=i.right-i.left,n=i.bottom-i.top,s=function(t,i,r){const n=t.options.borderWidth;let o,s,a,l;return e.isObject(n)?(o=+n.top||0,s=+n.right||0,a=+n.bottom||0,l=+n.left||0):o=s=a=l=+n||0,{t:h(o,0,r),r:h(s,0,i),b:h(a,0,r),l:h(l,0,i)}}(t,r/2,n/2);return{outer:{x:i.left,y:i.top,w:r,h:n},inner:{x:i.left+s.l,y:i.top+s.t,w:r-s.l-s.r,h:n-s.t-s.b}}}function a(t,e,i,r){const n=null===e,h=null===i,s=!(!t||n&&h)&&o(t,r);return s&&(n||e>=s.left&&e<=s.right)&&(h||i>=s.top&&i<=s.bottom)}n.id="matrix",n.defaults={dataElementType:"matrix",animations:{numbers:{type:"number",properties:["x","y","width","height"]}},anchorX:"center",anchorY:"center"},n.overrides={interaction:{mode:"nearest",intersect:!0},scales:{x:{type:"linear",offset:!0},y:{type:"linear",reverse:!0}}};class l extends t.Element{constructor(t){super(),this.options=void 0,this.width=void 0,this.height=void 0,t&&Object.assign(this,t)}draw(t){const e=this.options,{inner:i,outer:r}=s(this);t.save(),r.w!==i.w||r.h!==i.h?(t.beginPath(),t.rect(r.x,r.y,r.w,r.h),t.clip(),t.rect(i.x,i.y,i.w,i.h),t.fillStyle=e.backgroundColor,t.fill(),t.fillStyle=e.borderColor,t.fill("evenodd")):(t.fillStyle=e.backgroundColor,t.fillRect(i.x,i.y,i.w,i.h)),t.restore()}inRange(t,e,i){return a(this,t,e,i)}inXRange(t,e){return a(this,t,null,e)}inYRange(t,e){return a(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,width:r,height:n}=this.getProps(["x","y","width","height"],t);return{x:e+r/2,y:i+n/2}}tooltipPosition(){return this.getCenterPoint()}getRange(t){return"x"===t?this.width/2:this.height/2}}l.id="matrix",l.defaults={backgroundColor:void 0,borderColor:void 0,borderWidth:void 0,anchorX:void 0,anchorY:void 0,width:20,height:20},r.default.register(n,l)})); | ||
//# sourceMappingURL=chartjs-chart-matrix.min.js.map |
{ | ||
"name": "chartjs-chart-matrix", | ||
"version": "1.0.0-beta.2", | ||
"version": "1.0.0-rc", | ||
"description": "Chart.js module for creating matrix charts", | ||
@@ -37,15 +37,15 @@ "main": "dist/chartjs-chart-matrix.js", | ||
"@rollup/plugin-commonjs": "^17.1.0", | ||
"@rollup/plugin-node-resolve": "^11.1.1", | ||
"chart.js": "^3.0.0-beta.10", | ||
"chartjs-adapter-date-fns": "^1.1.0-alpha.3", | ||
"chartjs-test-utils": "^0.1.2", | ||
"concurrently": "^5.3.0", | ||
"@rollup/plugin-node-resolve": "^11.2.0", | ||
"chart.js": "^3.0.0-rc.2", | ||
"chartjs-adapter-date-fns": "^1.1.0-beta.1", | ||
"chartjs-test-utils": "^0.2.2", | ||
"concurrently": "^6.0.0", | ||
"cross-env": "^7.0.3", | ||
"date-fns": "^2.16.1", | ||
"eslint": "^7.19.0", | ||
"date-fns": "^2.19.0", | ||
"eslint": "^7.22.0", | ||
"eslint-config-chartjs": "^0.3.0", | ||
"eslint-plugin-es": "^4.1.0", | ||
"eslint-plugin-html": "^6.1.1", | ||
"jasmine-core": "^3.6.0", | ||
"karma": "^6.1.0", | ||
"eslint-plugin-html": "^6.1.2", | ||
"jasmine-core": "^3.7.1", | ||
"karma": "^6.2.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
@@ -56,7 +56,6 @@ "karma-coverage": "^2.0.3", | ||
"karma-jasmine-html-reporter": "^1.5.4", | ||
"karma-rollup-preprocessor": "^7.0.5", | ||
"karma-rollup-preprocessor": "^7.0.7", | ||
"karma-spec-reporter": "0.0.32", | ||
"pixelmatch": "^5.2.1", | ||
"rollup": "^2.38.4", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup": "^2.42.1", | ||
"rollup-plugin-istanbul": "^3.0.0", | ||
@@ -66,5 +65,5 @@ "rollup-plugin-terser": "^7.0.2" | ||
"peerDependencies": { | ||
"chart.js": "^3.0.0-alpha.2" | ||
"chart.js": "^3.0.0-beta.10" | ||
}, | ||
"dependencies": {} | ||
} |
25
20820
427