diff --git a/packages/analytics/analytics-chart/package.json b/packages/analytics/analytics-chart/package.json
index afd0e81863..86e1e4e9ea 100644
--- a/packages/analytics/analytics-chart/package.json
+++ b/packages/analytics/analytics-chart/package.json
@@ -30,6 +30,7 @@
"@kong-ui-public/sandbox-layout": "workspace:^",
"@kong/design-tokens": "1.12.3",
"@kong/kongponents": "9.0.0-alpha.73",
+ "@types/geojson": "^7946.0.13",
"@types/uuid": "^9.0.7",
"file-saver": "^2.0.5",
"lodash.mapkeys": "^4.6.0",
@@ -78,6 +79,7 @@
"approximate-number": "^2.1.1",
"chart.js": "^4.4.1",
"chartjs-adapter-date-fns": "^3.0.0",
+ "chartjs-chart-geo": "^4.2.7",
"chartjs-plugin-annotation": "^3.0.1",
"date-fns": "^2.30.0",
"date-fns-tz": "^2.0.0",
@@ -86,7 +88,7 @@
"vue-chartjs": "^5.3.0"
},
"distSizeChecker": {
- "warningLimit": "1.35MB",
- "errorLimit": "1.5MB"
+ "warningLimit": "1.75MB",
+ "errorLimit": "2.0MB"
}
}
diff --git a/packages/analytics/analytics-chart/sandbox/index.ts b/packages/analytics/analytics-chart/sandbox/index.ts
index fed91d69d1..2359da7d2e 100644
--- a/packages/analytics/analytics-chart/sandbox/index.ts
+++ b/packages/analytics/analytics-chart/sandbox/index.ts
@@ -32,6 +32,11 @@ const router = createRouter({
name: 'simple',
component: () => import('./pages/ChartDemoSimple.vue'),
},
+ {
+ path: '/geo-chart',
+ name: 'geo-chart',
+ component: () => import('./pages/GeoChartDemo.vue'),
+ },
],
})
@@ -53,6 +58,10 @@ const appLinks: SandboxNavigationItem[] = ([
name: 'Simple Charts',
to: { name: 'simple' },
},
+ {
+ name: 'Geo Chart',
+ to: { name: 'geo-chart' },
+ },
])
// Provide the app links to the SandboxLayout components
diff --git a/packages/analytics/analytics-chart/sandbox/pages/GeoChartDemo.vue b/packages/analytics/analytics-chart/sandbox/pages/GeoChartDemo.vue
new file mode 100644
index 0000000000..f3912d341c
--- /dev/null
+++ b/packages/analytics/analytics-chart/sandbox/pages/GeoChartDemo.vue
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
diff --git a/packages/analytics/analytics-chart/src/components/GeoChart.vue b/packages/analytics/analytics-chart/src/components/GeoChart.vue
new file mode 100644
index 0000000000..6bab0f8513
--- /dev/null
+++ b/packages/analytics/analytics-chart/src/components/GeoChart.vue
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
diff --git a/packages/analytics/analytics-chart/src/composables/useChartJSCommon.ts b/packages/analytics/analytics-chart/src/composables/useChartJSCommon.ts
index bf21016679..1e8f6627c4 100644
--- a/packages/analytics/analytics-chart/src/composables/useChartJSCommon.ts
+++ b/packages/analytics/analytics-chart/src/composables/useChartJSCommon.ts
@@ -4,6 +4,8 @@ import type { Ref } from 'vue'
import { onMounted, watch, shallowRef, onBeforeUnmount } from 'vue'
import { isNullOrUndef } from 'chart.js/helpers'
+type ChartTypeGeo = 'choropleth' | 'bubbleMap'
+
// Based on
// https://github.com/apertureless/vue-chartjs/blob/e61d0b5ce94d71214300a26876e0f2a12e9a26d6/src/utils.ts#L139
const isSameShape = (oldData: ChartData, newData: ChartData) => {
@@ -23,7 +25,7 @@ const isSameShape = (oldData: ChartData, newData: ChartData) => {
}
export default function useChartJSCommon>(
- chartType: T,
+ chartType: T | ChartTypeGeo,
canvas: Ref,
chartData: Ref,
plugins: Plugin[],
@@ -34,7 +36,7 @@ export default function useChartJSCommon {
if (canvas.value) {
return new Chart(canvas.value, {
- type: chartType,
+ type: chartType as ChartType,
data,
plugins,
options,
diff --git a/packages/analytics/analytics-chart/src/index.ts b/packages/analytics/analytics-chart/src/index.ts
index 18fb51cc58..bcdba51b28 100644
--- a/packages/analytics/analytics-chart/src/index.ts
+++ b/packages/analytics/analytics-chart/src/index.ts
@@ -2,8 +2,9 @@ import AnalyticsChart from './components/AnalyticsChart.vue'
import SimpleChart from './components/SimpleChart.vue'
import TopNTable from './components/TopNTable.vue'
import CsvExportModal from './components/CsvExportModal.vue'
+import GeoChart from './components/GeoChart.vue'
-export { AnalyticsChart, SimpleChart, TopNTable, CsvExportModal }
+export { AnalyticsChart, SimpleChart, TopNTable, CsvExportModal, GeoChart }
export * from './types'
export * from './enums'
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 3c885088b5..f7e6abf174 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1,9 +1,5 @@
lockfileVersion: '6.0'
-settings:
- autoInstallPeers: false
- excludeLinksFromLockfile: false
-
importers:
.:
@@ -224,6 +220,9 @@ importers:
chartjs-adapter-date-fns:
specifier: ^3.0.0
version: 3.0.0(chart.js@4.4.1)(date-fns@2.30.0)
+ chartjs-chart-geo:
+ specifier: ^4.2.7
+ version: 4.2.7(chart.js@4.4.1)
chartjs-plugin-annotation:
specifier: ^3.0.1
version: 3.0.1(chart.js@4.4.1)
@@ -255,6 +254,9 @@ importers:
'@kong/kongponents':
specifier: 9.0.0-alpha.73
version: 9.0.0-alpha.73(axios@1.6.2)(vue-router@4.2.5)(vue@3.3.13)
+ '@types/geojson':
+ specifier: ^7946.0.13
+ version: 7946.0.13
'@types/uuid':
specifier: ^9.0.7
version: 9.0.7
@@ -3608,6 +3610,16 @@ packages:
'@types/node': 18.19.3
dev: true
+ /@types/d3-geo@3.1.0:
+ resolution: {integrity: sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==}
+ dependencies:
+ '@types/geojson': 7946.0.13
+ dev: false
+
+ /@types/d3-scale-chromatic@3.0.3:
+ resolution: {integrity: sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==}
+ dev: false
+
/@types/eslint-scope@3.7.4:
resolution: {integrity: sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==}
dependencies:
@@ -3652,6 +3664,9 @@ packages:
resolution: {integrity: sha512-nPLljZQKSnac53KDUDzuzdRfGI0TDb5qPrb+SrQyN3MtdQrOnGsKniHN1iYZsJEBIVQve94Y6gNz22sgISZq+Q==}
dev: true
+ /@types/geojson@7946.0.13:
+ resolution: {integrity: sha512-bmrNrgKMOhM3WsafmbGmC+6dsF2Z308vLFsQ3a/bT8X8Sv5clVYpPars/UPq+sAaJP+5OoLAYgwbkS5QEJdLUQ==}
+
/@types/hast@2.3.4:
resolution: {integrity: sha512-wLEm0QvaoawEDoTRwzTXp4b4jpwiJDvR5KMnFnVodm3scufTlBOWRD6N1OBf9TZMhjlNsSfcO5V+7AF4+Vy+9g==}
dependencies:
@@ -3850,6 +3865,19 @@ packages:
'@types/node': 18.19.3
dev: true
+ /@types/topojson-client@3.1.4:
+ resolution: {integrity: sha512-Ntf3ZSetMYy7z3PrVCvcqmdRoVhgKA9UKN0ZuuZf8Ts2kcyL4qK34IXBs6qO5fem62EK4k03PtkJPVoroVu4/w==}
+ dependencies:
+ '@types/geojson': 7946.0.13
+ '@types/topojson-specification': 1.0.5
+ dev: false
+
+ /@types/topojson-specification@1.0.5:
+ resolution: {integrity: sha512-C7KvcQh+C2nr6Y2Ub4YfgvWvWCgP2nOQMtfhlnwsRL4pYmmwzBS7HclGiS87eQfDOU/DLQpX6GEscviaz4yLIQ==}
+ dependencies:
+ '@types/geojson': 7946.0.13
+ dev: false
+
/@types/tough-cookie@4.0.2:
resolution: {integrity: sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==}
dev: true
@@ -5460,6 +5488,23 @@ packages:
date-fns: 2.30.0
dev: false
+ /chartjs-chart-geo@4.2.7(chart.js@4.4.1):
+ resolution: {integrity: sha512-vReO/kCjcO+w8wqZrUZvrg/yBZgn0ySFwBo/reR+5DHr3tAjxY4ReQm11IIAq4h/qDz1BWL+hyDoxOcjQbe6EA==}
+ peerDependencies:
+ chart.js: ^4.1.0
+ dependencies:
+ '@types/d3-geo': 3.1.0
+ '@types/d3-scale-chromatic': 3.0.3
+ '@types/topojson-client': 3.1.4
+ chart.js: 4.4.1
+ d3-array: 3.2.4
+ d3-color: 3.1.0
+ d3-geo: 3.1.0
+ d3-interpolate: 3.0.1
+ d3-scale-chromatic: 3.0.0
+ topojson-client: 3.1.0
+ dev: false
+
/chartjs-plugin-annotation@3.0.1(chart.js@4.4.1):
resolution: {integrity: sha512-hlIrXXKqSDgb+ZjVYHefmlZUXK8KbkCPiynSVrTb/HjTMkT62cOInaT1NTQCKtxKKOm9oHp958DY3RTAFKtkHg==}
peerDependencies:
@@ -6196,6 +6241,40 @@ packages:
- typescript
dev: true
+ /d3-array@3.2.4:
+ resolution: {integrity: sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==}
+ engines: {node: '>=12'}
+ dependencies:
+ internmap: 2.0.3
+ dev: false
+
+ /d3-color@3.1.0:
+ resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
+ engines: {node: '>=12'}
+ dev: false
+
+ /d3-geo@3.1.0:
+ resolution: {integrity: sha512-JEo5HxXDdDYXCaWdwLRt79y7giK8SbhZJbFWXqbRTolCHFI5jRqteLzCsq51NKbUoX0PjBVSohxrx+NoOUujYA==}
+ engines: {node: '>=12'}
+ dependencies:
+ d3-array: 3.2.4
+ dev: false
+
+ /d3-interpolate@3.0.1:
+ resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}
+ engines: {node: '>=12'}
+ dependencies:
+ d3-color: 3.1.0
+ dev: false
+
+ /d3-scale-chromatic@3.0.0:
+ resolution: {integrity: sha512-Lx9thtxAKrO2Pq6OO2Ua474opeziKr279P/TKZsMAhYyNDD3EnCffdbgeSYN5O7m2ByQsxtuP2CSDczNUIZ22g==}
+ engines: {node: '>=12'}
+ dependencies:
+ d3-color: 3.1.0
+ d3-interpolate: 3.0.1
+ dev: false
+
/d@1.0.1:
resolution: {integrity: sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==}
dependencies:
@@ -8741,6 +8820,11 @@ packages:
side-channel: 1.0.4
dev: true
+ /internmap@2.0.3:
+ resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==}
+ engines: {node: '>=12'}
+ dev: false
+
/interpret@3.1.1:
resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==}
engines: {node: '>=10.13.0'}
@@ -13679,6 +13763,13 @@ packages:
resolution: {integrity: sha512-VSsyNPPW74RpHwR8Fc21uubwHY7wMDeJLys2IX5zJNih+OnAnaifKHo+1LHT7DAdloQ7apeaaWg8l7qnf/TnEg==}
dev: true
+ /topojson-client@3.1.0:
+ resolution: {integrity: sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==}
+ hasBin: true
+ dependencies:
+ commander: 2.20.3
+ dev: false
+
/tosource@2.0.0-alpha.3:
resolution: {integrity: sha512-KAB2lrSS48y91MzFPFuDg4hLbvDiyTjOVgaK7Erw+5AmZXNq4sFRVn8r6yxSLuNs15PaokrDRpS61ERY9uZOug==}
engines: {node: '>=10'}
@@ -15082,3 +15173,7 @@ packages:
/zenscroll@4.0.2:
resolution: {integrity: sha512-jEA1znR7b4C/NnaycInCU6h/d15ZzCd1jmsruqOKnZP6WXQSMH3W2GL+OXbkruslU4h+Tzuos0HdswzRUk/Vgg==}
dev: false
+
+settings:
+ autoInstallPeers: false
+ excludeLinksFromLockfile: false