如何在相同的 div 上附加图表?

How to append highcharts on same div?

我的网站上有一个绘制高图的代码,我需要在同一个 div(container) 上绘制多个图表,所以请指导实现这个,下面是我的代码

            $('#container').highcharts('StockChart', {
       chart: {
            borderColor: 'black',
            borderWidth: 0,
            borderRadius: 10,
            height:150
        }, 

我试过这个用于追加 $('#container').append.highcharts('StockChart', 但它似乎是一个错误的句法,请分享你的答案,谢谢

直接取自 highcharts 文档页面:

To combine several chart types in one chart you only need to create series of different types:

series: [{
    type: 'column',
    name: 'Jane',
    data: [3, 2, 1, 3, 4]
}, {
    type: 'column',
    name: 'John',
    data: [2, 3, 5, 7, 6]
}, {
    type: 'column',
    name: 'Joe',
    data: [4, 3, 3, 9, 0]
}, {
    type: 'spline',
    name: 'Average',
    data: [3, 2.67, 3, 6.33, 3.33]
}]

JSfiddle example.

为您需要的每个子图表重复以下过程。

var chartDiv = document.createElement('div'); // Create a new div
$('#container').append(chartDiv); // Append it to your container
$(chartDiv).highcharts(.....); // Initialize highcharts in that div