簡體   English   中英

高圖表與不同系列數據

[英]High chart with diffrent series data

我想用不同的系列數據創建一個圖表。 我對幾個問題進行了調查,每個問題都有不同的選擇。 我試圖使用此代碼:

$(function () {
$('#c_chart').highcharts({
    chart: {
        type: 'column'
    },
    xAxis: {
        categories: [
            'Question 1',
            'Question 2',
        ],
        crosshair: true
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Rainfall (mm)'
        }
    },
    tooltip: {
        headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
        pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
            '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
        footerFormat: '</table>',
        shared: true,
        useHTML: true
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0
        }
    },
    series: [{
        name: [['Option1', 'Option2']],
        data: [49.9, 56]

    }, {
        name: 'Option3',
        data: [83.6]

    }
    ]

});});

如何創建此圖表,如下圖所示:

圖表

我的英語很基礎,但是,我嘗試直率?

嘗試查看此鏈接,我不確定是否需要在plotOptions:{}或chart:{}中移動內容

其他選項則無法繪制圖表。 我找到了此鏈接,希望對您有所幫助

http://www.highcharts.com/docs/chart-design-and-style/design-and-style

http://api.highcharts.com/highcharts#plotOptions.bar.dataLabels

grettins,來自墨西哥:)

$(function () {
$('#container').highcharts({

    chart: {
        type: 'column'
    },

    title: {
        text: 'Questions Answers'
    },

    xAxis: {
        categories: ['Question1', 'Question2', 'Question3', 'Question4', 'Question5']
    },

    yAxis: {
        allowDecimals: false,
        min: 0,
        title: {
            text: 'Option Ticked'
        }
    },

    tooltip: {
        formatter: function () {
            return '<b>' + this.x + '</b><br/>' +
                this.series.name + ': ' + this.y + '<br/>';
        }
    },

    plotOptions: {
        column: {
            stacking: false
        }
    },

    series: [{
        name: 'Option1',
        data: [5, 3, 4, 7, 2]
    }, {
        name: 'Option2',
        data: [3, 4, 4, 2, 5]
    }, {
        name: 'Option3',
        data: [2, 5, 6, 2, 1]
    }, {
        name: 'Option4',
        data: [3, 0, 4, 4, 3]
    }]
});

});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM