chartjs-chart-matrix 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # chartjs-chart-matrix
2
2
 
3
- [Chart.js](https://www.chartjs.org/) **v3.0.0** module for creating matrix charts
3
+ [Chart.js](https://www.chartjs.org/) **v3+, v4+** module for creating matrix charts
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/chartjs-chart-matrix.svg)](https://www.npmjs.com/package/chartjs-chart-matrix)
6
6
  [![release](https://img.shields.io/github/release/kurkle/chartjs-chart-matrix.svg?style=flat-square)](https://github.com/kurkle/chartjs-chart-matrix/releases/latest)
@@ -15,7 +15,7 @@
15
15
 
16
16
  ## Documentation
17
17
 
18
- You can find documentation for chartjs-chart-treemap at [https://chartjs-chart-matrix.pages.dev/](https://chartjs-chart-matrix.pages.dev/).
18
+ You can find documentation for chartjs-chart-matrix at [https://chartjs-chart-matrix.pages.dev/](https://chartjs-chart-matrix.pages.dev/).
19
19
 
20
20
  ## Quickstart
21
21
 
@@ -1,15 +1,47 @@
1
1
  /*!
2
- * chartjs-chart-matrix v1.3.0
2
+ * chartjs-chart-matrix v2.0.0
3
3
  * https://chartjs-chart-matrix.pages.dev/
4
- * (c) 2022 Jukka Kurkela
4
+ * (c) 2023 Jukka Kurkela
5
5
  * Released under the MIT license
6
6
  */
7
7
  import { DatasetController, Element } from 'chart.js';
8
8
  import { toTRBLCorners, addRoundedRectPath, isObject } from 'chart.js/helpers';
9
9
 
10
- var version = "1.3.0";
10
+ var version = "2.0.0";
11
11
 
12
12
  class MatrixController extends DatasetController {
13
+
14
+ static id = 'matrix';
15
+ static version = version;
16
+
17
+ static defaults = {
18
+ dataElementType: 'matrix',
19
+
20
+ animations: {
21
+ numbers: {
22
+ type: 'number',
23
+ properties: ['x', 'y', 'width', 'height']
24
+ }
25
+ },
26
+ };
27
+
28
+ static overrides = {
29
+ interaction: {
30
+ mode: 'nearest',
31
+ intersect: true
32
+ },
33
+ scales: {
34
+ x: {
35
+ type: 'linear',
36
+ offset: true
37
+ },
38
+ y: {
39
+ type: 'linear',
40
+ reverse: true
41
+ }
42
+ },
43
+ };
44
+
13
45
  initialize() {
14
46
  this.enableOptionSharing = true;
15
47
  super.initialize();
@@ -79,39 +111,6 @@ function resolveY(anchorY, y, height) {
79
111
  return y - height / 2;
80
112
  }
81
113
 
82
- MatrixController.id = 'matrix';
83
-
84
- MatrixController.version = version;
85
-
86
- MatrixController.defaults = {
87
- dataElementType: 'matrix',
88
-
89
- animations: {
90
- numbers: {
91
- type: 'number',
92
- properties: ['x', 'y', 'width', 'height']
93
- }
94
- },
95
- };
96
-
97
- MatrixController.overrides = {
98
- interaction: {
99
- mode: 'nearest',
100
- intersect: true
101
- },
102
-
103
- scales: {
104
- x: {
105
- type: 'linear',
106
- offset: true
107
- },
108
- y: {
109
- type: 'linear',
110
- reverse: true
111
- }
112
- },
113
- };
114
-
115
114
  /**
116
115
  * Helper function to get the bounds of the rect
117
116
  * @param {MatrixElement} rect the rect
@@ -182,6 +181,20 @@ function inRange(rect, x, y, useFinalPosition) {
182
181
  }
183
182
 
184
183
  class MatrixElement extends Element {
184
+
185
+ static id = 'matrix';
186
+
187
+ static defaults = {
188
+ backgroundColor: undefined,
189
+ borderColor: undefined,
190
+ borderWidth: undefined,
191
+ borderRadius: 0,
192
+ anchorX: 'center',
193
+ anchorY: 'center',
194
+ width: 20,
195
+ height: 20
196
+ };
197
+
185
198
  constructor(cfg) {
186
199
  super();
187
200
 
@@ -248,16 +261,4 @@ class MatrixElement extends Element {
248
261
  }
249
262
  }
250
263
 
251
- MatrixElement.id = 'matrix';
252
- MatrixElement.defaults = {
253
- backgroundColor: undefined,
254
- borderColor: undefined,
255
- borderWidth: undefined,
256
- borderRadius: 0,
257
- anchorX: 'center',
258
- anchorY: 'center',
259
- width: 20,
260
- height: 20
261
- };
262
-
263
264
  export { MatrixController, MatrixElement };
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * chartjs-chart-matrix v1.3.0
2
+ * chartjs-chart-matrix v2.0.0
3
3
  * https://chartjs-chart-matrix.pages.dev/
4
- * (c) 2022 Jukka Kurkela
4
+ * (c) 2023 Jukka Kurkela
5
5
  * Released under the MIT license
6
6
  */
7
7
  (function (global, factory) {
@@ -10,9 +10,41 @@ typeof define === 'function' && define.amd ? define(['chart.js', 'chart.js/helpe
10
10
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Chart, global.Chart.helpers));
11
11
  })(this, (function (Chart, helpers) { 'use strict';
12
12
 
13
- var version = "1.3.0";
13
+ var version = "2.0.0";
14
14
 
15
15
  class MatrixController extends Chart.DatasetController {
16
+
17
+ static id = 'matrix';
18
+ static version = version;
19
+
20
+ static defaults = {
21
+ dataElementType: 'matrix',
22
+
23
+ animations: {
24
+ numbers: {
25
+ type: 'number',
26
+ properties: ['x', 'y', 'width', 'height']
27
+ }
28
+ },
29
+ };
30
+
31
+ static overrides = {
32
+ interaction: {
33
+ mode: 'nearest',
34
+ intersect: true
35
+ },
36
+ scales: {
37
+ x: {
38
+ type: 'linear',
39
+ offset: true
40
+ },
41
+ y: {
42
+ type: 'linear',
43
+ reverse: true
44
+ }
45
+ },
46
+ };
47
+
16
48
  initialize() {
17
49
  this.enableOptionSharing = true;
18
50
  super.initialize();
@@ -82,39 +114,6 @@ function resolveY(anchorY, y, height) {
82
114
  return y - height / 2;
83
115
  }
84
116
 
85
- MatrixController.id = 'matrix';
86
-
87
- MatrixController.version = version;
88
-
89
- MatrixController.defaults = {
90
- dataElementType: 'matrix',
91
-
92
- animations: {
93
- numbers: {
94
- type: 'number',
95
- properties: ['x', 'y', 'width', 'height']
96
- }
97
- },
98
- };
99
-
100
- MatrixController.overrides = {
101
- interaction: {
102
- mode: 'nearest',
103
- intersect: true
104
- },
105
-
106
- scales: {
107
- x: {
108
- type: 'linear',
109
- offset: true
110
- },
111
- y: {
112
- type: 'linear',
113
- reverse: true
114
- }
115
- },
116
- };
117
-
118
117
  /**
119
118
  * Helper function to get the bounds of the rect
120
119
  * @param {MatrixElement} rect the rect
@@ -185,6 +184,20 @@ function inRange(rect, x, y, useFinalPosition) {
185
184
  }
186
185
 
187
186
  class MatrixElement extends Chart.Element {
187
+
188
+ static id = 'matrix';
189
+
190
+ static defaults = {
191
+ backgroundColor: undefined,
192
+ borderColor: undefined,
193
+ borderWidth: undefined,
194
+ borderRadius: 0,
195
+ anchorX: 'center',
196
+ anchorY: 'center',
197
+ width: 20,
198
+ height: 20
199
+ };
200
+
188
201
  constructor(cfg) {
189
202
  super();
190
203
 
@@ -251,18 +264,6 @@ class MatrixElement extends Chart.Element {
251
264
  }
252
265
  }
253
266
 
254
- MatrixElement.id = 'matrix';
255
- MatrixElement.defaults = {
256
- backgroundColor: undefined,
257
- borderColor: undefined,
258
- borderWidth: undefined,
259
- borderRadius: 0,
260
- anchorX: 'center',
261
- anchorY: 'center',
262
- width: 20,
263
- height: 20
264
- };
265
-
266
267
  Chart.register(MatrixController, MatrixElement);
267
268
 
268
269
  }));
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * chartjs-chart-matrix v1.3.0
2
+ * chartjs-chart-matrix v2.0.0
3
3
  * https://chartjs-chart-matrix.pages.dev/
4
- * (c) 2022 Jukka Kurkela
4
+ * (c) 2023 Jukka Kurkela
5
5
  * Released under the MIT license
6
6
  */
7
- !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";class i 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,o){const s=this,h="reset"===o,{xScale:a,yScale:d}=s._cachedMeta,l=s.resolveDataElementOptions(e,o),u=s.getSharedOptions(o,t[e],l);for(let l=e;l<e+i;l++){const e=!h&&s.getParsed(l),i=h?a.getBasePixel():a.getPixelForValue(e.x),u=h?d.getBasePixel():d.getPixelForValue(e.y),c=s.resolveDataElementOptions(l,o),{width:g,height:p,anchorX:f,anchorY:x}=c,y={x:r(f,i,g),y:n(x,u,p),width:g,height:p,options:c};s.updateElement(t[l],l,y,o)}s.updateSharedOptions(u,o)}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 r(t,e,i){return"left"===t||"start"===t?e:"right"===t||"end"===t?e-i:e-i/2}function n(t,e,i){return"top"===t||"start"===t?e:"bottom"===t||"end"===t?e-i:e-i/2}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 s(t,e,i){return Math.max(Math.min(t,i),e)}function h(t){const i=o(t),r=i.right-i.left,n=i.bottom-i.top,h=function(t,i,r){const n=t.options.borderWidth;let o,h,a,d;return e.isObject(n)?(o=+n.top||0,h=+n.right||0,a=+n.bottom||0,d=+n.left||0):o=h=a=d=+n||0,{t:s(o,0,r),r:s(h,0,i),b:s(a,0,r),l:s(d,0,i)}}(t,r/2,n/2);return{outer:{x:i.left,y:i.top,w:r,h:n},inner:{x:i.left+h.l,y:i.top+h.t,w:r-h.l-h.r,h:n-h.t-h.b}}}function a(t,e,i,r){const n=null===e,s=null===i,h=!(!t||n&&s)&&o(t,r);return h&&(n||e>=h.left&&e<=h.right)&&(s||i>=h.top&&i<=h.bottom)}i.id="matrix",i.version="1.3.0",i.defaults={dataElementType:"matrix",animations:{numbers:{type:"number",properties:["x","y","width","height"]}}},i.overrides={interaction:{mode:"nearest",intersect:!0},scales:{x:{type:"linear",offset:!0},y:{type:"linear",reverse:!0}}};class d 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 i=this.options,{inner:r,outer:n}=h(this),o=e.toTRBLCorners(i.borderRadius);t.save(),n.w!==r.w||n.h!==r.h?(t.beginPath(),e.addRoundedRectPath(t,{x:n.x,y:n.y,w:n.w,h:n.h,radius:o}),e.addRoundedRectPath(t,{x:r.x,y:r.y,w:r.w,h:r.h,radius:o}),t.fillStyle=i.backgroundColor,t.fill(),t.fillStyle=i.borderColor,t.fill("evenodd")):(t.beginPath(),e.addRoundedRectPath(t,{x:r.x,y:r.y,w:r.w,h:r.h,radius:o}),t.fillStyle=i.backgroundColor,t.fill()),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}}d.id="matrix",d.defaults={backgroundColor:void 0,borderColor:void 0,borderWidth:void 0,borderRadius:0,anchorX:"center",anchorY:"center",width:20,height:20},t.register(i,d)}));
7
+ !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";class i extends t.DatasetController{static id="matrix";static version="2.0.0";static defaults={dataElementType:"matrix",animations:{numbers:{type:"number",properties:["x","y","width","height"]}}};static overrides={interaction:{mode:"nearest",intersect:!0},scales:{x:{type:"linear",offset:!0},y:{type:"linear",reverse:!0}}};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,o){const s=this,a="reset"===o,{xScale:h,yScale:d}=s._cachedMeta,l=s.resolveDataElementOptions(e,o),c=s.getSharedOptions(o,t[e],l);for(let l=e;l<e+i;l++){const e=!a&&s.getParsed(l),i=a?h.getBasePixel():h.getPixelForValue(e.x),c=a?d.getBasePixel():d.getPixelForValue(e.y),u=s.resolveDataElementOptions(l,o),{width:g,height:p,anchorX:f,anchorY:x}=u,y={x:r(f,i,g),y:n(x,c,p),width:g,height:p,options:u};s.updateElement(t[l],l,y,o)}s.updateSharedOptions(c,o)}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 r(t,e,i){return"left"===t||"start"===t?e:"right"===t||"end"===t?e-i:e-i/2}function n(t,e,i){return"top"===t||"start"===t?e:"bottom"===t||"end"===t?e-i:e-i/2}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 s(t,e,i){return Math.max(Math.min(t,i),e)}function a(t){const i=o(t),r=i.right-i.left,n=i.bottom-i.top,a=function(t,i,r){const n=t.options.borderWidth;let o,a,h,d;return e.isObject(n)?(o=+n.top||0,a=+n.right||0,h=+n.bottom||0,d=+n.left||0):o=a=h=d=+n||0,{t:s(o,0,r),r:s(a,0,i),b:s(h,0,r),l:s(d,0,i)}}(t,r/2,n/2);return{outer:{x:i.left,y:i.top,w:r,h:n},inner:{x:i.left+a.l,y:i.top+a.t,w:r-a.l-a.r,h:n-a.t-a.b}}}function h(t,e,i,r){const n=null===e,s=null===i,a=!(!t||n&&s)&&o(t,r);return a&&(n||e>=a.left&&e<=a.right)&&(s||i>=a.top&&i<=a.bottom)}class d extends t.Element{static id="matrix";static defaults={backgroundColor:void 0,borderColor:void 0,borderWidth:void 0,borderRadius:0,anchorX:"center",anchorY:"center",width:20,height:20};constructor(t){super(),this.options=void 0,this.width=void 0,this.height=void 0,t&&Object.assign(this,t)}draw(t){const i=this.options,{inner:r,outer:n}=a(this),o=e.toTRBLCorners(i.borderRadius);t.save(),n.w!==r.w||n.h!==r.h?(t.beginPath(),e.addRoundedRectPath(t,{x:n.x,y:n.y,w:n.w,h:n.h,radius:o}),e.addRoundedRectPath(t,{x:r.x,y:r.y,w:r.w,h:r.h,radius:o}),t.fillStyle=i.backgroundColor,t.fill(),t.fillStyle=i.borderColor,t.fill("evenodd")):(t.beginPath(),e.addRoundedRectPath(t,{x:r.x,y:r.y,w:r.w,h:r.h,radius:o}),t.fillStyle=i.backgroundColor,t.fill()),t.restore()}inRange(t,e,i){return h(this,t,e,i)}inXRange(t,e){return h(this,t,null,e)}inYRange(t,e){return h(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}}t.register(i,d)}));
8
8
  //# sourceMappingURL=chartjs-chart-matrix.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chartjs-chart-matrix.min.js","sources":["../src/controller.js","../src/element.js","../src/index.js"],"sourcesContent":["import {DatasetController} from 'chart.js';\nimport {version} from '../package.json';\n\nexport default class MatrixController extends DatasetController {\n initialize() {\n this.enableOptionSharing = true;\n super.initialize();\n }\n\n update(mode) {\n const me = this;\n const meta = me._cachedMeta;\n\n me.updateElements(meta.data, 0, meta.data.length, mode);\n }\n\n updateElements(rects, start, count, mode) {\n const me = this;\n const reset = mode === 'reset';\n const {xScale, yScale} = me._cachedMeta;\n const firstOpts = me.resolveDataElementOptions(start, mode);\n const sharedOptions = me.getSharedOptions(mode, rects[start], firstOpts);\n\n for (let i = start; i < start + count; i++) {\n const parsed = !reset && me.getParsed(i);\n const x = reset ? xScale.getBasePixel() : xScale.getPixelForValue(parsed.x);\n const y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(parsed.y);\n const options = me.resolveDataElementOptions(i, mode);\n const {width, height, anchorX, anchorY} = options;\n const properties = {\n x: resolveX(anchorX, x, width),\n y: resolveY(anchorY, y, height),\n width,\n height,\n options\n };\n me.updateElement(rects[i], i, properties, mode);\n }\n\n me.updateSharedOptions(sharedOptions, mode);\n }\n\n draw() {\n const me = this;\n const data = me.getMeta().data || [];\n let i, ilen;\n\n for (i = 0, ilen = data.length; i < ilen; ++i) {\n data[i].draw(me._ctx);\n }\n }\n}\n\nfunction resolveX(anchorX, x, width) {\n if (anchorX === 'left' || anchorX === 'start') {\n return x;\n }\n if (anchorX === 'right' || anchorX === 'end') {\n return x - width;\n }\n return x - width / 2;\n}\n\nfunction resolveY(anchorY, y, height) {\n if (anchorY === 'top' || anchorY === 'start') {\n return y;\n }\n if (anchorY === 'bottom' || anchorY === 'end') {\n return y - height;\n }\n return y - height / 2;\n}\n\nMatrixController.id = 'matrix';\n\nMatrixController.version = version;\n\nMatrixController.defaults = {\n dataElementType: 'matrix',\n\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'width', 'height']\n }\n },\n};\n\nMatrixController.overrides = {\n interaction: {\n mode: 'nearest',\n intersect: true\n },\n\n scales: {\n x: {\n type: 'linear',\n offset: true\n },\n y: {\n type: 'linear',\n reverse: true\n }\n },\n};\n","import {Element} from 'chart.js';\nimport {isObject, addRoundedRectPath, toTRBLCorners} from 'chart.js/helpers';\n\n/**\n * Helper function to get the bounds of the rect\n * @param {MatrixElement} rect the rect\n * @param {boolean} [useFinalPosition]\n * @return {object} bounds of the rect\n * @private\n */\nfunction getBounds(rect, useFinalPosition) {\n const {x, y, width, height} = rect.getProps(['x', 'y', 'width', 'height'], useFinalPosition);\n return {left: x, top: y, right: x + width, bottom: y + height};\n}\n\nfunction limit(value, min, max) {\n return Math.max(Math.min(value, max), min);\n}\n\nfunction parseBorderWidth(rect, maxW, maxH) {\n const value = rect.options.borderWidth;\n let t, r, b, l;\n\n if (isObject(value)) {\n t = +value.top || 0;\n r = +value.right || 0;\n b = +value.bottom || 0;\n l = +value.left || 0;\n } else {\n t = r = b = l = +value || 0;\n }\n\n return {\n t: limit(t, 0, maxH),\n r: limit(r, 0, maxW),\n b: limit(b, 0, maxH),\n l: limit(l, 0, maxW)\n };\n}\n\nfunction boundingRects(rect) {\n const bounds = getBounds(rect);\n const width = bounds.right - bounds.left;\n const height = bounds.bottom - bounds.top;\n const border = parseBorderWidth(rect, width / 2, height / 2);\n\n return {\n outer: {\n x: bounds.left,\n y: bounds.top,\n w: width,\n h: height\n },\n inner: {\n x: bounds.left + border.l,\n y: bounds.top + border.t,\n w: width - border.l - border.r,\n h: height - border.t - border.b\n }\n };\n}\n\nfunction inRange(rect, x, y, useFinalPosition) {\n const skipX = x === null;\n const skipY = y === null;\n const bounds = !rect || (skipX && skipY) ? false : getBounds(rect, useFinalPosition);\n\n return bounds\n\t\t&& (skipX || x >= bounds.left && x <= bounds.right)\n\t\t&& (skipY || y >= bounds.top && y <= bounds.bottom);\n}\n\nexport default class MatrixElement extends Element {\n constructor(cfg) {\n super();\n\n this.options = undefined;\n this.width = undefined;\n this.height = undefined;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n draw(ctx) {\n const options = this.options;\n const {inner, outer} = boundingRects(this);\n const radius = toTRBLCorners(options.borderRadius);\n\n ctx.save();\n\n if (outer.w !== inner.w || outer.h !== inner.h) {\n ctx.beginPath();\n addRoundedRectPath(ctx, {x: outer.x, y: outer.y, w: outer.w, h: outer.h, radius});\n addRoundedRectPath(ctx, {x: inner.x, y: inner.y, w: inner.w, h: inner.h, radius});\n ctx.fillStyle = options.backgroundColor;\n ctx.fill();\n ctx.fillStyle = options.borderColor;\n ctx.fill('evenodd');\n } else {\n ctx.beginPath();\n addRoundedRectPath(ctx, {x: inner.x, y: inner.y, w: inner.w, h: inner.h, radius});\n ctx.fillStyle = options.backgroundColor;\n ctx.fill();\n }\n\n ctx.restore();\n }\n\n inRange(mouseX, mouseY, useFinalPosition) {\n return inRange(this, mouseX, mouseY, useFinalPosition);\n }\n\n inXRange(mouseX, useFinalPosition) {\n return inRange(this, mouseX, null, useFinalPosition);\n }\n\n inYRange(mouseY, useFinalPosition) {\n return inRange(this, null, mouseY, useFinalPosition);\n }\n\n getCenterPoint(useFinalPosition) {\n const {x, y, width, height} = this.getProps(['x', 'y', 'width', 'height'], useFinalPosition);\n return {\n x: x + width / 2,\n y: y + height / 2\n };\n }\n\n tooltipPosition() {\n return this.getCenterPoint();\n }\n\n getRange(axis) {\n return axis === 'x' ? this.width / 2 : this.height / 2;\n }\n}\n\nMatrixElement.id = 'matrix';\nMatrixElement.defaults = {\n backgroundColor: undefined,\n borderColor: undefined,\n borderWidth: undefined,\n borderRadius: 0,\n anchorX: 'center',\n anchorY: 'center',\n width: 20,\n height: 20\n};\n","import Chart from 'chart.js';\nimport MatrixController from './controller';\nimport MatrixElement from './element';\n\nChart.register(MatrixController, MatrixElement);\n"],"names":["MatrixController","DatasetController","initialize","this","enableOptionSharing","super","update","mode","meta","_cachedMeta","updateElements","data","length","rects","start","count","me","reset","xScale","yScale","firstOpts","resolveDataElementOptions","sharedOptions","getSharedOptions","i","parsed","getParsed","x","getBasePixel","getPixelForValue","y","options","width","height","anchorX","anchorY","properties","resolveX","resolveY","updateElement","updateSharedOptions","draw","getMeta","ilen","_ctx","getBounds","rect","useFinalPosition","getProps","left","top","right","bottom","limit","value","min","max","Math","boundingRects","bounds","border","maxW","maxH","borderWidth","t","r","b","l","isObject","parseBorderWidth","outer","w","h","inner","inRange","skipX","skipY","id","version","defaults","dataElementType","animations","numbers","type","overrides","interaction","intersect","scales","offset","reverse","MatrixElement","Element","constructor","cfg","undefined","Object","assign","ctx","radius","toTRBLCorners","borderRadius","save","beginPath","addRoundedRectPath","fillStyle","backgroundColor","fill","borderColor","restore","mouseX","mouseY","inXRange","inYRange","getCenterPoint","tooltipPosition","getRange","axis","Chart","register"],"mappings":";;;;;;wTAGe,MAAMA,UAAyBC,EAAAA,kBAC5CC,aACEC,KAAKC,qBAAsB,EAC3BC,MAAMH,YACP,CAEDI,OAAOC,GACL,MACMC,EADKL,KACKM,YADLN,KAGRO,eAAeF,EAAKG,KAAM,EAAGH,EAAKG,KAAKC,OAAQL,EACnD,CAEDG,eAAeG,EAAOC,EAAOC,EAAOR,GAClC,MAAMS,EAAKb,KACLc,EAAiB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,gBACxBR,EAAIS,OACJT,EAAIO,UAAYzE,EAAQ4E,YACxBV,EAAIS,KAAK,aAETT,EAAIK,YACJC,EAAkBA,mBAACN,EAAK,CAACtE,EAAG8C,EAAM9C,EAAGG,EAAG2C,EAAM3C,EAAGyC,EAAGE,EAAMF,EAAGC,EAAGC,EAAMD,EAAG0B,WACzED,EAAIO,UAAYzE,EAAQ0E,gBACxBR,EAAIS,QAGNT,EAAIW,SACL,CAEDlC,QAAQmC,EAAQC,EAAQ/D,GACtB,OAAO2B,EAAQvE,KAAM0G,EAAQC,EAAQ/D,EACtC,CAEDgE,SAASF,EAAQ9D,GACf,OAAO2B,EAAQvE,KAAM0G,EAAQ,KAAM9D,EACpC,CAEDiE,SAASF,EAAQ/D,GACf,OAAO2B,EAAQvE,KAAM,KAAM2G,EAAQ/D,EACpC,CAEDkE,eAAelE,GACb,MAAMpB,EAACA,EAACG,EAAEA,EAACE,MAAEA,EAAKC,OAAEA,GAAU9B,KAAK6C,SAAS,CAAC,IAAK,IAAK,QAAS,UAAWD,GAC3E,MAAO,CACLpB,EAAGA,EAAIK,EAAQ,EACfF,EAAGA,EAAIG,EAAS,EAEnB,CAEDiF,kBACE,OAAO/G,KAAK8G,gBACb,CAEDE,SAASC,GACP,MAAgB,MAATA,EAAejH,KAAK6B,MAAQ,EAAI7B,KAAK8B,OAAS,CACtD,EAGHyD,EAAcb,GAAK,SACnBa,EAAcX,SAAW,CACvB0B,qBAAiBX,EACjBa,iBAAab,EACb/B,iBAAa+B,EACbM,aAAc,EACdlE,QAAS,SACTC,QAAS,SACTH,MAAO,GACPC,OAAQ,IChJVoF,EAAMC,SAAStH,EAAkB0F"}
1
+ {"version":3,"file":"chartjs-chart-matrix.min.js","sources":["../src/controller.js","../src/element.js","../src/index.js"],"sourcesContent":["import {DatasetController} from 'chart.js';\nimport {version} from '../package.json';\n\nexport default class MatrixController extends DatasetController {\n\n static id = 'matrix';\n static version = version;\n\n static defaults = {\n dataElementType: 'matrix',\n\n animations: {\n numbers: {\n type: 'number',\n properties: ['x', 'y', 'width', 'height']\n }\n },\n };\n\n static overrides = {\n interaction: {\n mode: 'nearest',\n intersect: true\n },\n scales: {\n x: {\n type: 'linear',\n offset: true\n },\n y: {\n type: 'linear',\n reverse: true\n }\n },\n };\n\n initialize() {\n this.enableOptionSharing = true;\n super.initialize();\n }\n\n update(mode) {\n const me = this;\n const meta = me._cachedMeta;\n\n me.updateElements(meta.data, 0, meta.data.length, mode);\n }\n\n updateElements(rects, start, count, mode) {\n const me = this;\n const reset = mode === 'reset';\n const {xScale, yScale} = me._cachedMeta;\n const firstOpts = me.resolveDataElementOptions(start, mode);\n const sharedOptions = me.getSharedOptions(mode, rects[start], firstOpts);\n\n for (let i = start; i < start + count; i++) {\n const parsed = !reset && me.getParsed(i);\n const x = reset ? xScale.getBasePixel() : xScale.getPixelForValue(parsed.x);\n const y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(parsed.y);\n const options = me.resolveDataElementOptions(i, mode);\n const {width, height, anchorX, anchorY} = options;\n const properties = {\n x: resolveX(anchorX, x, width),\n y: resolveY(anchorY, y, height),\n width,\n height,\n options\n };\n me.updateElement(rects[i], i, properties, mode);\n }\n\n me.updateSharedOptions(sharedOptions, mode);\n }\n\n draw() {\n const me = this;\n const data = me.getMeta().data || [];\n let i, ilen;\n\n for (i = 0, ilen = data.length; i < ilen; ++i) {\n data[i].draw(me._ctx);\n }\n }\n}\n\nfunction resolveX(anchorX, x, width) {\n if (anchorX === 'left' || anchorX === 'start') {\n return x;\n }\n if (anchorX === 'right' || anchorX === 'end') {\n return x - width;\n }\n return x - width / 2;\n}\n\nfunction resolveY(anchorY, y, height) {\n if (anchorY === 'top' || anchorY === 'start') {\n return y;\n }\n if (anchorY === 'bottom' || anchorY === 'end') {\n return y - height;\n }\n return y - height / 2;\n}\n","import {Element} from 'chart.js';\nimport {isObject, addRoundedRectPath, toTRBLCorners} from 'chart.js/helpers';\n\n/**\n * Helper function to get the bounds of the rect\n * @param {MatrixElement} rect the rect\n * @param {boolean} [useFinalPosition]\n * @return {object} bounds of the rect\n * @private\n */\nfunction getBounds(rect, useFinalPosition) {\n const {x, y, width, height} = rect.getProps(['x', 'y', 'width', 'height'], useFinalPosition);\n return {left: x, top: y, right: x + width, bottom: y + height};\n}\n\nfunction limit(value, min, max) {\n return Math.max(Math.min(value, max), min);\n}\n\nfunction parseBorderWidth(rect, maxW, maxH) {\n const value = rect.options.borderWidth;\n let t, r, b, l;\n\n if (isObject(value)) {\n t = +value.top || 0;\n r = +value.right || 0;\n b = +value.bottom || 0;\n l = +value.left || 0;\n } else {\n t = r = b = l = +value || 0;\n }\n\n return {\n t: limit(t, 0, maxH),\n r: limit(r, 0, maxW),\n b: limit(b, 0, maxH),\n l: limit(l, 0, maxW)\n };\n}\n\nfunction boundingRects(rect) {\n const bounds = getBounds(rect);\n const width = bounds.right - bounds.left;\n const height = bounds.bottom - bounds.top;\n const border = parseBorderWidth(rect, width / 2, height / 2);\n\n return {\n outer: {\n x: bounds.left,\n y: bounds.top,\n w: width,\n h: height\n },\n inner: {\n x: bounds.left + border.l,\n y: bounds.top + border.t,\n w: width - border.l - border.r,\n h: height - border.t - border.b\n }\n };\n}\n\nfunction inRange(rect, x, y, useFinalPosition) {\n const skipX = x === null;\n const skipY = y === null;\n const bounds = !rect || (skipX && skipY) ? false : getBounds(rect, useFinalPosition);\n\n return bounds\n\t\t&& (skipX || x >= bounds.left && x <= bounds.right)\n\t\t&& (skipY || y >= bounds.top && y <= bounds.bottom);\n}\n\nexport default class MatrixElement extends Element {\n\n static id = 'matrix';\n\n static defaults = {\n backgroundColor: undefined,\n borderColor: undefined,\n borderWidth: undefined,\n borderRadius: 0,\n anchorX: 'center',\n anchorY: 'center',\n width: 20,\n height: 20\n };\n\n constructor(cfg) {\n super();\n\n this.options = undefined;\n this.width = undefined;\n this.height = undefined;\n\n if (cfg) {\n Object.assign(this, cfg);\n }\n }\n\n draw(ctx) {\n const options = this.options;\n const {inner, outer} = boundingRects(this);\n const radius = toTRBLCorners(options.borderRadius);\n\n ctx.save();\n\n if (outer.w !== inner.w || outer.h !== inner.h) {\n ctx.beginPath();\n addRoundedRectPath(ctx, {x: outer.x, y: outer.y, w: outer.w, h: outer.h, radius});\n addRoundedRectPath(ctx, {x: inner.x, y: inner.y, w: inner.w, h: inner.h, radius});\n ctx.fillStyle = options.backgroundColor;\n ctx.fill();\n ctx.fillStyle = options.borderColor;\n ctx.fill('evenodd');\n } else {\n ctx.beginPath();\n addRoundedRectPath(ctx, {x: inner.x, y: inner.y, w: inner.w, h: inner.h, radius});\n ctx.fillStyle = options.backgroundColor;\n ctx.fill();\n }\n\n ctx.restore();\n }\n\n inRange(mouseX, mouseY, useFinalPosition) {\n return inRange(this, mouseX, mouseY, useFinalPosition);\n }\n\n inXRange(mouseX, useFinalPosition) {\n return inRange(this, mouseX, null, useFinalPosition);\n }\n\n inYRange(mouseY, useFinalPosition) {\n return inRange(this, null, mouseY, useFinalPosition);\n }\n\n getCenterPoint(useFinalPosition) {\n const {x, y, width, height} = this.getProps(['x', 'y', 'width', 'height'], useFinalPosition);\n return {\n x: x + width / 2,\n y: y + height / 2\n };\n }\n\n tooltipPosition() {\n return this.getCenterPoint();\n }\n\n getRange(axis) {\n return axis === 'x' ? this.width / 2 : this.height / 2;\n }\n}\n","import Chart from 'chart.js';\nimport MatrixController from './controller';\nimport MatrixElement from './element';\n\nChart.register(MatrixController, MatrixElement);\n"],"names":["MatrixController","DatasetController","static","dataElementType","animations","numbers","type","properties","interaction","mode","intersect","scales","x","offset","y","reverse","initialize","this","enableOptionSharing","super","update","meta","_cachedMeta","updateElements","data","length","rects","start","count","me","reset","xScale","yScale","firstOpts","resolveDataElementOptions","sharedOptions","getSharedOptions","i","parsed","getParsed","getBasePixel","getPixelForValue","options","width","height","anchorX","anchorY","resolveX","resolveY","updateElement","updateSharedOptions","draw","getMeta","ilen","_ctx","getBounds","rect","useFinalPosition","getProps","left","top","right","bottom","limit","value","min","max","Math","boundingRects","bounds","border","maxW","maxH","borderWidth","t","r","b","l","isObject","parseBorderWidth","outer","w","h","inner","inRange","skipX","skipY","MatrixElement","Element","backgroundColor","undefined","borderColor","borderRadius","constructor","cfg","Object","assign","ctx","radius","toTRBLCorners","save","beginPath","addRoundedRectPath","fillStyle","fill","restore","mouseX","mouseY","inXRange","inYRange","getCenterPoint","tooltipPosition","getRange","axis","Chart","register"],"mappings":";;;;;;wTAGe,MAAMA,UAAyBC,EAAAA,kBAE5CC,UAAY,SACZA,uBAEAA,gBAAkB,CAChBC,gBAAiB,SAEjBC,WAAY,CACVC,QAAS,CACPC,KAAM,SACNC,WAAY,CAAC,IAAK,IAAK,QAAS,aAKtCL,iBAAmB,CACjBM,YAAa,CACXC,KAAM,UACNC,WAAW,GAEbC,OAAQ,CACNC,EAAG,CACDN,KAAM,SACNO,QAAQ,GAEVC,EAAG,CACDR,KAAM,SACNS,SAAS,KAKfC,aACEC,KAAKC,qBAAsB,EAC3BC,MAAMH,YACP,CAEDI,OAAOX,GACL,MACMY,EADKJ,KACKK,YADLL,KAGRM,eAAeF,EAAKG,KAAM,EAAGH,EAAKG,KAAKC,OAAQhB,EACnD,CAEDc,eAAeG,EAAOC,EAAOC,EAAOnB,GAClC,MAAMoB,EAAKZ,KACLa,EAAiB,UAATrB,GACRsB,OAACA,EAAMC,OAAEA,GAAUH,EAAGP,YACtBW,EAAYJ,EAAGK,0BAA0BP,EAAOlB,GAChD0B,EAAgBN,EAAGO,iBAAiB3B,EAAMiB,EAAMC,GAAQM,GAE9D,IAAK,IAAII,EAAIV,EAAOU,EAAIV,EAAQC,EAAOS,IAAK,CAC1C,MAAMC,GAAUR,GAASD,EAAGU,UAAUF,GAChCzB,EAAIkB,EAAQC,EAAOS,eAAiBT,EAAOU,iBAAiBH,EAAO1B,GACnEE,EAAIgB,EAAQE,EAAOQ,eAAiBR,EAAOS,iBAAiBH,EAAOxB,GACnE4B,EAAUb,EAAGK,0BAA0BG,EAAG5B,IAC1CkC,MAACA,E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,EAAKC,OAAEA,GAAU3B,KAAKyC,SAAS,CAAC,IAAK,IAAK,QAAS,UAAWD,GAC3E,MAAO,CACL7C,EAAGA,EAAI+B,EAAQ,EACf7B,EAAGA,EAAI8B,EAAS,EAEnB,CAEDmE,kBACE,OAAO9F,KAAK6F,gBACb,CAEDE,SAASC,GACP,MAAgB,MAATA,EAAehG,KAAK0B,MAAQ,EAAI1B,KAAK2B,OAAS,CACtD,EClJHsE,EAAMC,SAASnH,EAAkBuF"}
package/package.json CHANGED
@@ -1,14 +1,25 @@
1
1
  {
2
2
  "name": "chartjs-chart-matrix",
3
- "version": "1.3.0",
3
+ "version": "2.0.0",
4
4
  "description": "Chart.js module for creating matrix charts",
5
- "main": "dist/chartjs-chart-matrix.js",
6
- "module": "dist/chartjs-chart-matrix.esm.js",
5
+ "type": "module",
6
+ "main": "dist/chartjs-chart-matrix.esm.js",
7
7
  "types": "types/index.esm.d.ts",
8
+ "jsdelivr": "dist/chartjs-chart-matrix.min.js",
9
+ "unpkg": "dist/chartjs-chart-matrix.min.js",
10
+ "exports": {
11
+ "types": "./types/index.esm.d.ts",
12
+ "import": "./dist/chartjs-chart-matrix.esm.js",
13
+ "require": "./dist/chartjs-chart-matrix.min.js"
14
+ },
15
+ "sideEffects": [
16
+ "dist/chartjs-chart-matrix.js",
17
+ "dist/chartjs-chart-matrix-min.js"
18
+ ],
8
19
  "scripts": {
9
20
  "autobuild": "rollup -c -w",
10
21
  "build": "rollup -c",
11
- "dev": "karma start --no-signle-run --auto-watch --browsers chrome",
22
+ "dev": "karma start ./karma.conf.cjs --no-signle-run --auto-watch --browsers chrome",
12
23
  "docs": "npm run build && vuepress build docs --no-cache",
13
24
  "docs:dev": "npm run build && vuepress dev docs --no-cache",
14
25
  "lint": "concurrently -r \"npm:lint-*\"",
@@ -17,7 +28,7 @@
17
28
  "lint-types": "eslint \"types/**/*.ts\" && tsc -p types/tests/",
18
29
  "test": "cross-env NODE_ENV=test concurrently \"npm:test-*\"",
19
30
  "test-lint": "npm run lint",
20
- "test-karma": "karma start --auto-watch --single-run"
31
+ "test-karma": "karma start ./karma.conf.cjs --auto-watch --single-run"
21
32
  },
22
33
  "repository": {
23
34
  "type": "git",
@@ -30,6 +41,7 @@
30
41
  ],
31
42
  "files": [
32
43
  "dist/*",
44
+ "!dist/docs/**",
33
45
  "types/index.esm.d.ts"
34
46
  ],
35
47
  "author": "Jukka Kurkela",
@@ -39,15 +51,12 @@
39
51
  },
40
52
  "homepage": "https://chartjs-chart-matrix.pages.dev/",
41
53
  "devDependencies": {
42
- "@babel/core": "^7.20.2",
43
- "@babel/preset-env": "^7.20.2",
44
54
  "@rollup/plugin-commonjs": "^23.0.2",
45
55
  "@rollup/plugin-json": "^5.0.1",
46
56
  "@rollup/plugin-node-resolve": "^15.0.1",
47
57
  "@rollup/plugin-terser": "^0.1.0",
48
58
  "@typescript-eslint/eslint-plugin": "^5.6.0",
49
59
  "@typescript-eslint/parser": "^5.6.0",
50
- "babel-loader": "^8.3.0",
51
60
  "chart.js": "^4.0.1",
52
61
  "chartjs-adapter-date-fns": "^2.0.0",
53
62
  "chartjs-test-utils": "^0.5.0",
@@ -67,7 +76,7 @@
67
76
  "karma-jasmine": "^5.1.0",
68
77
  "karma-jasmine-html-reporter": "^2.0.0",
69
78
  "karma-rollup-preprocessor": "7.0.7",
70
- "karma-spec-reporter": "^0.0.34",
79
+ "karma-spec-reporter": "^0.0.35",
71
80
  "pixelmatch": "^5.2.1",
72
81
  "rollup": "^3.3.0",
73
82
  "rollup-plugin-analyzer": "^4.0.0",
@@ -76,8 +85,7 @@
76
85
  "vuepress": "^1.9.7",
77
86
  "vuepress-plugin-flexsearch": "^0.3.0",
78
87
  "vuepress-plugin-redirect": "^1.2.5",
79
- "vuepress-theme-chartjs": "^0.2.0",
80
- "webpack": "^4.46.0"
88
+ "vuepress-theme-chartjs": "^0.2.0"
81
89
  },
82
90
  "peerDependencies": {
83
91
  "chart.js": ">=3.0.0"