问题描述
希望有人可以提供帮助.我试图在一张纸上同时使用highcharts和highstock,从CDN加载,最初我设置了各种highcharts-具有向下钻取的轨距图和条形图,并且使用以下所有方法都可以正常工作:
Hope someone can help.. ?I'm trying to use both highcharts and highstock on a single page, loading from CDN, initially I set up various highcharts - gauge and bar chart with drilldown and using the following all is working fine:
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/solid-gauge.js"></script>
我现在有一个高库存图表,但是我无法在同一页面上一起使用它-我尝试过只使用高库存(没有高图表),然后添加高图表-更多和模块,也尝试使用高图表和然后将highstock加载为一个也不起作用的模块,例如
I now have a highstock chart but I can't get it to work together on the same page - I've tried just using highstock (without highcharts) and then adding highcharts-more and the modules, also tried using highcharts and then loading highstock as a module which didn't work either e.g
<script src="https://code.highcharts.com/modules/highstock.js"></script>
或
<script src="https://code.highcharts.com/modules/stock.js"></script>
我认为CDN链接的顺序对于使其正常工作也至关重要?
I assume the order of the CDN links is crucial to make it work too?
我还知道,在绘制图表时,highcharts使用Highcharts.chart
,highstock使用Highcharts.stockChart
-那么当同时使用这两种方法时,它将如何工作?
I'm also aware that when rendering the charts highcharts uses Highcharts.chart
and highstock uses Highcharts.stockChart
- so how would this work when using both?
非常感谢.
推荐答案
通过使用Highstock,您可以使用其他模块创建stockChart
和标准chart
:
By using Highstock, you can create both stockChart
and standard chart
with additional modules:
Highcharts.chart('container', {
series: [{
type: 'solidgauge',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}]
});
Highcharts.stockChart('container1', {
series: [{
type: 'line',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}]
});
实时演示: http://jsfiddle.net/BlackLabel/54ezsbgr/
如果确实需要分别使用Highstock和Highcharts,则可以通过以下方式进行操作:
If you really need to use Highstock and Highcharts separately, you can do it in this way:
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script>
var Highstock = Highcharts;
Highcharts = null;
</script>
<script src="https://code.highcharts.com/highcharts.js"></script>
实时演示: http://jsfiddle.net/BlackLabel/0vshoqpa/
这篇关于使用高图& highstock一起在同一页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!