<commit_before># d3by5-map


## Options

### Basic

### Advanced



## Data Schema

### CSV
Must include one column referencing the country. This could be:
'id', 'countrycode', 'countryCode', 'country', 'Country', 'countryName', 'countryname'. Or it can be set as an option [1](#footnote-1)

#### Example
```
"Country","FSI"
"Switzerland","1466.1",
"Hong Kong","1259.4",
"USA","1254.7",
```


### Json
Countries group by iso-3166 country codes (alpha2, alpha3 of numeric). Optional porperties can be included and referenced in the options. Spesicifcally complex mapping of colors and/or textures.


#### Example (skriv om til FSI exempel ?)
```
{
  "countries": {
    "ALB": {
      "groups": [
        "industry",
        "tradd"
      ],
      "fillColorMapKey": [
        "efta",
        "bits"
      ]
    },
    "BIH": {
      "groups": [
        "patents",
        "medicin"
      ],
      "fillColorMapKey": [<commit_msg>Extends documentation of options<commit_after># d3by5-map


## Options

### Basics
Option  | Type | Default | Desciption
------------- | -----|-------- | -----
width|Number|960
height|Number|500
aspectRatio|Number|500 / 960
margin|Number|20                 |for now single value
offSetX|Number|0                 |shifts the entire map horisointally in pixels
offSetY|Number|0                 |shifts the entire map veritcaly in pixels
showLabels|Boolean or String|0              |Bboolean or integer] false/0 = off, true/1 = on, 2 - 20 = zoomLevelTreshold
higlightOnHover|Boolean|false     |higlight country (or group of countries) on hover
showToolTipOn|String|'hover'     |[click, hover, none]
toolTipTemplate|Function|[See below]|A function that returns the markup four your tooltip.
assetsUrl|String|'/'       |base path to asset files
classPrefix|String|'d3x5_'|
debug|Boolean|false| Toggles debug messages (warning and such) to the console.


### Map
Option  | Type | Default | Desciption
------------- | -----|-------- | -----
geoData|object|{}              |topoJson (only for now)
projection|String|'geoMercator' |projection
scale|float|0.85                  |not quiter sure about this one
responsive|Boolean|false
graticule|Boolean|false          |graticules; a uniform grid of meridians and parallels for showing projection distortion
projectionFit|Boolean|true       |tries to fit the map inside container. Todo; rename ??


### Data Visualization
Option  | Type | Default | Desciption
------------- | -----|-------- | -----
data|object|{}                 |data to visualize
color|Function|null
texture|Function|null
colorKey|String|null
textureKey|String|null
countryIsoCodeMap|String|'properties.countryCode'  |If the topojson does not store the ISO code in  "geometries.id", use this to map the correct attribute (uses dot notation, eg "properties.countryCode")

### Zoom
Option  | Type | Default | Desciption
------------- | -----|-------- | -----
zoomMin|Number|1                 |min zoom level
zoomMax|Number|20                |max zoom level
zoomGestures|Boolean|true        |"Free zoom" (mouse scroll wheel, touch gestures)
zoomControls|Boolean|false        |toggle zoomButtons
zoomResetOnOceanClick|Boolean|false |reset zoom on background area click

### Colors

Option  | Type | Default | Desciption
------------- | -----|-------- | -----
baseColor|String|'#F8EBCB'
backgroundgColor|String|'none'   |'none' for transparent or #HEX
accentColor|String|'#FF6B6B'
borderColor|String|'#9DBFB1'


## Tool Tip Template

```
function(d, data) { 
	return '<h3 class="d3x5_tooltip__header">' + d.properties.name + '</h3>'; 
}
```


## Data Schema

### CSV
Must include one column referencing the country. This could be:
'id', 'countrycode', 'countryCode', 'country', 'Country', 'countryName', 'countryname'. Or it can be set as an option [1](#footnote-1)

#### Example
```
"country","id","immigration","emmigration","netmigration"
"Afghanistan","4","382365","4843117","-4460752"
"Albania","8","57616","1122910","-1065294"
"Algeria","12","242391","1763771","-1521380"
```

*Note*: Numeric Country codes are padded. So in the example above id 4 is read as 004.


### JSON array
You can present the data as an array of objects. Each object must include one property referencing the country. This could be: 'id', 'countrycode', 'countryCode', 'country', 'Country', 'countryName', 'countryname'. Or it can be set as an option [1](#footnote-1)

#### Example
```
[
	{
		id: "ABW",
		iso2Code: "AW",
		name: "Aruba",
		region: {
			id: "LCN",
			value: "Latin America & Caribbean "
			},
		adminregion: {
			id: "",
			value: ""
		},
		incomeLevel: {
			id: "HIC",
			value: "High income"
		},
		lendingType: {
			id: "LNX",
			value: "Not classified"
		},
		capitalCity: "Oranjestad",
		longitude: "-70.0167",
		latitude: "12.5167"
	},
	{
		id: "AFG",
		iso2Code: "AF",
		name: "Afghanistan",
		...
	}
	...
]
```



### JSON object
Countries group by iso-3166 country codes (alpha2, alpha3 of numeric). Optional porperties can be included and referenced in the options. Spesicifcally complex mapping of colors and/or textures.


#### Example
```
{
  "countries": {
    "ALB": {
      "groups": [
        "industry",
        "tradd"
      ],
      "fillColorMapKey": [
        "efta",
        "bits"
      ]
    },
    "BIH": {
      "groups": [
        "patents",
        "medicin"
      ],
      "fillColorMapKey": [
{'fraction_non_alphanumeric': 0.1633034379671151, 'fraction_numerical': 0.029334828101644245, 'mean_word_length': 3.0308734939759034, 'pattern_counts': {'":': 14, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '846463', 'n_tokens_mistral': 1845, 'n_tokens_neox': 1682, 'n_words': 487}