{"action":"created","issue":{"url":"https://api.github.com/repos/manifestinteractive/jqvmap/issues/192","labels_url":"https://api.github.com/repos/manifestinteractive/jqvmap/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/manifestinteractive/jqvmap/issues/192/comments","events_url":"https://api.github.com/repos/manifestinteractive/jqvmap/issues/192/events","html_url":"https://github.com/manifestinteractive/jqvmap/issues/192","id":121761818,"number":192,"title":"Updating country colours from a Javascript","user":{"login":"andreasspeck","id":8565400,"avatar_url":"https://avatars.githubusercontent.com/u/8565400?v=3","gravatar_id":"","url":"https://api.github.com/users/andreasspeck","html_url":"https://github.com/andreasspeck","followers_url":"https://api.github.com/users/andreasspeck/followers","following_url":"https://api.github.com/users/andreasspeck/following{/other_user}","gists_url":"https://api.github.com/users/andreasspeck/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasspeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasspeck/subscriptions","organizations_url":"https://api.github.com/users/andreasspeck/orgs","repos_url":"https://api.github.com/users/andreasspeck/repos","events_url":"https://api.github.com/users/andreasspeck/events{/privacy}","received_events_url":"https://api.github.com/users/andreasspeck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-11T18:07:01Z","updated_at":"2015-12-11T19:00:34Z","closed_at":null,"body":"I am trying to update the colours of ALL countries when some selects a year in a year selector above the map. What is working is the following:\r\n\r\n1.) I get a long string with the format \"code: 'htmlcolour', code: 'htmlcolour' ... \"\r\nThis string seems to be correct. In fact, I do update the colours after initialising the map calling jQuery from php and getting that string in (jQuery('#vmap').vectorMap('set', 'colors', { thelongstring } );\r\n\r\nHowever, this is not working from my Javascript. \r\n\r\nI actually had two problems here:\r\n1.) My world map is called \"world_en_merc\" (or was). This worked fine when I was updating the colours making the call to jQuery from my php script. \r\nHowever, trying to do the same from my Javascript it complained that world_en was not initialised - obviously not, as I initialised a map called world_en_merc. This error went away when I changed the name of the map to world_en.\r\n2.) I can call jQuery('#vmap').vectorMap('set', 'colors', { us: '#000000' } ); from my Javascript, and that works. However, it does not work when I try to put in the string variable:\r\n- jQuery('#vmap').vectorMap('set', 'colors', { mystringwithallcodes } );\r\n- jQuery('#vmap').vectorMap('set', 'colors', mystringwithallcodespluscurlybrackets );\r\n- jQuery('#vmap').vectorMap( mystringwithalltheabove );\r\n\r\nAny ideas?\r\n"},"comment":{"url":"https://api.github.com/repos/manifestinteractive/jqvmap/issues/comments/164018268","html_url":"https://github.com/manifestinteractive/jqvmap/issues/192#issuecomment-164018268","issue_url":"https://api.github.com/repos/manifestinteractive/jqvmap/issues/192","id":164018268,"user":{"login":"andreasspeck","id":8565400,"avatar_url":"https://avatars.githubusercontent.com/u/8565400?v=3","gravatar_id":"","url":"https://api.github.com/users/andreasspeck","html_url":"https://github.com/andreasspeck","followers_url":"https://api.github.com/users/andreasspeck/followers","following_url":"https://api.github.com/users/andreasspeck/following{/other_user}","gists_url":"https://api.github.com/users/andreasspeck/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasspeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasspeck/subscriptions","organizations_url":"https://api.github.com/users/andreasspeck/orgs","repos_url":"https://api.github.com/users/andreasspeck/repos","events_url":"https://api.github.com/users/andreasspeck/events{/privacy}","received_events_url":"https://api.github.com/users/andreasspeck/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T19:00:34Z","updated_at":"2015-12-11T19:00:34Z","body":"I finally managed it - I need to turn the string into an object.\r\n\r\n1) I changed my php to give me a string with double quotes\r\n2) I turn that into an object: var resultobj = eval(\"({\"+result+\"})\");\r\n\r\nAnd now I call jQuery('#vmap').vectorMap('set', 'colors', resultobj );\r\nAnd it updates my colours!\r\n\r\n\r\n"}}