Skip to content

Commit

Permalink
Merge pull request #174 from sgratzl/release/v4.2.0
Browse files Browse the repository at this point in the history
Release v4.2.0
  • Loading branch information
sgratzl authored Apr 29, 2023
2 parents 4036bdf + 501c899 commit f937fa4
Show file tree
Hide file tree
Showing 23 changed files with 2,249 additions and 2,055 deletions.
823 changes: 0 additions & 823 deletions .yarn/releases/yarn-3.3.1.cjs

This file was deleted.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ packageExtensions:
dependencies:
eslint-import-resolver-node: "*"

yarnPath: .yarn/releases/yarn-3.3.1.cjs
yarnPath: .yarn/releases/yarn-3.5.0.cjs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ A data point has to have a `.feature` property containing the feature to render
- topojson collection: https://github.com/deldersveld/topojson (untested)

```js
const us = await fetch(' https://cdn.jsdelivr.net/npm/us-atlas/states-10m.json').then((r) => r.json());
const us = await fetch('https://cdn.jsdelivr.net/npm/us-atlas/states-10m.json').then((r) => r.json());

// whole US for the outline
const nation = ChartGeo.topojson.feature(us, us.objects.nation).features[0];
Expand Down
60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "chartjs-chart-geo",
"description": "Chart.js module for charting maps",
"version": "4.1.2",
"version": "4.2.0",
"author": {
"name": "Samuel Gratzl",
"email": "[email protected]",
Expand Down Expand Up @@ -53,7 +53,7 @@
"@types/d3-geo": "^3.0.3",
"@types/d3-scale-chromatic": "^3.0.0",
"@types/topojson-client": "^3.1.1",
"d3-array": "^3.2.1",
"d3-array": "^3.2.3",
"d3-color": "^3.1.0",
"d3-geo": "^3.1.0",
"d3-interpolate": "^3.0.1",
Expand All @@ -62,49 +62,49 @@
},
"devDependencies": {
"@chiogen/rollup-plugin-terser": "^7.1.3",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-commonjs": "^24.1.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-replace": "^5.0.2",
"@rollup/plugin-typescript": "^11.0.0",
"@types/jest": "^29.2.5",
"@rollup/plugin-typescript": "^11.1.0",
"@types/jest": "^29.5.1",
"@types/jest-image-snapshot": "^6.1.0",
"@types/node": "^18.11.18",
"@types/seedrandom": "^3.0.4",
"@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.48.1",
"@types/node": "^18.16.3",
"@types/seedrandom": "^3.0.5",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"@yarnpkg/pnpify": "^3.1.6",
"@yarnpkg/sdks": "^2.6.3",
"canvas": "^2.11.0",
"@yarnpkg/sdks": "^2.7.0",
"canvas": "^2.11.2",
"canvas-5-polyfill": "^0.1.5",
"chart.js": "^4.1.2",
"eslint": "^8.31.0",
"chart.js": "^4.3.0",
"eslint": "^8.39.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.27.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-image-snapshot": "^6.1.0",
"prettier": "^2.8.3",
"rimraf": "^4.0.5",
"rollup": "^3.10.0",
"prettier": "^2.8.8",
"rimraf": "^5.0.0",
"rollup": "^3.21.1",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-dts": "^5.1.1",
"rollup-plugin-dts": "^5.3.0",
"seedrandom": "^3.0.5",
"ts-jest": "^29.0.5",
"tslib": "^2.4.1",
"typedoc": "^0.23.24",
"typescript": "^4.9.4",
"us-atlas": "^3.0.0",
"ts-jest": "^29.1.0",
"tslib": "^2.5.0",
"typedoc": "^0.24.6",
"typescript": "^5.0.4",
"us-atlas": "^3.0.1",
"world-atlas": "^2.0.2"
},
"scripts": {
"clean": "rimraf build docs node_modules \"*.tgz\" \"*.tsbuildinfo\"",
"clean": "rimraf --glob build docs node_modules \"*.tgz\" \"*.tsbuildinfo\"",
"compile": "tsc -b tsconfig.c.json",
"compile:types": "tsc -p tsconfig.c.json --emitDeclarationOnly",
"start": "yarn run watch",
Expand All @@ -123,5 +123,5 @@
"docs": "typedoc src/index.ts",
"prepare": "yarn run build"
},
"packageManager": "yarn@3.3.1"
"packageManager": "yarn@3.5.0"
}
2 changes: 1 addition & 1 deletion samples/albers.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion samples/albersCustom.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion samples/albersLegend.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion samples/albersLog.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion samples/albersProjection.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion samples/bubbleMap.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src=" https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels@next"></script>
<script src="../build/index.umd.js"></script>
<script src=" https://cdn.jsdelivr.net/npm/papaparse"></script>
Expand Down
2 changes: 1 addition & 1 deletion samples/bubbleMapArea.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<!-- <script src=" https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script> -->
<script src="../build/index.umd.js"></script>
<script src=" https://cdn.jsdelivr.net/npm/papaparse"></script>
Expand Down
2 changes: 1 addition & 1 deletion samples/bubbleMapLog.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<!-- <script src=" https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script> -->
<script src="../build/index.umd.js"></script>
<script src=" https://cdn.jsdelivr.net/npm/papaparse"></script>
Expand Down
2 changes: 1 addition & 1 deletion samples/changing.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
4 changes: 2 additions & 2 deletions samples/default_esm.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<script type="importmap-shim">
{
"imports": {
"chart.js": " https://cdn.jsdelivr.net/npm/chart.js@~4.1.1?module",
"chart.js/helpers": " https://cdn.jsdelivr.net/npm/chart.js@~4.1.1/helpers/helpers.esm.js?module",
"chart.js": " https://cdn.jsdelivr.net/npm/chart.js@~4.3.0?module",
"chart.js/helpers": " https://cdn.jsdelivr.net/npm/chart.js@~4.3.0/helpers/helpers.esm.js?module",
"chartjs-chart-geo": "../build/index.js",
"d3-geo": " https://cdn.jsdelivr.net/npm/d3-geo?module",
"d3-scale-chromatic": " https://cdn.jsdelivr.net/npm/d3-scale-chromatic?module",
Expand Down
2 changes: 1 addition & 1 deletion samples/earth.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion samples/earth_click.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion samples/france.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src=" https://cdn.jsdelivr.net/npm/d3@v6"></script>
<script src=" https://cdn.jsdelivr.net/npm/d3-composite-projections"></script>
<script src="../build/index.umd.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion samples/germany.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
2 changes: 1 addition & 1 deletion samples/worldCenter.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.1.1"></script>
<script src=" https://cdn.jsdelivr.net/npm/chart.js@~4.3.0"></script>
<script src=" https://cdn.jsdelivr.net/npm/papaparse"></script>
<script src="../build/index.umd.js"></script>
</head>
Expand Down
17 changes: 13 additions & 4 deletions src/elements/GeoFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,13 @@ export class GeoFeature extends Element<IGeoFeatureProps, IGeoFeatureOptions> im
const x2 = Math.ceil(bounds.x + bounds.width);
const y2 = Math.ceil(bounds.y + bounds.height);
const pixelRatio = this.pixelRatio || 1;
canvas.width = Math.max(x2 - x1, 1) * pixelRatio;
canvas.height = Math.max(y2 - y1, 1) * pixelRatio;
const width = Math.ceil(Math.max(x2 - x1, 1) * pixelRatio);
const height = Math.ceil(Math.max(y2 - y1, 1) * pixelRatio);
if (width <= 0 || height <= 0) {
return;
}
canvas.width = width;
canvas.height = height;

const ctx = canvas.getContext('2d');
if (ctx) {
Expand Down Expand Up @@ -208,12 +213,16 @@ export class GeoFeature extends Element<IGeoFeatureProps, IGeoFeatureOptions> im
this._drawInCache(ctx.canvas.ownerDocument);
}
const bounds = this.getBounds();
if (this.cache && this.cache.canvas) {
if (this.cache && this.cache.canvas && this.cache.canvas.width > 0 && this.cache.canvas.height > 0) {
const x1 = Math.floor(bounds.x);
const y1 = Math.floor(bounds.y);
const x2 = Math.ceil(bounds.x + bounds.width);
const y2 = Math.ceil(bounds.y + bounds.height);
ctx.drawImage(this.cache.canvas, x1, y1, x2 - x1, y2 - y1);
const width = x2 - x1;
const height = y2 - y1;
if (width > 0 && height > 0) {
ctx.drawImage(this.cache.canvas, x1, y1, x2 - x1, y2 - y1);
}
} else if (Number.isFinite(bounds.x)) {
ctx.save();
this._drawImpl(ctx);
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"sourceMap": true,
"strict": true,
"removeComments": true,
"importsNotUsedAsValues": "error",
"verbatimModuleSyntax": false,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"strictBindCallApply": true,
Expand Down
Loading

0 comments on commit f937fa4

Please sign in to comment.