Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Jun 5, 2021
2 parents 3d9a21c + ed983c0 commit 71aee67
Show file tree
Hide file tree
Showing 17 changed files with 1,192 additions and 2,459 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Samuel Gratzl
Copyright (c) 2021 Samuel Gratzl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

Chart.js module for charting maps with legends. Adding new chart types: `choropleth` and `bubbleMap`.

**Works only with Chart.js >= 3.0.0**

![Choropleth](https://user-images.githubusercontent.com/4129778/78821942-8b974700-79da-11ea-988d-142f7788ffe6.png)

[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/gOaBQep)
Expand All @@ -20,6 +18,18 @@ Chart.js module for charting maps with legends. Adding new chart types: `choropl

works great with https://github.com/chartjs/chartjs-plugin-datalabels

## Related Plugins

Check out also my other chart.js plugins:

- [chartjs-chart-boxplot](https://github.com/sgratzl/chartjs-chart-boxplot) for rendering boxplots and violin plots
- [chartjs-chart-error-bars](https://github.com/sgratzl/chartjs-chart-error-bars) for rendering errors bars to bars and line charts
- [chartjs-chart-graph](https://github.com/sgratzl/chartjs-chart-graph) for rendering graphs, trees, and networks
- [chartjs-chart-pcp](https://github.com/sgratzl/chartjs-chart-pcp) for rendering parallel coordinate plots
- [chartjs-chart-venn](https://github.com/sgratzl/chartjs-chart-venn) for rendering venn and euler diagrams
- [chartjs-chart-wordcloud](https://github.com/sgratzl/chartjs-chart-wordcloud) for rendering word clouds
- [chartjs-plugin-hierarchical](https://github.com/sgratzl/chartjs-plugin-hierarchical) for rendering hierarchical categorical axes which can be expanded and collapsed

## Install

```bash
Expand Down
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-env node */

module.exports = {
testEnvironment: 'jsdom',
preset: 'ts-jest',
rootDir: './src',
testRegex: '((\\.|/)(test|spec))\\.tsx?$',
};
36 changes: 20 additions & 16 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": "3.0.2",
"version": "3.1.0",
"author": {
"name": "Samuel Gratzl",
"email": "[email protected]",
Expand Down Expand Up @@ -36,12 +36,13 @@
"src/**/*.ts"
],
"peerDependencies": {
"chart.js": "^3.2.1"
"chart.js": "^3.3.2"
},
"dependencies": {
"@types/d3-geo": "^2.0.0",
"@types/d3-scale-chromatic": "^2.0.0",
"@types/topojson-client": "^3.1.0",
"d3-array": "^2.12.0",
"d3-geo": "^2.0.1",
"d3-scale-chromatic": "^2.0.0",
"topojson-client": "^3.1.0"
Expand All @@ -53,41 +54,44 @@
"@rollup/plugin-typescript": "^8.2.1",
"@types/jest": "^26.0.23",
"@types/jest-image-snapshot": "^4.3.0",
"@types/node": "^15.0.2",
"@types/node": "^15.12.1",
"@types/seedrandom": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"@typescript-eslint/parser": "^4.22.1",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"@yarnpkg/pnpify": "^2.4.0",
"canvas": "^2.7.0",
"canvas": "^2.8.0",
"canvas-5-polyfill": "^0.1.5",
"chart.js": "3.0.0-rc.3",
"eslint": "^7.26.0",
"eslint": "^7.28.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.3.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.7.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.6.3",
"jest": "^27.0.4",
"jest-image-snapshot": "^4.5.0",
"prettier": "^2.3.0",
"release-it": "^14.6.2",
"prettier": "^2.3.1",
"release-it": "^14.7.0",
"rimraf": "^3.0.2",
"rollup": "^2.47.0",
"rollup": "^2.50.6",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-dts": "^3.0.1",
"rollup-plugin-dts": "^3.0.2",
"rollup-plugin-terser": "^7.0.2",
"seedrandom": "^3.0.5",
"ts-jest": "^26.5.6",
"ts-jest": "^27.0.2",
"tslib": "^2.2.0",
"typedoc": "^0.20.36",
"typescript": "^4.2.4",
"typescript": "^4.3.2",
"us-atlas": "^3.0.0",
"world-atlas": "^2.0.2"
},
"resolutions": {
"d3-array": "^2.12.0"
},
"scripts": {
"clean": "rimraf build docs node_modules \"*.tgz\" \"*.tsbuildinfo\"",
"compile": "tsc -b tsconfig.c.json",
Expand Down
13 changes: 12 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@ import fs from 'fs';

const pkg = JSON.parse(fs.readFileSync('./package.json'));

function resolveYear() {
// Extract copyrights from the LICENSE.
const license = fs.readFileSync('./LICENSE', 'utf-8').toString();
const matches = Array.from(license.matchAll(/\(c\) (\d+)/gm));
if (!matches || matches.length === 0) {
return 2021;
}
return matches[matches.length - 1][1];
}
const year = resolveYear();

const banner = `/**
* ${pkg.name}
* ${pkg.homepage}
*
* Copyright (c) ${new Date().getFullYear()} ${pkg.author.name} <${pkg.author.email}>
* Copyright (c) ${year} ${pkg.author.name} <${pkg.author.email}>
*/
`;

Expand Down
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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></script>
<script src="https://unpkg.com/chartjs-plugin-datalabels@next"></script>
<script src="../build/index.umd.js"></script>
<script src="https://unpkg.com/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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></script>
<!-- <script src="https://unpkg.com/chartjs-plugin-datalabels"></script> -->
<script src="../build/index.umd.js"></script>
<script src="https://unpkg.com/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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></script>
<!-- <script src="https://unpkg.com/chartjs-plugin-datalabels"></script> -->
<script src="../build/index.umd.js"></script>
<script src="https://unpkg.com/papaparse"></script>
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://unpkg.com/chart.js@3.0.0?module",
"chart.js/helpers": "https://unpkg.com/chart.js@3.0.0/helpers/helpers.esm.js?module",
"chart.js": "https://unpkg.com/chart.js@3.3.2?module",
"chart.js/helpers": "https://unpkg.com/chart.js@3.3.2/helpers/helpers.esm.js?module",
"chartjs-chart-geo": "../build/index.js",
"d3-geo": "https://unpkg.com/d3-geo?module",
"d3-scale-chromatic": "https://unpkg.com/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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></script>
<script src="../build/index.umd.js"></script>
</head>

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://unpkg.com/chart.js@3.0.0/dist/chart.js"></script>
<script src="https://unpkg.com/chart.js@3.3.2/dist/chart.js"></script>
<script src="../build/index.umd.js"></script>
</head>

Expand Down
Loading

0 comments on commit 71aee67

Please sign in to comment.