30

ここに画像の説明を入力してください

$(document).ready(function() {
chart1 = new Highcharts.Chart({
    chart: {
        renderTo: 'QueryResultsChart',
        type: 'bar'
    },
    title: {
        text: 'Production History'
    },
    xAxis: {
        title: {
            text: 'Production Day'
        },
        type: 'datetime'
    },
    yAxis: {
        title: {
            text: 'Gross Production'
        }
    },
    series: [{
        name: 'Data',
        data: []
    }]
});
chart1.series[0].setData(". json_encode($aChartData) .");
});

データは正しいものです。何らかの理由でxAxisがyAxisに表示されているだけです...

4

3 に答える 3

61

縦棒グラフはcolumn、Highchartでは'sと呼ばれます。

これを変える:

type: 'column' //was 'bar' previously`

ここの例を参照してください:http://jsfiddle.net/aznBb/

于 2012-06-27T22:05:24.050 に答える
17

Moin Zamanの答えを拡張するために、私は彼のjsfiddle http://jsfiddle.net/aznBb/で遊んで、これを見つけました。

これは水平です。

chart: {
    type: 'bar',
    inverted: false // default
}

これも水平です。

chart: {
    type: 'bar',
    inverted: true
}

これは垂直です。

chart: {
    type: 'column',
    inverted: false // default
}

これは水平で、棒グラフと明らかに同じです。

chart: {
    type: 'column',
    inverted: true
}

非常に奇妙な。実際に何が設定されていても、type: 'bar'エイリアスtype: 'column'とフォースを推測することしかできません。ブール値inverted: trueを切り替えただけでいいのですが。inverted

于 2014-02-12T21:14:49.427 に答える
1

次のようなことを試してください。

$(function () {

Highcharts.chart('container', {

    chart: {
        type: 'columnrange',
        inverted: false
    },

    title: {
        text: 'Temperature variation by month'
    },

    subtitle: {
        text: 'Observed in Vik i Sogn, Norway'
    },

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    yAxis: {
        title: {
            text: 'Temperature ( °C )'
        }
    },

    tooltip: {
        valueSuffix: '°C'
    },

    plotOptions: {
        columnrange: {
            dataLabels: {
                enabled: true,
                formatter: function () {
                    return this.y + '°C';
                }
            }
        }
    },

    legend: {
        enabled: false
    },

    series: [{
        name: 'Temperatures',
        data: [
            [-9.7, 9.4],
            [-8.7, 6.5],
            [-3.5, 9.4],
            [-1.4, 19.9],
            [0.0, 22.6],
            [2.9, 29.5],
            [9.2, 30.7],
            [7.3, 26.5],
            [4.4, 18.0],
            [-3.1, 11.4],
            [-5.2, 10.4],
            [-13.5, 9.8]
        ]
    }]

});

});

http://jsfiddle.net/b940oyw4/

于 2017-01-11T15:16:02.530 に答える