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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svgmap",
3
3
  "description": "svgMap is a JavaScript library that lets you easily create an interactable world map comparing customizable data for each country.",
4
- "version": "2.9.0",
4
+ "version": "2.10.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "main": "dist/svgMap.min.js",
@@ -20,11 +20,11 @@
20
20
  "gulp-concat": "^2.6.1",
21
21
  "gulp-header": "^2.0.9",
22
22
  "gulp-rename": "^2.0.0",
23
- "gulp-sass": "^5.0.0",
23
+ "gulp-sass": "^5.1.0",
24
24
  "gulp-sourcemaps": "^3.0.0",
25
25
  "gulp-uglify": "^3.0.2",
26
- "jest": "^27.1.0",
27
- "sass": "^1.38.1"
26
+ "jest": "^28.1.1",
27
+ "sass": "^1.53.0"
28
28
  },
29
29
  "dependencies": {
30
30
  "svg-pan-zoom": "^3.6.1"
package/src/js/svgMap.js CHANGED
@@ -56,6 +56,9 @@ function svgMapWrapper(svgPanZoom) {
56
56
 
57
57
  // Decide whether to show the flag option or not
58
58
  hideFlag: false,
59
+
60
+ // Whether attributes with no data should be displayed
61
+ hideMissingData: false,
59
62
 
60
63
  // The default text to be shown when no data is present
61
64
  noDataText: 'No data available',
@@ -1131,14 +1134,16 @@ function svgMapWrapper(svgPanZoom) {
1131
1134
  function (key) {
1132
1135
  var item = this.options.data.data[key];
1133
1136
  var value = this.options.data.values[countryID][key];
1134
- item.floatingNumbers && (value = value.toFixed(1));
1135
- item.thousandSeparator &&
1136
- (value = this.numberWithCommas(value, item.thousandSeparator));
1137
- value = item.format
1138
- ? item.format.replace('{0}', '<span>' + value + '</span>')
1139
- : '<span>' + value + '</span>';
1140
- tooltipContentTable +=
1141
- '<tr><td>' + (item.name || '') + '</td><td>' + value + '</td></tr>';
1137
+ if ((value !== undefined && this.options.hideMissingData === true) || this.options.hideMissingData === false) {
1138
+ item.floatingNumbers && (value = value.toFixed(1));
1139
+ item.thousandSeparator &&
1140
+ (value = this.numberWithCommas(value, item.thousandSeparator));
1141
+ value = item.format
1142
+ ? item.format.replace('{0}', '<span>' + value + '</span>')
1143
+ : '<span>' + value + '</span>';
1144
+ tooltipContentTable +=
1145
+ '<tr><td>' + (item.name || '') + '</td><td>' + value + '</td></tr>';
1146
+ }
1142
1147
  }.bind(this)
1143
1148
  );
1144
1149
  tooltipContentTable += '</table>';