{"id":28437346,"url":"https://github.com/komed3/svgworld","last_synced_at":"2025-06-27T20:31:10.370Z","repository":{"id":215596479,"uuid":"738732797","full_name":"komed3/svgworld","owner":"komed3","description":"simple SVG world map / chart","archived":false,"fork":false,"pushed_at":"2024-01-10T22:38:37.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T23:43:05.943Z","etag":null,"topics":["npm-package","svg-chart","svg-map","world-map"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/svgworld","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/komed3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2024-01-03T23:17:28.000Z","updated_at":"2024-01-06T10:06:45.000Z","dependencies_parsed_at":"2024-01-05T11:20:24.289Z","dependency_job_id":"ecdec9e2-58af-46f4-8ede-c4b9540ec44e","html_url":"https://github.com/komed3/svgworld","commit_stats":null,"previous_names":["komed3/svgworld"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/komed3/svgworld","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komed3%2Fsvgworld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komed3%2Fsvgworld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komed3%2Fsvgworld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komed3%2Fsvgworld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/komed3","download_url":"https://codeload.github.com/komed3/svgworld/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komed3%2Fsvgworld/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262327020,"owners_count":23294178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["npm-package","svg-chart","svg-map","world-map"],"created_at":"2025-06-05T23:41:15.840Z","updated_at":"2025-06-27T20:31:10.341Z","avatar_url":"https://github.com/komed3.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SVGWorld\n\nThe simple and free to use __SVGWorld__ npm package can be used to draw map based charts. The project is currently in an early alpha release and does not yet include many functions. However, it is highly flexible and can be expanded with other maps or plugins.\n\n## Install\n\nUsing __Node.js__ install this package with the following command:\n\n```shell\nnpm install svgworld\n```\n\n## Example\n\n```js\nimport SVGWorld from './index.js';\nimport world from './maps/world.json' assert { type: 'json' };\nimport colorScale from './plugins/colorScale.js';\n\nvar chart = new SVGWorld( document.getElementById( 'map' ), {\n    map: world,\n    data: [\n        { id: \"af\", y: 38928346 }, { id: \"ax\", y: 29013 },\n        { id: \"al\", y: 2877797 }, { id: \"dz\", y: 43851044 },\n        { id: \"as\", y: 55191 } ...\n    ],\n    options: {\n        plugins: {\n            colorScale: {\n                minColor: '#2a0211',\n                maxColor: '#e30b5c',\n                scaleType: 'logarithmic',\n                steps: 12\n            }\n        },\n        callbacks: {\n            afterAssignData: colorScale\n        }\n    }\n} );\n```\n\n## Documentation\n\n### Callback functions\n\nCallback functions can be used to extend or modify the existing code. They are called from different spots and provide various arguments depending on their purpose. The last argument passed is always the SVGWorld class itself.\n\n| Callback | Arguments | Description |\n|----------|-----------|-------------|\n| ``afterRedraw`` | ``svgworld`` | Fires after drawing map chart. |\n| ``afterClearMap`` | ``items``, ``svgworld`` | Fires after clearing map chart, provides map items. |\n| ``createMapPath`` | ``item``, ``path`` | Fires after creating SVG path element, provides map item and the SVG path itself. |\n| ``mapLoadComplete`` | ``items``, ``map``, ``svg``, ``svgworld`` | Fires after creating whole SVG map and all paths, provides map items, the map itself and the SVG element. |\n| ``afterAssignData`` | ``items``, ``svgworld`` | Fires after assigning map data to items, provides this items. |\n\n### Plugins\n\nSVGWorld can easily be extended through plugins. The following ones are included:\n\n#### colorScale.js\n\nThe colorScale plugin generates a color scale based on minima and maxima. The script calculates color steps between two specified values (supports hexadecimal values and RGB colors) and adds them to the map items.\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| ``minColor`` | ``[ 42, 2, 17 ]`` | Minimum color; hex or rgb values. |\n| ``maxColor`` | ``[ 227, 11, 92 ]`` | Maximum color; hex or rgb values. |\n| ``scaleType`` | ``linear`` | Color scale tyle; allowed values: ``linear``, ``logarithmic``, ``log``, ``log10``. |\n| ``steps`` | ``10`` | Number of color steps, |\n| ``approx`` | ``round`` | Date approximation; allowed values: ``round``, ``floor``, ``ceil``. |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomed3%2Fsvgworld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkomed3%2Fsvgworld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomed3%2Fsvgworld/lists"}