user2424726
user2424726

Reputation: 71

line and column chart in grouped categories in highcharts

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

Upvotes: 0

Views: 3541

Answers (1)

Zaheer Ahmed
Zaheer Ahmed

Reputation: 28548

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.

Upvotes: 1

Related Questions