Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | var MapsVector = function () { |
| 2 | |||
| 3 | var setMap = function (name) { |
||
| 4 | var data = { |
||
| 5 | map: 'world_en', |
||
| 6 | backgroundColor: null, |
||
| 7 | borderColor: '#333333', |
||
| 8 | borderOpacity: 0.5, |
||
| 9 | borderWidth: 1, |
||
| 10 | color: '#c6c6c6', |
||
| 11 | enableZoom: true, |
||
| 12 | hoverColor: '#c9dfaf', |
||
| 13 | hoverOpacity: null, |
||
| 14 | values: sample_data, |
||
| 15 | normalizeFunction: 'linear', |
||
| 16 | scaleColors: ['#b6da93', '#427d1a'], |
||
| 17 | selectedColor: '#c9dfaf', |
||
| 18 | selectedRegion: null, |
||
| 19 | showTooltip: true, |
||
| 20 | onRegionOver: function (event, code) { |
||
| 21 | //sample to interact with map |
||
| 22 | if (code == 'ca') { |
||
| 23 | event.preventDefault(); |
||
| 24 | } |
||
| 25 | }, |
||
| 26 | onRegionClick: function (element, code, region) { |
||
| 27 | //sample to interact with map |
||
| 28 | var message = 'You clicked "' + region + '" which has the code: ' + code.toUpperCase(); |
||
| 29 | alert(message); |
||
| 30 | } |
||
| 31 | }; |
||
| 32 | |||
| 33 | data.map = name + '_en'; |
||
| 34 | var map = jQuery('#vmap_' + name); |
||
| 35 | if (!map) { |
||
| 36 | return; |
||
| 37 | } |
||
| 38 | map.width(map.parent().width()); |
||
| 39 | map.vectorMap(data); |
||
| 40 | } |
||
| 41 | |||
| 42 | |||
| 43 | return { |
||
| 44 | //main function to initiate map samples |
||
| 45 | init: function () { |
||
| 46 | setMap("world"); |
||
| 47 | setMap("usa"); |
||
| 48 | setMap("europe"); |
||
| 49 | setMap("russia"); |
||
| 50 | setMap("germany"); |
||
| 51 | |||
| 52 | // redraw maps on window or content resized |
||
| 53 | App.addResizeHandler(function(){ |
||
| 54 | setMap("world"); |
||
| 55 | setMap("usa"); |
||
| 56 | setMap("europe"); |
||
| 57 | setMap("russia"); |
||
| 58 | setMap("germany"); |
||
| 59 | }); |
||
| 60 | } |
||
| 61 | |||
| 62 | }; |
||
| 63 | |||
| 64 | }(); |
||
| 65 | |||
| 66 | jQuery(document).ready(function() { |
||
| 67 | MapsVector.init(); |
||
| 68 | }); |