From 264816c5be1f1103249a07104a23c600a94bb58b Mon Sep 17 00:00:00 2001 From: Abhijit Shyamal Date: Wed, 7 Jan 2026 16:48:58 +0530 Subject: [PATCH 1/2] The documentation and type correctness of dataElementType #12169 --- src/core/core.controller.js | 15 ++++++++++++--- src/core/core.datasetController.js | 14 +++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/core/core.controller.js b/src/core/core.controller.js index e0408ae212a..4c6bb1cbb71 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -440,10 +440,19 @@ class Chart { meta.controller.linkScales(); } else { const ControllerClass = registry.getController(type); - const {datasetElementType, dataElementType} = defaults.datasets[type]; + let defaultDataElementType = defaults.datasets[type].dataElementType; + let defaultDatasetElementType = defaults.datasets[type].datasetElementType; + + if (defaultDataElementType === undefined) { + defaultDataElementType = ControllerClass.dataElementType; + } + if (defaultDatasetElementType === undefined) { + defaultDatasetElementType = ControllerClass.datasetElementType; + } + Object.assign(ControllerClass, { - dataElementType: registry.getElement(dataElementType), - datasetElementType: datasetElementType && registry.getElement(datasetElementType) + dataElementType: defaultDataElementType ? registry.getElement(defaultDataElementType) : defaultDataElementType, + datasetElementType: defaultDatasetElementType ? registry.getElement(defaultDatasetElementType) : defaultDatasetElementType }); meta.controller = new ControllerClass(this, i); newControllers.push(meta.controller); diff --git a/src/core/core.datasetController.js b/src/core/core.datasetController.js index 9b7126a93fd..0f054568719 100644 --- a/src/core/core.datasetController.js +++ b/src/core/core.datasetController.js @@ -271,8 +271,8 @@ export default class DatasetController { this.supportsDecimation = false; this.$context = undefined; this._syncList = []; - this.datasetElementType = new.target.datasetElementType; - this.dataElementType = new.target.dataElementType; + this.datasetElementType = valueOrDefault(new.target.datasetElementType, null); + this.dataElementType = valueOrDefault(new.target.dataElementType, null); this.initialize(); } @@ -786,6 +786,9 @@ export default class DatasetController { * @protected */ resolveDatasetElementOptions(mode) { + if (!this.datasetElementType) { + return {}; + } return this._resolveElementOptions(this.datasetElementType.id, mode); } @@ -795,6 +798,9 @@ export default class DatasetController { * @protected */ resolveDataElementOptions(index, mode) { + if (!this.dataElementType) { + return {}; + } return this._resolveElementOptions(this.dataElementType.id, mode, index); } @@ -982,7 +988,9 @@ export default class DatasetController { } if (numData > numMeta) { - this._insertElements(numMeta, numData - numMeta, resetNewElements); + if (this.dataElementType) { + this._insertElements(numMeta, numData - numMeta, resetNewElements); + } } else if (numData < numMeta) { this._removeElements(numData, numMeta - numData); } From 68255660d3f8df034d368a0457927bc374280778 Mon Sep 17 00:00:00 2001 From: Abhijit Shyamal Date: Wed, 7 Jan 2026 16:50:23 +0530 Subject: [PATCH 2/2] soluction.patch --- solution.patch | Bin 0 -> 6200 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 solution.patch diff --git a/solution.patch b/solution.patch new file mode 100644 index 0000000000000000000000000000000000000000..012ad8142c32bff8d5425a6137fa7c17312289ba GIT binary patch literal 6200 zcmd5=T~8BH5S>>|{10nlOlx5U!dLwy0pC;}^ogOyT5-OOIJ>CWwMOxBfbrB-;&2NkiN9>zb#*J*D2iP?pY5j`}pk? zR|j{we8!$kj^^HbPwqm0PmUq)J0x{vMb`1z2A+|2!hPSx;-|AJ z!_)9OgHMK7H7y#a&X-^09sJaCF&aos>hd%q?;5f@STn%iOr~ih6M9%fhU~igkO8{| z3!Y;QSwlu~M_;ah^rOQZ+grn$D>=vShLAA~ucH2+U`fl_Ps~Gk*6bDIkA#+Cy;mnIYS`M$NN zd?`;ZhB77Duxi$Y5zoLL)}~rzk3M%%y%<%K6PF7eNU1}b^1JLE>aHHS7@K`2%p0j| zm!)NlX@8{r%n1HnuiT{VrYhlmlagfom}G`|h`gEnEt7rphR?|9HnKKH{;{rhQGa^i zQaWO+8Oo4y1yY7+-HB)36YQQ=_re|IbV^bk{X+X$**agwLO0vsS1NXWyeSE9Y&|?v&rA>r3s*WN{y)v5Ma zb2~lPXdmh!v%eua=}hKK@yX2}%;|1Ir^<^-<0Np7sbBy}HA!Q$$z{HoI?U7H>O9(?IrIx9Wmp>Lm;|>gtokPIb$*o#O7V!54{y(1i}ty zQ+P3Fb714iMo$7&CV-Uo`Sr$kPR<NkIi{x{is2ihLtvx9u)I}c_VCrh3vw8QC&#|29{1rD(GR4#EB){4+~`;clG&olZN zc5wn?*VReX$Jgfn``DqqZMGbW$zmNL$|2a)MX+1Xq^O)fmMc{Jrf=N&Cjp%+{wE6H2P{#KG~p7(W(xU80Wd{zrW zWH<5hHrr@1wRnbaTFnEKv3*wZvd>AAr2oC|wEnVpu-}9p^s%)*;d^R}t*x@S Id7Wy{AB(Q%#sB~S literal 0 HcmV?d00001