svgmap 2.9.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,10 @@
6
6
  "license": "MIT",
7
7
  "main": "index.js",
8
8
  "dependencies": {
9
- "svgmap": "2.8.0"
9
+ "svgmap": "2.9.0"
10
10
  },
11
11
  "devDependencies": {
12
- "snowpack": "^3.8.3"
12
+ "snowpack": "^3.8.8"
13
13
  },
14
14
  "scripts": {
15
15
  "start": "snowpack dev"
package/dist/svgMap.js CHANGED
@@ -57,6 +57,9 @@ function svgMapWrapper(svgPanZoom) {
57
57
 
58
58
  // Decide whether to show the flag option or not
59
59
  hideFlag: false,
60
+
61
+ // Whether attributes with no data should be displayed
62
+ hideMissingData: false,
60
63
 
61
64
  // The default text to be shown when no data is present
62
65
  noDataText: 'No data available',
@@ -1132,14 +1135,16 @@ function svgMapWrapper(svgPanZoom) {
1132
1135
  function (key) {
1133
1136
  var item = this.options.data.data[key];
1134
1137
  var value = this.options.data.values[countryID][key];
1135
- item.floatingNumbers && (value = value.toFixed(1));
1136
- item.thousandSeparator &&
1137
- (value = this.numberWithCommas(value, item.thousandSeparator));
1138
- value = item.format
1139
- ? item.format.replace('{0}', '<span>' + value + '</span>')
1140
- : '<span>' + value + '</span>';
1141
- tooltipContentTable +=
1142
- '<tr><td>' + (item.name || '') + '</td><td>' + value + '</td></tr>';
1138
+ if ((value !== undefined && this.options.hideMissingData === true) || this.options.hideMissingData === false) {
1139
+ item.floatingNumbers && (value = value.toFixed(1));
1140
+ item.thousandSeparator &&
1141
+ (value = this.numberWithCommas(value, item.thousandSeparator));
1142
+ value = item.format
1143
+ ? item.format.replace('{0}', '<span>' + value + '</span>')
1144
+ : '<span>' + value + '</span>';
1145
+ tooltipContentTable +=
1146
+ '<tr><td>' + (item.name || '') + '</td><td>' + value + '</td></tr>';
1147
+ }
1143
1148
  }.bind(this)
1144
1149
  );
1145
1150
  tooltipContentTable += '</table>';