Skip to content

Commit

Permalink
Updated countries list dependency
Browse files Browse the repository at this point in the history
Also clarified Readme docs & renamed demo folder
  • Loading branch information
jagomf committed Nov 21, 2023
1 parent 0680d92 commit 44a33b3
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 39 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

![screenshot](https://raw.githubusercontent.com/jagomf/countries-map/master/screenshot.png)

## This package does not depend on 3rd parties
## This package does not depend on 3rd parties' maps

Starting with v4, this package **does NOT depend on Google GeoCharts**.
Starting with v4, this package **does NOT depend on Google GeoCharts** but uses its own embedded map.

If you want to use v3 (which depends on Google GeoCharts), please check [ReadMe v3](https://github.com/jagomf/countries-map/blob/v3/README.md).

Expand Down Expand Up @@ -71,13 +71,13 @@ Element `<countries-map>` accepts the following attributes/inputs:

Attribute | Type | Default | Description
--- | --- | --- | ---
`data` | `CountriesData` | - | Describes list of countries and their value and extra data (if any). See description for interface [`CountriesData`](#interface-countriesdata).
`data` | `CountriesData` | Required | Describes list of countries and their value and extra data (if any). See below description for interface [`CountriesData`](#interface-countriesdata).
`countryLabel` | `string` | `'Country'` | Caption label for country name.
`valueLabel` | `string` | `'Value'` | Caption label for country's value.
`showCaption` | `boolean` | `true` | Shows/hides caption.
`captionBelow` | `boolean` | `true` | Places caption below or above the map.
`minValue` | `number` | - | If stated, sets the base to be used as lowest value expected in the color scale (values below `minValue` will have same color).
`maxValue` | `number` | - | If stated, sets the base to be used as highest value expected in the color scale (values above `maxValue` will have same color).
`minValue` | `number` | Optional | If stated, sets the base to be used as lowest value expected in the color scale (values below `minValue` will have same color).
`maxValue` | `number` | Optional | If stated, sets the base to be used as highest value expected in the color scale (values above `maxValue` will have same color).
`minColor` | `string` | `'white'` | Hex or named color representing the lowest value.
`maxColor` | `string` | `'red'` | Hex or named color representing the highest value.
`noDataColor` | `string` | `'#CFCFCF'` | Hex or named color for countries not included in data list.
Expand Down Expand Up @@ -220,12 +220,18 @@ These are the classes you can apply styles to, hierarchically displayed, and ass
* `cm-extended-label`: key of the single extra item
* `cm-extended-value`: value of the single extra item

## Countries

Current valid country codes are widely-recognized sovereign nations plus some other autonomous realms. Check the currently valid list at [`@jagomf/countrieslist`](https://github.com/jagomf/countrieslist).

## Projects

Highlighted projects currently using countries-map:

* [Deflaggr](https://deflaggr.com): Collect world flags

Contact us if you want to get highlighted.

## License

[MIT](https://github.com/jagomf/countries-map/blob/master/LICENSE)
16 changes: 11 additions & 5 deletions dist/countries-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

![screenshot](https://raw.githubusercontent.com/jagomf/countries-map/master/screenshot.png)

## This package does not depend on 3rd parties
## This package does not depend on 3rd parties' maps

Starting with v4, this package **does NOT depend on Google GeoCharts**.
Starting with v4, this package **does NOT depend on Google GeoCharts** but uses its own embedded map.

If you want to use v3 (which depends on Google GeoCharts), please check [ReadMe v3](https://github.com/jagomf/countries-map/blob/v3/README.md).

Expand Down Expand Up @@ -71,13 +71,13 @@ Element `<countries-map>` accepts the following attributes/inputs:

Attribute | Type | Default | Description
--- | --- | --- | ---
`data` | `CountriesData` | - | Describes list of countries and their value and extra data (if any). See description for interface [`CountriesData`](#interface-countriesdata).
`data` | `CountriesData` | Required | Describes list of countries and their value and extra data (if any). See below description for interface [`CountriesData`](#interface-countriesdata).
`countryLabel` | `string` | `'Country'` | Caption label for country name.
`valueLabel` | `string` | `'Value'` | Caption label for country's value.
`showCaption` | `boolean` | `true` | Shows/hides caption.
`captionBelow` | `boolean` | `true` | Places caption below or above the map.
`minValue` | `number` | - | If stated, sets the base to be used as lowest value expected in the color scale (values below `minValue` will have same color).
`maxValue` | `number` | - | If stated, sets the base to be used as highest value expected in the color scale (values above `maxValue` will have same color).
`minValue` | `number` | Optional | If stated, sets the base to be used as lowest value expected in the color scale (values below `minValue` will have same color).
`maxValue` | `number` | Optional | If stated, sets the base to be used as highest value expected in the color scale (values above `maxValue` will have same color).
`minColor` | `string` | `'white'` | Hex or named color representing the lowest value.
`maxColor` | `string` | `'red'` | Hex or named color representing the highest value.
`noDataColor` | `string` | `'#CFCFCF'` | Hex or named color for countries not included in data list.
Expand Down Expand Up @@ -220,12 +220,18 @@ These are the classes you can apply styles to, hierarchically displayed, and ass
* `cm-extended-label`: key of the single extra item
* `cm-extended-value`: value of the single extra item

## Countries

Current valid country codes are widely-recognized sovereign nations plus some other autonomous realms. Check the currently valid list at [`@jagomf/countrieslist`](https://github.com/jagomf/countrieslist).

## Projects

Highlighted projects currently using countries-map:

* [Deflaggr](https://deflaggr.com): Collect world flags

Contact us if you want to get highlighted.

## License

[MIT](https://github.com/jagomf/countries-map/blob/master/LICENSE)
6 changes: 3 additions & 3 deletions dist/countries-map/esm2020/lib/base-map.component.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/countries-map/esm2020/lib/countries-map.component.mjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/countries-map/fesm2015/countries-map.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/countries-map/fesm2015/countries-map.mjs.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/countries-map/fesm2020/countries-map.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/countries-map/fesm2020/countries-map.mjs.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/countries-map/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "countries-map",
"version": "4.5.0",
"version": "4.6.0",
"description": "World countries datamaps component for Angular",
"license": "MIT",
"author": "Jago MF <[email protected]>",
Expand All @@ -20,7 +20,7 @@
"@angular/core": "^14.0.0"
},
"dependencies": {
"@jagomf/countrieslist": "^2.1.0",
"@jagomf/countrieslist": "^3.0.0",
"chroma-js": "^2.1.0",
"tslib": "^2.0.0"
},
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "countries-map-dev",
"version": "4.5.0",
"version": "4.6.0",
"description": "Builder and demo runner for countries-map",
"license": "MIT",
"author": "Jago MF <[email protected]>",
Expand All @@ -27,7 +27,7 @@
"@angular/core": "^14.3.0",
"@angular/platform-browser": "^14.3.0",
"@angular/platform-browser-dynamic": "^14.3.0",
"@jagomf/countrieslist": "^2.1.0",
"@jagomf/countrieslist": "^3.0.0",
"chroma-js": "^2.1.0",
"rxjs": "~6.6.0",
"tslib": "^2.6.2",
Expand Down
9 changes: 4 additions & 5 deletions projects/lib/assets/world-map.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions projects/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "countries-map",
"version": "4.5.0",
"version": "4.6.0",
"description": "World countries datamaps component for Angular",
"license": "MIT",
"author": "Jago MF <[email protected]>",
Expand All @@ -20,7 +20,7 @@
"@angular/core": "^14.0.0"
},
"dependencies": {
"@jagomf/countrieslist": "^2.1.0",
"@jagomf/countrieslist": "^3.0.0",
"chroma-js": "^2.1.0",
"tslib": "^2.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/lib/src/lib/base-map.component.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions projects/lib/src/lib/countries-map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ export class CountriesMapComponent implements AfterViewInit, OnChanges {
if (this.data) {
// get highest value in range
const maxVal = exists(this.maxValue) ? this.maxValue : Object.values(this.data).reduce(
(acc, curr) => countryNum(curr) > acc || acc === null? countryNum(curr) : acc, null as number
(acc, curr) => countryNum(curr) > acc || acc === null ? countryNum(curr) : acc, null as number
);
// get lowest value in range
const minVal = exists(this.minValue) ? this.minValue : Object.values(this.data).reduce(
(acc, curr) => countryNum(curr) < acc || acc === null? countryNum(curr) : acc, null as number
(acc, curr) => countryNum(curr) < acc || acc === null ? countryNum(curr) : acc, null as number
);

// map values in range to colors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ <h2>Map with data</h2>
(chartReady)="mapReady()"
[showCaption]="true"
[captionBelow]="false">
<!-- Caption intentionally left above the map for demo so that it is clearly seen -->
</countries-map>
</div>
<ng-template #errorOnLoad>
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { DemoModule } from './app/demo.module';
import { DemoModule } from './demo/demo.module';

platformBrowserDynamic().bootstrapModule(DemoModule)
.catch(err => console.error(err));

0 comments on commit 44a33b3

Please sign in to comment.