一起使用Highchart和Highmap时解决冲突(TypeError:ma不是函数)

问题描述 投票:14回答:3

我有一个页面,其中包含报表功能的图表和地图菜单。然后,我选择Highchart-Highmap库来达到上述目的。图表功能运行良好但是当我开发地图功能时会出现错误

TypeError:ma不是函数

  • 我已经跟踪了ma函数出现在highchart.js和highmaps.js中的问题,但我不知道如何解决这个冲突。
  • 我尝试将jQuery.noConflict();放在highmaps中,但冲突仍然存在

这是我在主页面中的代码

... some html code
<script type="text/javascript" src="././js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="././js/highcharts/highcharts-more.js"></script>
<script type="text/javascript" src="././js/highcharts/highcharts-3d.js"></script>            
<script type="text/javascript" src="././js/highcharts/modules/drilldown.js"></script>
<script type="text/javascript" src="././js/highcharts/modules/exporting.js"></script>

... some html code
<script type="text/javascript" src="././js/Highmaps/highmaps.js"></script>
<script type="text/javascript" src="././js/Highmaps/modules/data.js"></script>                
<script type="text/javascript" src="././js/Highmaps/modules/exporting.js"></script> 

我怎么解决这个问题?

javascript jquery highcharts conflicting-libraries highmaps
3个回答
39
投票

您需要使用map.js模块而不是highmaps。

<script src="//code.highcharts.com/maps/modules/map.js"></script>

Here is the documentation on using both together


5
投票

您必须在highcharts.js之后包含此脚本标记:

<script src="https://code.highcharts.com/maps/modules/map.js"></script> 

1
投票

我遇到了同样的问题,并通过在地图后放置高图来解决它

<script src="http://code.highcharts.com/maps/highmaps.js"></script>
<script src="http://code.highcharts.com/maps/modules/data.js"></script>
<script src="http://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="http://code.highcharts.com/mapdata/custom/world.js"></script>
<script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>

http://jsfiddle.net/danny_shumer/tc898kgv/2/

© www.soinside.com 2019 - 2024. All rights reserved.