From 96e9c92ed70236416d12ef3d04b2593f7bd731be Mon Sep 17 00:00:00 2001 From: ruthvik129 Date: Tue, 24 Sep 2024 14:54:51 +0530 Subject: [PATCH] update classification groups for sequential chart --- package-lock.json | 76 +++++++++++++++++-- packages/opub-ui/package.json | 2 +- .../src/components/MapChart/MapChart.tsx | 7 +- 3 files changed, 73 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index de70d62e..26d9945d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14891,11 +14891,6 @@ "consola": "^3.2.3" } }, - "node_modules/classybrew": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/classybrew/-/classybrew-0.0.3.tgz", - "integrity": "sha512-Z1ky+DGpSFKaUpmIcWEM31c8U9gj1e1/gAUb/PWT5gUJBz+8gtFeXnn7HVUgEuWxsRFhxgKB9fs3gf7sTWt0GQ==" - }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -32402,7 +32397,7 @@ } }, "packages/opub-ui": { - "version": "0.3.34", + "version": "0.3.36", "license": "MIT", "dependencies": { "@ariakit/react": "^0.3.14", @@ -32433,7 +32428,6 @@ "@tanstack/react-table": "^8.9.1", "autoprefixer": "^10.4.18", "chrono-node": "^2.7.5", - "classybrew": "^0.0.3", "clsx": "^2.1.0", "cmdk": "^0.2.0", "d3-scale": "^4.0.2", @@ -32445,6 +32439,7 @@ "leaflet": "^1.9.4", "match-sorter": "^6.3.3", "modern-screenshot": "^4.4.38", + "opub-ui": "^0.3.33", "postcss": "^8.4.35", "react-aria": "^3.31.1", "react-hook-form": "^7.49.3", @@ -33088,6 +33083,73 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "packages/opub-ui/node_modules/opub-ui": { + "version": "0.3.33", + "resolved": "https://registry.npmjs.org/opub-ui/-/opub-ui-0.3.33.tgz", + "integrity": "sha512-0voTtnphBiQJvc9zWwFljqfbROxIW1j5r/xr/rOu7GDBBf9V6EZUNDMr0qYxjhJhYa9m79UKOlOiQhov3mjdZg==", + "dependencies": { + "@ariakit/react": "^0.3.14", + "@hookform/resolvers": "^3.3.4", + "@ianvs/prettier-plugin-sort-imports": "^4.3.1", + "@internationalized/date": "^3.2.0", + "@radix-ui/react-accordion": "^1.1.2", + "@radix-ui/react-alert-dialog": "^1.0.3", + "@radix-ui/react-avatar": "^1.0.2", + "@radix-ui/react-checkbox": "^1.0.1", + "@radix-ui/react-collapsible": "^1.0.2", + "@radix-ui/react-dialog": "^1.0.3", + "@radix-ui/react-label": "^2.0.0", + "@radix-ui/react-popover": "^1.0.5", + "@radix-ui/react-progress": "^1.0.2", + "@radix-ui/react-radio-group": "^1.1.1", + "@radix-ui/react-scroll-area": "^1.0.3", + "@radix-ui/react-separator": "^1.0.3", + "@radix-ui/react-slider": "^1.1.1", + "@radix-ui/react-switch": "^1.0.2", + "@radix-ui/react-tabs": "^1.0.3", + "@radix-ui/react-tooltip": "^1.0.5", + "@react-types/calendar": "^3.2.0", + "@react-types/datepicker": "^3.3.0", + "@react-types/shared": "^3.18.0", + "@storybook/test": "^8.0.2", + "@tabler/icons-react": "^2.17.0", + "@tanstack/react-table": "^8.9.1", + "autoprefixer": "^10.4.18", + "chrono-node": "^2.7.5", + "clsx": "^2.1.0", + "cmdk": "^0.2.0", + "echarts": "^5.4.3", + "echarts-for-react": "^3.0.2", + "embla-carousel-react": "8.0.0-rc15", + "intl-segmenter-polyfill": "^0.4.4", + "leaflet": "^1.9.4", + "match-sorter": "^6.3.3", + "modern-screenshot": "^4.4.38", + "postcss": "^8.4.35", + "react-aria": "^3.31.1", + "react-hook-form": "^7.49.3", + "react-leaflet": "^4.2.1", + "react-leaflet-fullscreen": "^4.1.1", + "react-medium-image-zoom": "^5.1.10", + "react-stately": "^3.21.0", + "sass": "^1.71.1", + "satori": "^0.10.11", + "screenfull": "^6.0.2", + "sonner": "^1.3.1", + "tailwind-merge": "^1.12.0", + "tailwindcss": "^3.4.1", + "tailwindcss-animate": "^1.0.7", + "usehooks-ts": "^2.13.0", + "vaul": "^0.9.0" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "react": "^16.14.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0" + } + }, "packages/opub-ui/node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", diff --git a/packages/opub-ui/package.json b/packages/opub-ui/package.json index 5e3c6c61..320c547d 100644 --- a/packages/opub-ui/package.json +++ b/packages/opub-ui/package.json @@ -1,7 +1,7 @@ { "name": "opub-ui", "description": "OPub UI Library", - "version": "0.3.36", + "version": "0.3.37", "private": false, "license": "MIT", "author": "CivicDataLab ", diff --git a/packages/opub-ui/src/components/MapChart/MapChart.tsx b/packages/opub-ui/src/components/MapChart/MapChart.tsx index 3e3fa90a..fb9efd01 100644 --- a/packages/opub-ui/src/components/MapChart/MapChart.tsx +++ b/packages/opub-ui/src/components/MapChart/MapChart.tsx @@ -195,17 +195,16 @@ const Map = ({ if (isSequentialLegend) { const min = Math.min(...values); const max = Math.max(...values); - const step = (max - min) / 5; // Calculate step size - const grades = Array.from({ length: 5 + 1 }, (_, i) => min + step * i); // Create ranges + const step = (max - min) / 3; + const grades = Array.from({ length: 3 + 1 }, (_, i) => min + step * i); - // Loop through intervals and generate a label with a color square for each for (let i = 0; i < grades.length; i++) { const from = grades[i]; const to = grades[i + 1] || Math.max(...values); labels.push({ color: colorScale(from), - label: `${Math.round(from)}${to ? `- ${Math.round(to)}` : '+'}`, + label: `${Math.round(from)} - ${to ? `${Math.round(to)}` : '+'}`, }); } }