Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix #99 #100 Fixed reset method

  • Loading branch information...
commit 0ef09e3d1044ee2dfc67b7ecac73651fbe79fadb 1 parent c13f9e3
@bjornd authored
Showing with 15 additions and 8 deletions.
  1. +3 −3 lib/data-series.js
  2. +7 −5 lib/world-map.js
  3. +5 −0 tests/markers.html
View
6 lib/data-series.js
@@ -32,7 +32,7 @@ jvm.DataSeries = function(params, elements) {
}
if (params.values) {
- this.values = params.values;
+ this.values = params.values || {};
this.setValues(params.values);
}
};
@@ -99,14 +99,14 @@ jvm.DataSeries.prototype = {
}
this.setAttributes(attrs);
- this.values = values;
+ $.extend(this.values, values);
},
clear: function(){
var key,
attrs = {};
- for (key in this.elements) {
+ for (key in this.values) {
attrs[key] = this.elements[key].element.style.initial[this.params.attribute];
}
this.setAttributes(attrs);
View
12 lib/world-map.js
@@ -184,14 +184,16 @@ jvm.WorldMap.prototype = {
},
/**
- * Reset colors of the regions, show the map with the initial zoom.
+ * Reset all the series and show the map with the initial zoom.
*/
reset: function() {
- var key;
+ var key,
+ i;
- this.countryTitle.reset();
- for (key in this.regions) {
- this.regions[key].element.setStyle('fill', jvm.WorldMap.defaultColor);
+ for (key in this.series) {
+ for (i = 0; i < this.series[key].length; i++) {
+ this.series[key][i].clear();
+ }
}
this.scale = this.baseScale;
this.transX = this.baseTransX;
View
5 tests/markers.html
@@ -180,6 +180,9 @@
"US-CA": "black"
});
});
+ $('.button-reset-map').click(function(){
+ map.reset();
+ });
});
</script>
</head>
@@ -200,5 +203,7 @@
<input type="button" value="Remove map" class="button-remove-map"/>
&nbsp;&nbsp;&nbsp;
<input type="button" value="Change values" class="button-change-values"/>
+ &nbsp;&nbsp;&nbsp;
+ <input type="button" value="Reset map" class="button-reset-map"/>
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.