高图中分组类别中的折线图和柱形图

时间:2013-12-25 08:21:53

标签: highcharts

我要绘制带有分组categories.js的列和折线图 下面是我的代码的链接

  $(function () {
var chart = new Highcharts.Chart({
    chart: {
        renderTo: "container",
        type: "column"
    },
    title: {
        text: null
    },
    series: [{"name":"market1","data":[1,3,3,0]},{"name":"market2","data":[0,0,0,0,3,2,3,0]},{"name":"market3","data":[3,1,3,0], type: 'line'}],
    xAxis: {
        categories:[{"name":"newyork","categories":["p1","p2","p3","p4"]},{"name":"washington","categories":["p1","p2","p3","p4"]}]
    },
     yAxis: [{ // Primary yAxis
            labels: {
                format: '{value}°C',
                style: {
                    color: '#89A54E'
                }
            },
            title: {
                text: 'Temperature',
                style: {
                    color: '#89A54E'
                }
            }
        }, { // Secondary yAxis
            title: {
                text: 'Rainfall',
                style: {
                    color: '#4572A7'
                }
            },
            labels: {
                format: '{value} mm',
                style: {
                    color: '#4572A7'
                }
            },
            opposite: true
        }],
});

});

下面是我的jsfiddle

的链接

http://jsfiddle.net/srikanth_kulkarni/gmrpY/

我试图让市场3(折线图)与降雨量(第二个y轴)而不是温度(第一个y轴)进行测量。

任何建议都会非常有用

此致 Srikanth Kulkarni

1 个答案:

答案 0 :(得分:1)

Fiddle update

您需要设置yAxis:Number|String

{"name":"market3","data":[3,1,3,0],yAxis:1, type: 'line'}],

索引从零开始;所以1在这里为yAxis 2。