line and column chart in grouped categories in highcharts

南楼画角 提交于 2020-01-16 14:53:28

问题


I am to plot column and line chart with grouped categories.js below is the link of my code

  $(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
        }],
});

});

below is the link of my jsfiddle

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

i am trying to get market3(line chart) to be measured against rainfall(second y axis) instead of temprature(first y axis).

Any suggestions would be really helpful

Regards, Srikanth Kulkarni


回答1:


Fiddle update

You need to set yAxis:Number|String:

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

index starts with zero; so 1 here for yAxis 2.



来源:https://stackoverflow.com/questions/20770632/line-and-column-chart-in-grouped-categories-in-highcharts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!