Skip to content

Commit 6af9eea

Browse files
authored
Merge pull request #293 from sgratzl/release/v4.3.5
Release v4.3.5
2 parents 60030f4 + b3a4293 commit 6af9eea

File tree

9 files changed

+3409
-2877
lines changed

9 files changed

+3409
-2877
lines changed

.yarn/releases/yarn-4.10.3.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-4.5.1.cjs

Lines changed: 0 additions & 934 deletions
This file was deleted.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
yarnPath: .yarn/releases/yarn-4.5.1.cjs
1+
yarnPath: .yarn/releases/yarn-4.10.3.cjs

package.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "chartjs-chart-geo",
33
"description": "Chart.js module for charting maps",
4-
"version": "4.3.4",
4+
"version": "4.3.5",
55
"author": {
66
"name": "Samuel Gratzl",
77
"email": "sam@sgratzl.com",
@@ -50,7 +50,7 @@
5050
},
5151
"dependencies": {
5252
"@types/d3-geo": "^3.1.0",
53-
"@types/d3-scale-chromatic": "^3.0.3",
53+
"@types/d3-scale-chromatic": "^3.1.0",
5454
"@types/topojson-client": "^3.1.5",
5555
"d3-array": "^3.2.4",
5656
"d3-color": "^3.1.0",
@@ -61,41 +61,41 @@
6161
},
6262
"devDependencies": {
6363
"@chiogen/rollup-plugin-terser": "^7.1.3",
64-
"@eslint/js": "~9.14.0",
65-
"@rollup/plugin-commonjs": "^28.0.1",
66-
"@rollup/plugin-node-resolve": "^15.3.0",
67-
"@rollup/plugin-replace": "^6.0.1",
68-
"@rollup/plugin-typescript": "^12.1.1",
64+
"@eslint/js": "^9.37.0",
65+
"@rollup/plugin-commonjs": "^28.0.6",
66+
"@rollup/plugin-node-resolve": "^16.0.2",
67+
"@rollup/plugin-replace": "^6.0.2",
68+
"@rollup/plugin-typescript": "^12.1.4",
6969
"@types/jest-image-snapshot": "^6.4.0",
70-
"@types/node": "^22.9.0",
70+
"@types/node": "^24.6.2",
7171
"@types/seedrandom": "^3",
72-
"@yarnpkg/sdks": "^3.2.0",
73-
"canvas": "^2.11.2",
72+
"@yarnpkg/sdks": "^3.2.3",
73+
"canvas": "^3.2.0",
7474
"canvas-5-polyfill": "^0.1.5",
75-
"chart.js": "^4.4.6",
75+
"chart.js": "^4.5.0",
7676
"chartjs-plugin-datalabels": "^2.2.0",
77-
"eslint": "~9.14.0",
78-
"eslint-plugin-prettier": "^5.2.1",
79-
"jest-image-snapshot": "^6.4.0",
80-
"jsdom": "^25.0.1",
81-
"prettier": "^3.3.3",
77+
"eslint": "^9.37.0",
78+
"eslint-plugin-prettier": "^5.5.4",
79+
"jest-image-snapshot": "^6.5.1",
80+
"jsdom": "^27.0.0",
81+
"prettier": "^3.6.2",
8282
"rimraf": "^6.0.1",
83-
"rollup": "^4.27.2",
83+
"rollup": "^4.52.4",
8484
"rollup-plugin-cleanup": "^3.2.1",
85-
"rollup-plugin-dts": "^6.1.1",
85+
"rollup-plugin-dts": "^6.2.3",
8686
"seedrandom": "^3.0.5",
87-
"ts-jest": "^29.2.5",
87+
"ts-jest": "^29.4.4",
8888
"tslib": "^2.8.1",
89-
"typedoc": "^0.26.11",
90-
"typedoc-plugin-markdown": "^4.2.10",
91-
"typedoc-vitepress-theme": "^1.0.2",
92-
"typescript": "^5.6.3",
93-
"typescript-eslint": "^8.14.0",
89+
"typedoc": "^0.28.13",
90+
"typedoc-plugin-markdown": "^4.9.0",
91+
"typedoc-vitepress-theme": "^1.1.2",
92+
"typescript": "^5.9.3",
93+
"typescript-eslint": "^8.45.0",
9494
"us-atlas": "^3.0.1",
95-
"vite": "^5.4.11",
96-
"vitepress": "^1.5.0",
97-
"vitest": "^2.1.5",
98-
"vue": "^3.5.13",
95+
"vite": "^7.1.9",
96+
"vitepress": "^1.6.4",
97+
"vitest": "^3.2.4",
98+
"vue": "^3.5.22",
9999
"vue-chartjs": "^5.3.2",
100100
"world-atlas": "^2.0.2"
101101
},
@@ -120,5 +120,5 @@
120120
"docs:build": "yarn run docs:api && vitepress build docs",
121121
"docs:preview": "vitepress preview docs"
122122
},
123-
"packageManager": "yarn@4.5.1"
123+
"packageManager": "yarn@4.10.3"
124124
}

samples/geo.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</head>
77

88
<body>
9-
<div>
9+
<div style="width: 90vw; height: 90vh">
1010
<canvas id="canvas"></canvas>
1111
</div>
1212
<script>
@@ -31,7 +31,8 @@
3131
],
3232
},
3333
options: {
34-
lscales: {
34+
// responsive: true,
35+
scales: {
3536
projection: {
3637
axis: 'x',
3738
projection: 'albersUsa',

src/controllers/ChoroplethController.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ export class ChoroplethController extends GeoController<'choropleth', GeoFeature
6868
for (let i = start; i < start + count; i += 1) {
6969
const elem = elems[i];
7070
elem.projectionScale = scale;
71-
elem.feature = (this as any)._data[i].feature;
72-
elem.center = (this as any)._data[i].center;
73-
elem.pixelRatio = this.chart.currentDevicePixelRatio;
74-
const center = elem.getCenterPoint();
71+
const center = elem.updateExtras({
72+
scale,
73+
feature: (this as any)._data[i].feature,
74+
center: (this as any)._data[i].center,
75+
pixelRatio: this.chart.currentDevicePixelRatio,
76+
mode,
77+
});
7578

7679
const properties: IGeoFeatureProps & { options?: PointOptions } = {
7780
x: center.x,

src/controllers/GeoController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class GeoController<
9898
const meta = this.getMeta();
9999

100100
const scale = this.getProjectionScale();
101-
const dirtyCache = scale.updateBounds();
101+
const dirtyCache = scale.updateBounds() || mode === 'resize' || mode === 'reset';
102102

103103
if (this.showOutline()) {
104104
const elem = meta.dataset!;
@@ -122,10 +122,10 @@ export class GeoController<
122122
(meta as any).graticule = patchDatasetElementOptions(this.resolveDatasetElementOptions(mode));
123123
}
124124

125-
this.updateElements(meta.data, 0, meta.data.length, mode);
126125
if (dirtyCache) {
127126
meta.data.forEach((elem) => delete (elem as any).cache);
128127
}
128+
this.updateElements(meta.data, 0, meta.data.length, mode);
129129
}
130130

131131
resolveOutline(): any {

src/elements/GeoFeature.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
ScriptableAndArrayOptions,
99
CommonHoverOptions,
1010
ScriptableContext,
11+
UpdateMode,
1112
} from 'chart.js';
1213
import { geoContains, GeoPath, GeoProjection } from 'd3-geo';
1314
import type { ProjectionScale } from '../scales';
@@ -103,6 +104,37 @@ export class GeoFeature extends Element<IGeoFeatureProps, IGeoFeatureOptions> im
103104
*/
104105
pixelRatio?: number;
105106

107+
updateExtras({
108+
scale,
109+
feature,
110+
center,
111+
pixelRatio,
112+
mode,
113+
}: {
114+
scale: ProjectionScale;
115+
feature: Feature;
116+
center?: { longitude: number; latitude: number };
117+
pixelRatio: number;
118+
mode: UpdateMode;
119+
}): Point {
120+
const changed =
121+
mode === 'resize' ||
122+
mode === 'reset' ||
123+
this.projectionScale !== scale ||
124+
this.feature !== feature ||
125+
this.center?.longitude !== center?.longitude ||
126+
this.center?.latitude !== center?.latitude ||
127+
this.pixelRatio !== pixelRatio;
128+
this.projectionScale = scale;
129+
this.feature = feature;
130+
this.center = center;
131+
this.pixelRatio = pixelRatio;
132+
if (changed) {
133+
this.cache = undefined;
134+
}
135+
return this.getCenterPoint();
136+
}
137+
106138
/**
107139
* @hidden
108140
*/

0 commit comments

Comments
 (0)