Reputation: 3124
I am using a Hicharts US map to display the number of companies we have in each state with a drilldown option which then shows companies by county within a state. Data is in JSON format and comes from a CRM API call. Below is a sample:
[
{
"drilldown": "al",
"code": "us-al",
"value": 20
},
{
"drilldown": "wy",
"code": "us-wy",
"value": 1
}
]
Everything has been running fine for 2 years. Yesterday we moved servers and without a single change to the script I am now getting 'Uncaught TypeError: Cannot read property '0' of undefined error'.
I have my code available here: https://jsfiddle.net/7u5m3ht6/5/
Please, note that in the fiddle I am including JS code inline but in my original script it runs from a file called main.js and it's included at the bottom of the page with the rest of the libraries as such:
<script src="https://code.jquery.com/jquery-3.3.1.min.js"</script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
<script src="//code.highcharts.com/maps/highmaps.js"></script>
<script src="//code.highcharts.com/maps/modules/map.js"></script>
<script src="//code.highcharts.com/maps/modules/data.js"></script>
<script src="//code.highcharts.com/maps/modules/drilldown.js"></script>
<script src="//code.highcharts.com/mapdata/countries/us/us-all.js"></script>
<script src="includes/js/main.js"></script>
<script src="includes/js/companyTable.js"></script>
Upvotes: 0
Views: 1175
Reputation: 39069
With Highmaps
code you can not use the map.js
module, because it is Highmaps
itself but as a plugin for Highcharts or Highstock.
All you need to do is just remove this script:
<script src="//code.highcharts.com/maps/modules/map.js"></script>
Live demo: https://jsfiddle.net/BlackLabel/43Lcbndu/
Upvotes: 2